summaryrefslogtreecommitdiffstats
path: root/menu_demo/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'menu_demo/main.c')
-rw-r--r--menu_demo/main.c54
1 files changed, 38 insertions, 16 deletions
diff --git a/menu_demo/main.c b/menu_demo/main.c
index 89e0b31..3903002 100644
--- a/menu_demo/main.c
+++ b/menu_demo/main.c
@@ -12,23 +12,15 @@
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
+
+
void init_gl(void)
{
- double l_dHalfWidth = SCREEN_WIDTH / 2;
- double l_dHalfHeight = SCREEN_HEIGHT / 2;
+ // do sumting
- glMatrixMode(GL_PROJECTION);
+} // init_gl
- glOrtho(-l_dHalfWidth,
- l_dHalfWidth,
- -l_dHalfHeight,
- l_dHalfHeight,
- -1,
- 1
- );
- glMatrixMode(GL_MODELVIEW);
-}
void render_scene(void)
{
@@ -38,13 +30,19 @@ void render_scene(void)
MenuRender();
glutSwapBuffers();
-}
+
+} // render_scene
+
+
void process_normal_keys(unsigned char key, int x, int y)
{
// escape
if (key == 27) exit(0);
-}
+
+} // process_normal_keys
+
+
void process_special_keys(int key, int x, int y)
{
@@ -52,7 +50,26 @@ void process_special_keys(int key, int x, int y)
{
// do sumting
}
-}
+
+} // process_special_keys
+
+
+
+void process_mouse(int button, int state, int x, int y)
+{
+ MenuMouseHandle(button, state, x, y);
+
+} // process_mouse
+
+
+
+void process_passive_mouse(int x, int y)
+{
+ process_mouse(0, 0, x, y);
+
+} // process_passive_mouse
+
+
int main(int argc, char **argv)
{
@@ -64,6 +81,8 @@ int main(int argc, char **argv)
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);
@@ -71,4 +90,7 @@ int main(int argc, char **argv)
glutMainLoop();
return 0;
-}
+
+} // main
+
+