[2931] | 1 | #ifndef _FRAMEWORK_H |
---|
| 2 | #define _FRAMEWORK_H |
---|
[4554] | 3 | |
---|
[3656] | 4 | #include "vector.h" |
---|
[4293] | 5 | #include "glincl.h" |
---|
[4343] | 6 | #include "debug.h" |
---|
[4651] | 7 | #include "graphics_engine.h" |
---|
[2931] | 8 | |
---|
[4343] | 9 | #ifdef GUI_MODULE |
---|
[4333] | 10 | #include "gui_gtk.h" |
---|
[4554] | 11 | #endif |
---|
[4297] | 12 | |
---|
[4650] | 13 | #define MOUSE_BUTTON_COUNT 3 |
---|
[4295] | 14 | |
---|
[7159] | 15 | #define TICK_SMOOTH_VALUE 10 |
---|
| 16 | |
---|
[4297] | 17 | class Camera; |
---|
[2952] | 18 | |
---|
[4297] | 19 | class Framework { |
---|
[4651] | 20 | public: |
---|
[6981] | 21 | virtual ~Framework(); |
---|
[4554] | 22 | |
---|
[4651] | 23 | /** \returns a Pointer to the only object of this Class */ |
---|
| 24 | inline static Framework* getInstance(void) { if (!singletonRef) singletonRef = new Framework(); return singletonRef; }; |
---|
[4554] | 25 | |
---|
[4651] | 26 | public: |
---|
| 27 | void moduleInit(int argc, char** argv); |
---|
| 28 | #ifdef GUI_MODULE |
---|
| 29 | void moduleInitGui(int argc, char** argv); |
---|
| 30 | #endif |
---|
| 31 | void moduleEventHandler(SDL_Event* event); |
---|
| 32 | void moduleTick(float dt); |
---|
| 33 | void moduleDraw(void) const; |
---|
[4317] | 34 | |
---|
[4651] | 35 | void moduleHelp(void) const; |
---|
[4374] | 36 | |
---|
[4554] | 37 | |
---|
[4651] | 38 | void init(void); |
---|
| 39 | static void* mainLoop(void* tmp); |
---|
| 40 | bool draw(float dt); |
---|
| 41 | float tick(); |
---|
| 42 | bool eventHandler(); |
---|
| 43 | void quit(); |
---|
[2931] | 44 | |
---|
[4651] | 45 | static void* mainloopGui(void* tmp); |
---|
[4554] | 46 | |
---|
[4651] | 47 | void printHelp(void) const; |
---|
[4317] | 48 | |
---|
[4331] | 49 | |
---|
[4651] | 50 | private: |
---|
| 51 | Framework(); |
---|
[4554] | 52 | |
---|
[4651] | 53 | private: |
---|
| 54 | static Framework* singletonRef; |
---|
[4333] | 55 | |
---|
[4651] | 56 | Camera* camera; |
---|
[4333] | 57 | |
---|
[4651] | 58 | bool isFinished; |
---|
[4307] | 59 | |
---|
[4651] | 60 | int movement [4]; |
---|
| 61 | float backgroundColor[4]; |
---|
[4316] | 62 | |
---|
[7159] | 63 | /* world timing */ |
---|
| 64 | Uint32 lastFrame; //!< last time of frame (in MiliSeconds) |
---|
| 65 | Uint32 cycle; //!< The cycle we are in (starts with 0 and rises with every frame) |
---|
| 66 | float dtS; //!< The time needed for caluculations in seconds |
---|
| 67 | float speed; //!< how fast the game flows |
---|
| 68 | double gameTime; //!< this is where the game time is saved |
---|
| 69 | Uint32 frameTimes[TICK_SMOOTH_VALUE];//!< The time used for the last TICK_SMOOTH_VALUE's frames. |
---|
[4651] | 70 | |
---|
| 71 | Uint8* keys; // This variable will be used in the keyboard routine |
---|
| 72 | bool mouseDown[MOUSE_BUTTON_COUNT]; |
---|
| 73 | |
---|
[4297] | 74 | }; |
---|
[4330] | 75 | |
---|
[4343] | 76 | #ifdef GUI_MODULE |
---|
[4333] | 77 | int quitGui(GtkWidget* widget, void* data); |
---|
[4343] | 78 | #endif |
---|
[4333] | 79 | |
---|
[2931] | 80 | #endif /* _FRAMEWORK_H */ |
---|