eobish
changeset 3:e32bdd5fb622
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 18 Jan 2015 05:51:51 +0200 |
parents | cdbcae5b3b98 |
children | ce0548d24918 |
files | src/main.c src/main.cc |
diffstat | 2 files changed, 37 insertions(+), 36 deletions(-) [+] |
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 +}
2.1 --- a/src/main.cc Sun Jan 18 03:16:37 2015 +0200 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,36 +0,0 @@ 2.4 -#include <stdio.h> 2.5 -#include "fblib.h" 2.6 - 2.7 -static void display(); 2.8 - 2.9 -int main(int argc, char **argv) 2.10 -{ 2.11 - if(fb_init(320, 240, 8) == -1) { 2.12 - return 1; 2.13 - } 2.14 - fb_set_palette_entry(1, 255, 0, 0); 2.15 - 2.16 - for(;;) { 2.17 - if(fb_process_events() == -1) { 2.18 - break; 2.19 - } 2.20 - display(); 2.21 - } 2.22 - 2.23 -done: 2.24 - fb_shutdown(); 2.25 - return 0; 2.26 -} 2.27 - 2.28 -void display() 2.29 -{ 2.30 - int width = fb_get_width(); 2.31 - int height = fb_get_height(); 2.32 - unsigned char *pixels = (unsigned char*)fb_begin_frame(); 2.33 - 2.34 - for(int i=0; i<width * height; i++) { 2.35 - *pixels++ = 1; 2.36 - } 2.37 - 2.38 - fb_end_frame(); 2.39 -}