00001 00014 #ifndef _GUI__RENDER_WINDOW_H_ 00015 #define _GUI__RENDER_WINDOW_H_ 00016 00017 #include <qwidget.h> 00018 #include <Inventor/nodes/SoSeparator.h> 00019 #include <Inventor/sensors/SoOneShotSensor.h> 00020 #include <Inventor/nodes/SoEventCallback.h> 00021 #include <Inventor/Qt/SoQtRenderArea.h> 00022 #include <Inventor/nodes/SoEventCallback.h> 00023 00024 #include "../game_configuration.h" 00025 #include "../camera.h" 00026 #include "../scene.h" 00027 00031 namespace GUI 00032 { 00033 class RenderWindow; 00034 class MainWindow; 00035 } 00036 00043 class GUI::RenderWindow: public QWidget 00044 { 00045 private: 00046 00048 SoSeparator *_sceneRoot; 00049 00051 SoOneShotSensor *_sceneSensor; 00052 00054 SoQtRenderArea *_renderArea; 00055 00057 static MainWindow *mainWindow; 00058 00060 static SoEventCallback *eventCallback; 00061 00063 static bool stopped; 00064 00066 static Camera *camera; 00067 00069 static Scene *scene; 00070 00072 static SbTime lastTime; 00073 00075 static short oldx; 00076 00078 static short oldy; 00079 00081 static bool failedGameEnd; 00082 00084 static bool successGameEnd; 00085 00087 static bool haveFocus; 00088 00089 public: 00090 00098 RenderWindow(GameConfiguration gameConfig, QWidget *parent = 0, 00099 const char *name = 0); 00100 00104 ~RenderWindow(); 00105 00109 static void successGameEndCallback(); 00110 00114 static void failedGameEndCallback(); 00115 00122 static void sceneSensorCallback(void *userdata, SoSensor *sensor); 00123 00130 static void mouseEventCallback(void *userdata, SoEventCallback *node); 00131 00138 static void mouseButtonEventCallback(void *userdata, SoEventCallback *node); 00139 00145 void keyPressEvent (QKeyEvent *e); 00146 00152 void mouseMoveEvent(QMouseEvent *e); 00153 00159 void mousePressEvent(QMouseEvent *e); 00160 00166 void focusInEvent(QFocusEvent *e); 00167 00173 void focusOutEvent(QFocusEvent *e); 00174 }; 00175 00176 #endif