"L. Spiro Engine"
|
00001 00016 #ifndef __LSE_WINDOW_H__ 00017 #define __LSE_WINDOW_H__ 00018 00019 #include "../LSEEngine.h" 00020 00021 #if defined( LSE_WINDOWS ) 00022 00023 #include "../Input/LSEKeyboardBuffer.h" 00024 #include "../Game/LSEGame.h" 00025 #include "Windows/LSSTDWindows.h" 00026 00027 namespace lse { 00028 00034 class CWindow { 00035 public : 00036 // == Various constructors. 00037 LSE_INLINE LSE_CALL CWindow(); 00038 00039 00040 // == Functions. 00046 VOID LSE_CALL SetGamePointer( CGame * _pgGame ); 00047 00057 VOID LSE_CALL SetDefaultWindowDimensions( INT _iWinWidth, INT _iWinHeight, INT _iFullWidth, INT _iFullHeight ); 00058 00069 BOOL LSE_CALL CreateRenderWindow( INT _iWidth, INT _iHeight, BOOL _bFullScreen, DWORD _dwBits, const LSCHAR * _pcTitle ); 00070 00076 VOID LSE_CALL SetHdc( HDC _hDc ); 00077 00083 HDC LSE_CALL GetHdc(); 00084 00090 INT LSE_CALL Run(); 00091 00097 POINT LSE_CALL GetInitialMousePos() const; 00098 00104 HWND LSE_CALL GetWindow(); 00105 00109 BOOL LSE_CALL ToggleFullScreen(); 00110 00111 00112 // == Members. 00113 // Rendering context for OpenGL. 00114 HGLRC m_hGrlc; 00115 00116 00117 protected : 00118 // == Members. 00122 CGame * m_pgGame; 00123 00127 HWND m_hWnd; 00128 00132 HDC m_hDc; 00133 00137 wchar_t m_szPath[MAX_PATH]; 00138 00142 INT m_iWidth, m_iHeight; 00143 00147 INT m_iWindowedWidth, m_iWindowedHeight; 00148 00152 INT m_iFullWidth, m_iFullHeight; 00153 00157 DWORD m_dwDepth; 00158 00162 POINT m_pInitialMousePos; 00163 00167 BOOL m_bTracking; 00168 00172 BOOL m_bTogglingFullScreen; 00173 00177 static CKeyboardBuffer * m_pkbKeyboardBuffer; 00178 00179 00180 // == Functions. 00190 static LRESULT CALLBACK WndProc( HWND _hWnd, UINT _uiMsg, WPARAM _wParam, LPARAM _lParam ); 00191 00197 static LSVOID LSE_CALL Present( LSVOID * _pvParm ); 00198 00202 VOID LSE_CALL CreatePixelFormat(); 00203 }; 00204 00205 00206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00207 // DEFINITIONS 00208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00209 // == Various constructors. 00210 LSE_INLINE LSE_CALL CWindow::CWindow() : 00211 m_pgGame( NULL ), 00212 m_hWnd( NULL ), 00213 m_hDc( NULL ), 00214 m_hGrlc( NULL ), 00215 m_iWidth( 0 ), m_iHeight( 0 ), 00216 m_iWindowedWidth( 0 ), m_iWindowedHeight( 0 ), 00217 m_iFullWidth( 0 ), m_iFullHeight( 0 ), 00218 m_dwDepth( 0 ), 00219 m_bTogglingFullScreen( FALSE ) { 00220 // Get our path. 00221 ::GetModuleFileNameW( NULL, m_szPath, MAX_PATH ); 00222 } 00223 00229 LSE_INLINE VOID LSE_CALL CWindow::SetGamePointer( CGame * _pgGame ) { 00230 m_pgGame = _pgGame; 00231 } 00232 00242 LSE_INLINE VOID LSE_CALL CWindow::SetDefaultWindowDimensions( INT _iWinWidth, INT _iWinHeight, INT _iFullWidth, INT _iFullHeight ) { 00243 m_iWindowedWidth = _iWinWidth; 00244 m_iWindowedHeight = _iWinHeight; 00245 m_iFullWidth = _iFullWidth; 00246 m_iFullHeight = _iFullHeight; 00247 } 00248 00254 LSE_INLINE VOID LSE_CALL CWindow::SetHdc( HDC _hDc ) { 00255 m_hDc = _hDc; 00256 } 00257 00263 LSE_INLINE HDC LSE_CALL CWindow::GetHdc() { 00264 return m_hDc; 00265 } 00266 00272 LSE_INLINE POINT LSE_CALL CWindow::GetInitialMousePos() const { 00273 return m_pInitialMousePos; 00274 } 00275 00281 LSE_INLINE HWND LSE_CALL CWindow::GetWindow() { 00282 return m_hWnd; 00283 } 00284 00285 } // namespace lse 00286 00287 #endif // #if defined( LSE_WINDOWS ) 00288 00289 #endif // __LSE_WINDOW_H__