X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fdemo.c;h=f51dcc1b6fe13301bf327e7ebd71669a5bfec0bc;hb=628ef3345462458f2fb6be034583e61238b89f89;hp=cebac7cb388bbe762b791929ea3227ce4e476126;hpb=9b30c8adb9ae6f562f3ef1c8b3b5ab57824b9ba3;p=andemo diff --git a/src/demo.c b/src/demo.c index cebac7c..f51dcc1 100644 --- a/src/demo.c +++ b/src/demo.c @@ -37,6 +37,14 @@ int demo_init(void) if(dsys_init("data/demoscript") == -1) { return -1; } + if(opt.scrname) { + struct demoscreen *scr = dsys_find_screen(opt.scrname); + if(scr) { + dsys_run_screen(scr); + } else { + fprintf(stderr, "ignoring screen option, no such screen: %s\n", opt.scrname); + } + } return 0; } @@ -51,6 +59,25 @@ void demo_display(void) dsys_update(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glBindTexture(GL_TEXTURE_2D, tex_logo); + glUseProgram(sdr_foo); + gl_begin(GL_QUADS); + gl_color4f(1, 1, 1, dsys_value("flashlogo")); + gl_texcoord2f(0, 1); + gl_vertex2f(-1, -1); + gl_texcoord2f(1, 1); + gl_vertex2f(1, -1); + gl_texcoord2f(1, 0); + gl_vertex2f(1, 1); + gl_texcoord2f(0, 0); + gl_vertex2f(-1, 1); + gl_end(); + glDisable(GL_BLEND); + dsys_draw(); } @@ -96,6 +123,12 @@ void demo_keyboard(int key, int pressed) } else { int i; + + if(dsys.scr_override && dsys.scr_override->keyboard) { + dsys.scr_override->keyboard(key, pressed); + break; + } + for(i=0; ikeyboard) scr->keyboard(key, pressed); @@ -107,6 +140,12 @@ void demo_keyboard(int key, int pressed) void demo_mouse(int bn, int pressed, int x, int y) { int i; + + if(dsys.scr_override && dsys.scr_override->mouse) { + dsys.scr_override->mouse(bn, pressed, x, y); + return; + } + for(i=0; imouse) scr->mouse(bn, pressed, x, y); @@ -116,6 +155,11 @@ void demo_mouse(int bn, int pressed, int x, int y) void demo_motion(int x, int y) { int i; + + if(dsys.scr_override && dsys.scr_override->motion) { + dsys.scr_override->motion(x, y); + } + for(i=0; imotion) scr->motion(x, y);