main.c
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <linux/fb.h> #include <sys/ioctl.h> #include <SDL.h> int main(int argc, char** argv) { uint32_t cnt = 0; SDL_Surface* screen = NULL; uint32_t col[] = { 0xf800, 0x7e0, 0x001f }; int zero = 0, fd = open("/dev/fb0", O_RDWR); SDL_Init(SDL_INIT_VIDEO); screen = SDL_SetVideoMode(320, 240, 16, SDL_SWSURFACE | SDL_DOUBLEBUF); while (cnt < 300) { cnt += 1; SDL_FillRect(screen, &screen->clip_rect, col[cnt % 3]); SDL_Flip(screen); ioctl(fd, FBIO_WAITFORVSYNC, &zero); } SDL_Quit(); close(fd); return 0; }