X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fdemo.c;h=f51dcc1b6fe13301bf327e7ebd71669a5bfec0bc;hb=HEAD;hp=77c33d2617bd83942af450a2239dacb0204ecbfc;hpb=313480bbe9994a200ed9a4355d97a033bf0d6151;p=andemo diff --git a/src/demo.c b/src/demo.c index 77c33d2..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(); } @@ -60,9 +87,9 @@ void demo_reshape(int x, int y) glViewport(0, 0, x, y); - for(i=0; ireshape) { - dsys_screens[i]->reshape(x, y); + for(i=0; ireshape) { + dsys.screens[i]->reshape(x, y); } } } @@ -73,7 +100,7 @@ void demo_keyboard(int key, int pressed) switch(key) { case ' ': - if(dsys_running) { + if(dsys.running) { dsys_stop(); } else { dsys_run(); @@ -90,14 +117,20 @@ void demo_keyboard(int key, int pressed) } else if(key >= KEY_F1 && key <= KEY_F12) { int idx = key - KEY_F1; - if(idx < dsys_num_screens) { - dsys_run_screen(dsys_screens[idx]); + if(idx < dsys.num_screens) { + dsys_run_screen(dsys.screens[idx]); } } else { int i; - for(i=0; ikeyboard) { + dsys.scr_override->keyboard(key, pressed); + break; + } + + for(i=0; ikeyboard) scr->keyboard(key, pressed); } } @@ -107,8 +140,14 @@ void demo_keyboard(int key, int pressed) void demo_mouse(int bn, int pressed, int x, int y) { int i; - for(i=0; imouse) { + dsys.scr_override->mouse(bn, pressed, x, y); + return; + } + + for(i=0; imouse) scr->mouse(bn, pressed, x, y); } } @@ -116,8 +155,13 @@ void demo_mouse(int bn, int pressed, int x, int y) void demo_motion(int x, int y) { int i; - for(i=0; imotion) { + dsys.scr_override->motion(x, y); + } + + for(i=0; imotion) scr->motion(x, y); } }