10-12-2003, 10:44 PM
Pages: 1 2
10-12-2003, 11:16 PM
Quote:Anyways, I doubt someone who didn't use spaces would approve of your rampant tabbing, Ninkazu..
The code is completely readable and well styled. I tab C/Java differently, but I can read this without getting dizzy. That doesn't happen with your code.
10-12-2003, 11:27 PM
ditto
10-13-2003, 12:21 AM
I'm not Pasco, and my coding style is the same as his, except I add vaars to my NEXT statements. *STAB*.
10-13-2003, 06:24 AM
Am I hearing this correctly? Does Agg prefer spaghetti code over well written self-documenting code?
P.S. Is there a way of grabbing a color that has been drawn? I'm translating relblobs1 to java, and the only thing I need now is how to grab colors.
P.S. Is there a way of grabbing a color that has been drawn? I'm translating relblobs1 to java, and the only thing I need now is how to grab colors.
10-13-2003, 06:55 AM
Tabs don't make well-written code.
*STAB*
*STAB*
10-13-2003, 08:59 PM
Instead of making another thread, I'll just post this here.
http://www.venosoft.com/ninkazu/plasma.html
If any of you have seen Optimus' intro for Toshi's compo, you'll recognize this.
::EDIT::
Here's the code for those of you whom are curious.
http://www.venosoft.com/ninkazu/plasma.html
If any of you have seen Optimus' intro for Toshi's compo, you'll recognize this.
::EDIT::
Here's the code for those of you whom are curious.
Code:
import java.awt.*;
import java.applet.Applet;
import java.awt.image.*;
public class plasma extends Applet implements Runnable
{
int [] Lsin1 = new int[2049];
int [] Lsin2 = new int[2049];
Color [] pal = new Color[256];
int ytp = 0, yttp = 0, k = 0, yp = 0, c = 0, yytp = 0;
Image imgbuffer = null;
Graphics gbuffer = null;
Thread app = null;
public void start()
{
if( app == null )
{
app = new Thread(this);
app.start(); // This invokes run() (see below)
}
}
public void init()
{
setBackground(Color.black);
imgbuffer = createImage(64, 88);
gbuffer = imgbuffer.getGraphics();
gbuffer.setColor(Color.black);
gbuffer.fillRect(0, 0, 64, 88);
for (int i=-319; i<320; i++)
{
Lsin1[i+319] = (int)(Math.sin(i/12.0)*8.0);
Lsin2[i+319] = (int)(Math.sin(i/6.0)*8.0);
}
int rr, gg, bb;
for (int i = 1; i<=16; i++)
{
rr = (16-i)*4+3;
gg = (16-i)*4+3;
bb = (16-i)*4+3;
pal[i] = new Color(rr*4,gg*4,bb*4);
}
for (int i = 32; i<=47; i++)
{
rr = (47-i)*4;
gg = (47-i)*4;
bb = (47-i)*4;
pal[i] = new Color(rr*4,gg*4,bb*4);
}
for (int i = 48; i<=63; i++)
{
rr = (i - 63)*4;
gg = (i - 63)*4;
bb = (i - 63)*4;
if (rr < 0) rr = 0;
if (gg < 0) gg = 0;
if (bb < 0) bb = 0;
pal[i] = new Color(rr*4,gg*4,bb*4);
}
for (int i = 64; i<=95; i++)
{
rr = 127-i;
gg = 127-i;
bb = i-64;
if (rr < 0) rr = 0;
if (gg < 0) gg = 0;
if (bb < 0) bb = 0;
pal[i] = new Color(rr*4,gg*4,bb*4);
}
for (int i = 96; i<=127; i++)
{
rr = 127-i;
gg = 127-i;
bb = i-64;
if (rr < 0) rr = 0;
if (gg < 0) gg = 0;
if (bb < 0) bb = 0;
pal[i] = new Color(rr*4,gg*4,bb*4);
}
for (int i = 128; i<=255; i++)
{
rr = (i - 128)/6;
gg = (i - 128)/4;
bb = (i - 128)/2;
pal[i] = new Color(rr*4,gg*4,bb*4);
}
}
public void paint(Graphics screen)
{
if (imgbuffer != null){
screen.drawImage(imgbuffer, 0, 0, this);
}
}
public void update(Graphics g)
{
paint(g);
}
public void run()
{
Graphics g = getGraphics();
while (app != null)
{
eraseApp();
paintApp(g);
try
{
Thread.sleep(10);
}catch(InterruptedException e) { stop(); }
}
}
public void stop()
{
app = null;
}
public void paintApp(Graphics g)
{
if (ytp < 76) ytp++;
if (ytp < 62) yttp = ytp;
k++;
if (k == 75) k = 0;
yp = 0;
for (int y = 0; y<88; y++)
{
for (int x = 0; x<=64; x++)
{
c = Lsin1[x + k + 319] + Lsin1[y + k + 319] + Lsin1[x + Lsin2[x - y + k + 319] + 319];
c += Lsin2[y + Lsin1[y - x + k + 319] + 319] + 96;
if (c == 128) c = 127;
if (y + 1 > 0)
{
gbuffer.setColor(pal[c]);
gbuffer.fillRect(x,y,1,1);
} else {
gbuffer.setColor(pal[0]);
gbuffer.fillRect(x,y,1,1);
}
}
}
g.drawImage(imgbuffer, 0, 0, this);
}
public void eraseApp()
{
gbuffer.setColor(Color.black);
gbuffer.fillRect(0,0,320,200);
}
}
Pages: 1 2