Beispiel #1
0
void Gate::update(float deltaTime)
{
	if (!finish)
	{
		animated(deltaTime);
		this->_rectRS = this->updateRectRS(this->_width, this->_height);
	}
}
Beispiel #2
0
int main()
{
	srand(time(NULL));
	fbfd = open("/dev/fb0", O_RDWR);
	if(fbfd == -1)
	{
		perror("Error: cannot open frambuffer device");
		exit(1);
	}
	if(ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo) == -1)
	{
		perror("Error reading fixed information");
		exit(2);
	}
	if(ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo) == -1)
	{
		perror("Error reading variable information");
		exit(3);
	}
	fbp = (char *)mmap(0, xres * yres * vinfo.bits_per_pixel / 8, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0);
	if(fbp == NULL)
	{
		perror("Error: failed to map framebuffer device to memory");
		exit(4);
	}
	clear(0,0,xres,yres);
	int c;
	printf("Framebufferpuukotus v0.01\nEmil Fihlman\nGraffathon 2015\n");
	printf("0: Clear 1: Square 2: Animated 3: Smooth 4: Noise 5: Mandelbrot 6: Iterated 7: Zoom\n");
	printf("Command: ");
	while(1)
	{
		printf("\rCommand: %c",c=getch());
		printf("                                                            ");
		printf("\rCommand: ");
		switch(c)
		{
			case '0':
				clear(0, 96, xres, yres);
				break;
			case '1':
				square(500, 300, 700, 600, 0, 255, 0);
				break;
			case '2':
				animated();
				break;
			case '3':
				smooth();
				break;
			case '4':
				noise();
				break;
			case '5':
				mandelbrot();
				break;
			case '6':
				iterated();
				break;
			case '7':
				zoom();
				break;
			default:
				continue;
		}
	}
	clear(0, 0, xres, yres);
	munmap(fbp, xres * yres * vinfo.bits_per_pixel / 8);
	close(fbfd);
	return(0);
}