#include <graphics.h>
#include <stdlib.h>
#include <time.h>

void init_game(void);
void draw_star(void);
void scroll(void);

main()
{

	init_game();
	draw_star();
	scroll();

	return 0;
}

void init_game()
{
	int driver;
	int mode;

	driver = DETECT;
	initgraph(&driver, &mode, "");
	srand(time(0));

}
void draw_star()
{
	int i, x, y;

	for(i=0;i<2500;i++)
	{
		x=rand()%640;
		y=rand()%480;
		putpixel(x, y, 255);
	}
}
void scroll()
{
	void *pic[20][15];
	void *one;
	int size, i, x, y;

	size = imagesize(0, 0, 32, 32);

	for(x=0;x<20;x++)
	{
		pic[x][0] = malloc(size);
		getimage(x*32, 0, (x+1)*32, 32, pic[x][0]);
		putimage(x*32, 0, pic[x][0], XOR_PUT);
	}

//	one = malloc(size);
//	getimage(0, 0, 32, 32, one);

	cleardevice();
	for(y=0;y<15;y++);
	{
		for(x=0;x<20;x++);
		{
			putimage(x*32, y*32, pic[0][0], XOR_PUT);
		}
	}
}
