home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Más de 2,500 Juegos
/
CD5.iso
/
zipdat
/
4806
/
4806.txt
next >
Wrap
Text File
|
2000-12-12
|
2KB
|
87 lines
Here's something seasonal for all you Palm owners.
A little something I knocked up in PocketC on my commute...
A snowflake "screensaver"!
Each flake one is a beautiful unique fractal!
You'll need the PDB file (included),
and the PocketC runtime: http://www.orbworks.com/PocketC_rt.zip
OR
The source code (below),
and the PocketC compiler: http://www.orbworks.com/PocketC.zip
Thad
Source code follows:
//snow
//(c) T.Frogley Dec 2000
//bit map, keeps track of whats where
int bmp[256];//16x16
//screen x,y snowflake locations
int sx[5]={0,32,64,96,128};
int sy[4]={32,64,96,128};
//global x,y snowflake location
int gx;
int gy;
#include "memset.h"
//puts down a point
//4 way reflection
point(int x,int y)
{
bmp[x+16*y]=1;
line(1,gx+x,gy+y,gx+x,gy+y);
line(1,gx+x,gy+31-y,gx+x,gy+31-y);
line(1,gx+31-x, gy+y,gx+31-x,gy+y);
line(1,gx+31-x, gy+31-y,gx+31-x,gy+31-y);
}
//shooting particle algorythm
int doit(int x, int y)
{
int done=0;
int dd,i,n,dx,dy;
point(x,y);
n=0;
do{
x=0;dx=1;
y=15-random(n);dy=0;
if (random(2)==1){
x=y; y=0;dy=1;dx=0;
}
i=0;
do{
x=x+dx;y=y+dy;
if (x>15) break; if (y>15) break;
if (bmp[x+16*y]==1){
point(x-dx,y-dy);
if (i==0) done = 1;
break;
}
i++;
}while(1);
if (n<15) n++;
}while(!done);
}
main()
{
graph_on();
title("Snow (c) Thad");
do{
gx=sx[random(5)];
gy=sy[random(4)];
memset(bmp,0,256);
rect(0,gx,gy,gx+32,gy+32,0);
doit(15,15);
}while(1);
}