![]() |
Unuk 1.0
|
00001 #ifndef _WIN32WINDOW_H_ 00002 #define _WIN32WINDOW_H_ 00003 #include <windows.h> 00004 #include <ctime> 00005 00006 class Game; // Declaration of our Game class. 00007 00008 class Win32Window { 00009 public: 00010 // Default constructor/deconstructor. 00011 Win32Window(HINSTANCE hInstance); 00012 ~Win32Window(void); 00013 00014 bool Create(int width, int height, int bpp, bool fullscreen); 00015 void Destroy(); 00016 void ProcessEvents(); 00017 void AttachGame(Game* game); 00018 00019 // Is the window running? 00020 bool IsRunning(); 00021 00022 void SwapBuffers() { SwapBuffers(m_hdc); } 00023 00024 static LRESULT CALLBACK StaticWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 00025 LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 00026 00027 float GetElapsedSeconds(); 00028 00029 private: 00030 // Pointer to the game class. 00031 Game* m_game; 00032 // Is the window still running? 00033 bool m_isRunning; 00034 bool m_fullscreen; 00035 00036 // Window handle. 00037 HWND m_hWnd; 00038 // This is our rendering context. 00039 HGLRC m_hglrc; 00040 // The device context. 00041 HDC m_hdc; 00042 // Window bounds. 00043 RECT m_windowRect; 00044 // Application instance. 00045 HINSTANCE m_hinstance; 00046 WNDCLASSEX m_windowClass; 00047 00048 void SetupPixelFormat(void); 00049 Game* GetAttachedGame() { return m_game; } 00050 00051 float m_lastTime; 00052 }; 00053 00054 #endif // _WIN32WINDOW_H_