eobish

view src/main.cc @ 2:cdbcae5b3b98

added fblib
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 18 Jan 2015 03:16:37 +0200
parents 465ca72c9657
children
line source
1 #include <stdio.h>
2 #include "fblib.h"
4 static void display();
6 int main(int argc, char **argv)
7 {
8 if(fb_init(320, 240, 8) == -1) {
9 return 1;
10 }
11 fb_set_palette_entry(1, 255, 0, 0);
13 for(;;) {
14 if(fb_process_events() == -1) {
15 break;
16 }
17 display();
18 }
20 done:
21 fb_shutdown();
22 return 0;
23 }
25 void display()
26 {
27 int width = fb_get_width();
28 int height = fb_get_height();
29 unsigned char *pixels = (unsigned char*)fb_begin_frame();
31 for(int i=0; i<width * height; i++) {
32 *pixels++ = 1;
33 }
35 fb_end_frame();
36 }