fixed loading screen. regression in blitfb
[dosdemo] / src / glut / main.c
index 0e766bd..abe25cc 100644 (file)
@@ -73,7 +73,12 @@ static cgm_quat rot = {0, 0, 0, 1};
 int main(int argc, char **argv)
 {
        glutInit(&argc, argv);
-       glutInitWindowSize(800, 600);
+
+       if(glutGet(GLUT_SCREEN_HEIGHT) <= 1024) {
+               glutInitWindowSize(640, 480);
+       } else {
+               glutInitWindowSize(1280, 960);
+       }
        glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
        glutCreateWindow("Mindlapse");
 
@@ -113,6 +118,8 @@ int main(int argc, char **argv)
        wgl_swap_interval_ext = wglGetProcAddress("wglSwapIntervalEXT");
 #endif
 
+       reshape(glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT));
+
        if(au_init() == -1) {
                return 1;
        }
@@ -232,6 +239,8 @@ void blit_frame(void *pixels, int vsync)
                prev_vsync = vsync;
        }
 
+       demo_post_draw(pixels);
+
        for(i=0; i<FB_WIDTH * FB_HEIGHT; i++) {
                int r = UNPACK_R16(*sptr);
                int g = UNPACK_G16(*sptr);
@@ -426,14 +435,28 @@ static void map_mouse_pos(int *xp, int *yp)
 
 static void mouse_button(int bn, int st, int x, int y)
 {
+       int bit;
+
        map_mouse_pos(&x, &y);
        mouse_x = x;
        mouse_y = y;
 
+       switch(bn) {
+       case GLUT_LEFT_BUTTON:
+               bit = 0;
+               break;
+       case GLUT_RIGHT_BUTTON:
+               bit = 1;
+               break;
+       case GLUT_MIDDLE_BUTTON:
+               bit = 2;
+               break;
+       }
+
        if(st == GLUT_DOWN) {
-               mouse_bmask |= 1 << bn;
+               mouse_bmask |= 1 << bit;
        } else {
-               mouse_bmask &= ~(1 << bn);
+               mouse_bmask &= ~(1 << bit);
        }
 }