#ifdef G_OS_WIN32 #define WIN32_LEAN_AND_MEAN 1 #include #endif #include #include #include #include #include "menu.h" #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 void init_gl(void) { } // init_gl void render_scene(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(1, 1, 1, 1); //// render teapot //glMatrixMode(GL_PROJECTION); //glPushMatrix(); // glLoadIdentity(); // gluPerspective(45, 1.0, 1.0, 200.0); // glMatrixMode(GL_MODELVIEW); // glTranslated(0, 0, -5); // glColor3d(1, 0, 0); // glutSolidTeapot(1); // glTranslated(0, 0, 5); // glMatrixMode(GL_PROJECTION); //glPopMatrix(); MenuRender(); glutSwapBuffers(); } // render_scene void process_normal_keys(unsigned char key, int x, int y) { // escape if (key == 27) exit(0); if (key == ' ') MenuNext(); } // process_normal_keys void process_special_keys(int key, int x, int y) { switch (key) { // do sumting } } // process_special_keys void process_mouse(int button, int state, int x, int y) { MenuMouseClick(button, state, x, y); } // process_mouse void process_passive_mouse(int x, int y) { MenuMouseMove(x, y); } // process_passive_mouse int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(SCREEN_WIDTH, SCREEN_HEIGHT); glutCreateWindow("Menu demo"); glutDisplayFunc(render_scene); glutIdleFunc(render_scene); glutKeyboardFunc(process_normal_keys); glutSpecialFunc(process_special_keys); glutMouseFunc(process_mouse); glutPassiveMotionFunc(process_passive_mouse); init_gl(); MenuInit(SCREEN_WIDTH, SCREEN_HEIGHT); glutEstablishOverlay(); printf("Overlay %d\n", glutLayerGet(GLUT_OVERLAY_POSSIBLE)); glutMainLoop(); return 0; } // main