Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members

common_gui_funcs.cpp

Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <string.h>
00004 #ifdef WIN32
00005 #include <windows.h>
00006 #else
00007 #include <unistd.h>
00008 #endif
00009 #include <math.h>
00010 #include <GL/glut.h>
00011 #include <plib/pu.h>
00012 
00013 #include "common_gui_funcs.h"
00014 #include "common_vars_gui.h"
00015 
00016 void mouse_motionfn(int x, int y);
00017 void mmotionfn ( int x, int y )
00018 {
00019   puMouse ( x, y ) ;
00020   glutPostRedisplay () ;
00021 }
00022  
00023 
00024 void reshape ( int w, int h )
00025 {
00026   glViewport ( 0, 0, w, h ) ;
00027   display_height = h;
00028   display_width = w;
00029 }
00030 
00031 void mousefn (int button, int updown, int x, int y);
00032 void mmousefn ( int button, int updown, int x, int y )
00033 {
00034   puMouse ( button, updown, x, y ) ;
00035   glutPostRedisplay () ;
00036 }
00037 
00038 void displayfn();
00039 void mdisplayfn ()
00040 {
00041   glClearColor ( 0.1, 0.4, 0.7, 1.0 ) ;
00042   glClear      ( GL_COLOR_BUFFER_BIT ) ;
00043  
00044   puDisplay () ;
00045                                                                                 
00046   glutSwapBuffers   () ;
00047   glutPostRedisplay () ;
00048 }
00049 
00050 void keyfn(unsigned char, int, int);
00051                                                                                 
00052 void _register_glutfuncs_menuonly() {
00053   glutDisplayFunc     ( mdisplayfn ) ;
00054   glutMouseFunc       ( mmousefn   ) ;
00055   glutMotionFunc      ( mmotionfn  ) ;
00056   glutKeyboardFunc      ( mkeyfn     ) ;
00057   glutReshapeFunc        ( reshape  ) ;
00058 }
00059 
00060 void _register_glutfuncs_game() {
00061   glutDisplayFunc     ( displayfn ) ;
00062   glutMouseFunc       ( mousefn   ) ;
00063   glutMotionFunc      ( mouse_motionfn  ) ;
00064   glutPassiveMotionFunc(mouse_motionfn);
00065   glutKeyboardFunc      ( keyfn     ) ;
00066 }
00067 
00068                                                                                 
00069  void mkeyfn ( unsigned char key, int, int )
00070 {
00071   puKeyboard ( key, PU_DOWN ) ;
00072   glutPostRedisplay () ;
00073 }
00074 
00075 void _clear_total_menu (){
00076   if (total_menu != NULL) {
00077     total_menu->hide();
00078     delete total_menu;
00079   }
00080   total_menu = NULL;
00081 }
00082 
00083 

Generated on Sat Jul 12 04:29:20 2003 for glPirates by doxygen 1.3.2