fullscreen
[andemo] / src / demo.c
index 77c33d2..4acbb8c 100644 (file)
@@ -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; i<dsys_num_screens; i++) {
-               if(dsys_screens[i]->reshape) {
-                       dsys_screens[i]->reshape(x, y);
+       for(i=0; i<dsys.num_screens; i++) {
+               if(dsys.screens[i]->reshape) {
+                       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,14 @@ 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; i<dsys_num_act; i++) {
-                               struct demoscreen *scr = dsys_act[i];
+                       for(i=0; i<dsys.num_act; i++) {
+                               struct demoscreen *scr = dsys.act[i];
                                if(scr->keyboard) scr->keyboard(key, pressed);
                        }
                }
@@ -107,8 +134,8 @@ void demo_keyboard(int key, int pressed)
 void demo_mouse(int bn, int pressed, int x, int y)
 {
        int i;
-       for(i=0; i<dsys_num_act; i++) {
-               struct demoscreen *scr = dsys_act[i];
+       for(i=0; i<dsys.num_act; i++) {
+               struct demoscreen *scr = dsys.act[i];
                if(scr->mouse) scr->mouse(bn, pressed, x, y);
        }
 }
@@ -116,8 +143,8 @@ void demo_mouse(int bn, int pressed, int x, int y)
 void demo_motion(int x, int y)
 {
        int i;
-       for(i=0; i<dsys_num_act; i++) {
-               struct demoscreen *scr = dsys_act[i];
+       for(i=0; i<dsys.num_act; i++) {
+               struct demoscreen *scr = dsys.act[i];
                if(scr->motion) scr->motion(x, y);
        }
 }