Mail Archives: djgpp/1997/02/23/00:48:45
In article <nQgAZIAVUODzEwI3 AT jenkinsdavid DOT demon DOT co DOT uk>, David Jenkins
<me AT jenkinsdavid DOT demon DOT co DOT uk> writes
#include <stdlib.h>
#include <stdio.h>
#include <allegro.h>
void main()
{
/* If I un // the next two lines and // the "int ns = 100;" line I
should be able to enter the number of stars.BUT I keep getting errors
during compiling.Any ideas???
*/
// printf("How many stars shall I use???");
// scanf("%d", ns);
int ns = 100;
int d = 1;
int o = 1;
int x[ns];
int y[ns];
int sp[ns];
PALLETE pal;
for (d = 1; d < 4; d++) {
pal[d].r = d*20;
pal[d].g = d*20;
pal[d].b = d*20;
}
allegro_init();
set_gfx_mode(GFX_VGA, 320, 200, 0, 0);
set_pallete(pal);
install_keyboard();
for (d = 0; d < ns; d++) {
x[d] = rand() % SCREEN_W;
y[d] = rand() % SCREEN_H;
sp[d] = rand() % 3 + 1;
}
while (!keypressed()) {
for (d = 1; d < ns; d++) {
x[d] = x[d] - sp[d];
if (x[d] <= 0)
x[d] = SCREEN_W;
putpixel(screen, x[d], y[d], sp[d]);
}
vsync();
clear(screen);
}
exit(0);
}
--
David Jenkins
- Raw text -