From 53da6966d8fc6efb26e6551e707ac27c7f8e4f5c Mon Sep 17 00:00:00 2001 From: Gentoo Date: Sat, 27 Mar 2021 09:24:32 +1100 Subject: initial commit --- Makefile | 15 ++++++++++ main.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ notes.txt | 1 + splash.wbmp | Bin 0 -> 865 bytes splash.xcf | Bin 0 -> 1919 bytes 5 files changed, 109 insertions(+) create mode 100644 Makefile create mode 100644 main.c create mode 100644 notes.txt create mode 100644 splash.wbmp create mode 100644 splash.xcf diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0d5a4b0 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +CC=gcc +CFLAGS=-O3 -march=native -pipe + +OBJ = main.o +LIBS = -lg15daemon_client -lg15render + +%.o: %.c $(DEPS) $(HEADERS) + $(CC) -c -o $@ $< $(CFLAGS) + +g15player: $(OBJ) + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + +clean: + rm $(OBJ) + rm g15player diff --git a/main.c b/main.c new file mode 100644 index 0000000..821ac07 --- /dev/null +++ b/main.c @@ -0,0 +1,93 @@ +#include +#include +#include +#include +#include +#include /* struct stat, fchmod (), stat (), S_ISREG, S_ISDIR */ + +int g15screen_fd; + +int main() +{ +g15canvas *canvas; + +if((g15screen_fd = new_g15_screen(G15_G15RBUF))<0) + { + fprintf(stderr,"Can't connect to G15daemon\n"); + return -1; + } + +canvas = (g15canvas *)malloc(sizeof(g15canvas)); +if(canvas != NULL){g15r_initCanvas(canvas);} +else {fprintf(stderr,"Malloc failed!\n"); return -1;} + +g15r_loadWbmpSplash(canvas,"splash.wbmp"); +g15_send(g15screen_fd,(char *)canvas->buffer,G15_BUFFER_LEN); +sleep(1); //show logo for 1 second +g15r_clearScreen (canvas, G15_COLOR_WHITE); + +/* +//checkerboard pattern +int i,j; +for (j=0;jbuffer,G15_BUFFER_LEN); +sleep(1);//sleep for 1 second +//g15r_clearScreen (canvas, G15_COLOR_WHITE); +*/ + +char image[] = "badapple/out0000.wbmp"; + +struct stat sts;//for stat + +int i,j; + +//todo: Actual proper for loops +for (;image[12]!=':';++image[12]) +{ + for(;image[13]!=':';++image[13]) + { + for (;image[14]!=':';++image[14]) + { + for (i=0;i<9;++i) + { + if ((stat(image, &sts)) == -1){goto exit;}//exit if file does not exist + g15r_loadWbmpSplash(canvas,image);//The splash function is the best option since g15r_drawXBM() doesn't seem to exist anymore + + g15_send(g15screen_fd,(char *)canvas->buffer,G15_BUFFER_LEN); + ++image[15]; + //1 second = 1000000 microseconds + //todo: Accurate frame timing. Currently too fast + usleep(42666);//~24fps + //printf("%s\n",image); + } + image[15] = '0'; + } + image[14] = '0'; + } +image[13]='0'; +} + +exit:; + +//g15r_clearScreen(canvas, G15_COLOR_WHITE); + +//g15r_drawCircle(canvas, G15_LCD_HEIGHT, 0, 30, 100, G15_COLOR_BLACK); +//g15r_drawBar(canvas, 0, 0, 40, 40, G15_COLOR_BLACK, 1,1,0); + +//space for up to 4 lines when TEXT_LARGE, 5 when TEXT_MED and 6 when TEXT_SMALL +//g15r_renderString(canvas, "Install Gentoo", 0, G15_TEXT_LARGE,0,0); + +//g15r_setPixel(canvas,0,0,1); +//g15r_setPixel(canvas,G15_LCD_WIDTH-1,G15_LCD_HEIGHT-1,1); + +//wait for enter keypress to terminate (while(1) burns CPU cycles like no tommorrow) +//while(getchar() != '\n'); + +close(g15screen_fd); +//canvas is freed by g15daemon on close(g15screen_fd) it seems +return 0; +} diff --git a/notes.txt b/notes.txt new file mode 100644 index 0000000..dc28660 --- /dev/null +++ b/notes.txt @@ -0,0 +1 @@ +Due to library crash, g15player needs to be run under valgrind not to crash past ~300 frames displayed diff --git a/splash.wbmp b/splash.wbmp new file mode 100644 index 0000000..06e08e2 Binary files /dev/null and b/splash.wbmp differ diff --git a/splash.xcf b/splash.xcf new file mode 100644 index 0000000..5c5eb43 Binary files /dev/null and b/splash.xcf differ -- cgit v1.2.3