eobish
diff src/main.c @ 3:e32bdd5fb622
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 18 Jan 2015 05:51:51 +0200 |
parents | src/main.cc@cdbcae5b3b98 |
children | ce0548d24918 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/main.c Sun Jan 18 05:51:51 2015 +0200 1.3 @@ -0,0 +1,37 @@ 1.4 +#include <stdio.h> 1.5 +#include "fblib.h" 1.6 + 1.7 +static void display(); 1.8 + 1.9 +int main(int argc, char **argv) 1.10 +{ 1.11 + if(fb_init(320, 240, 8) == -1) { 1.12 + return 1; 1.13 + } 1.14 + fb_set_palette_entry(1, 255, 0, 0); 1.15 + 1.16 + for(;;) { 1.17 + if(fb_process_events() == -1) { 1.18 + break; 1.19 + } 1.20 + display(); 1.21 + } 1.22 + 1.23 +done: 1.24 + fb_shutdown(); 1.25 + return 0; 1.26 +} 1.27 + 1.28 +void display() 1.29 +{ 1.30 + int i; 1.31 + int width = fb_get_width(); 1.32 + int height = fb_get_height(); 1.33 + unsigned char *pixels = (unsigned char*)fb_begin_frame(); 1.34 + 1.35 + for(i=0; i<width * height; i++) { 1.36 + *pixels++ = 1; 1.37 + } 1.38 + 1.39 + fb_end_frame(); 1.40 +}