00001 00007 #ifndef _APPLICATION_H_ 00008 #define _APPLICATION_H_ 00009 00010 #define _WINSOCKAPI_ 00011 #include <windows.h> 00012 #include "Globals.h" 00013 #include "../Util/Camera.h" 00014 #include "../Graphics/Renderer.h" 00015 #include "../Util/OpenGL/OpenGLFont.h" 00016 00017 struct Mouse { 00018 int x, y; 00019 int dx, dy; 00020 bool left; 00021 bool right; 00022 bool visible; 00023 bool capture; 00024 }; 00025 00026 class Application { 00027 public: 00028 Application(); 00029 virtual ~Application(); 00030 00031 void toggleFullscreen(); 00032 bool resetDisplayMode(); 00033 00034 virtual bool createWindow(HINSTANCE hInstance) { return false; }; 00035 virtual bool drawFrame() { return false; }; 00036 virtual void flush() = 0; 00037 virtual void destroyWindow() = 0; 00038 virtual void setViewport(unsigned int width, unsigned int height) = 0; 00039 00040 virtual bool update() { return true; }; 00041 virtual bool initialize() { return true; }; 00042 virtual bool deInitialize() { return true; }; 00043 virtual bool load() { return true; }; 00044 virtual bool unload() { return true; }; 00045 00046 // keys 00047 void setKey(unsigned int key, bool value); 00048 virtual void keyDown(unsigned int key); 00049 virtual void handleChar(char ch); 00050 00051 // mouse 00052 void setCursorPos(int x, int y); 00053 void setMouseButton(unsigned int button, bool value); 00054 void checkMouse(); 00055 void captureMouse(bool value); 00056 void showCursor(bool value); 00057 00058 public: 00059 HWND hWnd; 00060 00061 //protected: 00062 Renderer *renderer; 00063 bool keys[65536]; 00064 Mouse mouse; 00065 Camera camera; 00066 00067 OpenGLFont *defaultFont; 00068 }; 00069 00070 #endif