32 SystemParametersInfoA( SPI_GETSTICKYKEYS,
sizeof( STICKYKEYS ), &
ms_StickyKeys, 0 );
34 STICKYKEYS newStickyKeys = {
sizeof( STICKYKEYS ) };
35 newStickyKeys.dwFlags = 0;
36 SystemParametersInfoA( SPI_SETSTICKYKEYS,
sizeof( STICKYKEYS ), &newStickyKeys, 0 );
43 if ( m_bDestroyed )
return;
49 if ( FALSE != PeekMessageA( &msg, NULL, 0, 0, 0 ) )
51 while ( FALSE != GetMessageA( &msg, NULL, 0, 0 ) )
53 TranslateMessage( &msg );
54 DispatchMessageA( &msg );
56 if ( FALSE == PeekMessageA( &msg, NULL, 0, 0, 0 ) )
70 LONG uStyle = GetWindowLongA( m_HWND, GWL_STYLE );
71 SetWindowLongA( m_HWND, GWL_STYLE, uStyle | WS_SYSMENU );
78 if ( FALSE == GetMessageA( &msg, NULL, 0, 0 ) )
85 TranslateMessage( &msg );
86 DispatchMessageA( &msg );
91 LONG uStyle = GetWindowLongA( m_HWND, GWL_STYLE );
92 SetWindowLongA( m_HWND, GWL_STYLE, uStyle & ( ~WS_SYSMENU ) );
94 if ( FALSE != PeekMessageA( &msg, NULL, 0, 0, 0 ) )
96 while ( FALSE != GetMessageA( &msg, NULL, 0, 0 ) )
98 TranslateMessage( &msg );
99 DispatchMessageA( &msg );
101 if ( FALSE == PeekMessageA( &msg, NULL, 0, 0, 0 ) )
111 if ( m_HWND != NULL )
116 SystemParametersInfoA( SPI_SETSTICKYKEYS,
sizeof( STICKYKEYS ), &
ms_StickyKeys, 0 );
119 DestroyWindow( m_HWND );
120 m_bDestroyed =
TTRUE;
124 if ( m_pRenderer !=
TNULL )
139 SystemParametersInfoA( SPI_GETSTICKYKEYS,
sizeof( STICKYKEYS ), &
ms_StickyKeys, 0 );
141 STICKYKEYS newStickyKeys = {
sizeof( STICKYKEYS ) };
142 newStickyKeys.dwFlags = 0;
143 SystemParametersInfoA( SPI_SETSTICKYKEYS,
sizeof( STICKYKEYS ), &newStickyKeys, 0 );
147 SystemParametersInfoA( SPI_SETSTICKYKEYS,
sizeof( STICKYKEYS ), &
ms_StickyKeys, 0 );
154 SetWindowPos( m_HWND, HWND_TOP, x, y, width, height, 0 );
159 m_ModuleHandle = GetModuleHandleA( NULL );
162 m_pRenderer = renderer;
164 WNDCLASSA wndClass = {
166 .lpfnWndProc = WndProc,
169 .hInstance = m_ModuleHandle,
171 .hCursor = LoadCursorA( NULL, IDC_ARROW ),
172 .hbrBackground = (HBRUSH)GetStockObject( 1 ),
173 .lpszMenuName = NULL,
177 RegisterClassA( &wndClass );
178 m_HWND = CreateWindowExA(
193 if ( !m_HWND )
return TFALSE;
195 EnableWindow( m_HWND, TRUE );
196 ShowWindow( m_HWND, SW_SHOW );
201LRESULT CALLBACK TMSWindow::WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
203 static TBOOL s_bIsPaused;
205 if ( uMsg <= WM_ACTIVATEAPP )
207 if ( uMsg == WM_ACTIVATEAPP )
212 if ( !pWindow->m_bDestroyed )
214 const TBOOL bPaused = !wParam;
217 s_bIsPaused = bPaused;
220 pRenderer->OnD3DDeviceFound();
222 pRenderer->OnD3DDeviceLost();
228 if ( uMsg == WM_CREATE )
230 SetWindowLongA( hWnd, GWL_USERDATA, *(LONG*)lParam );
234 if ( uMsg == WM_ACTIVATE )
236 SetFocused( ( wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE ) );
238 return DefWindowProcA( hWnd, WM_ACTIVATE, wParam, lParam );
241 if ( uMsg == WM_QUIT )
243 DestroyWindow( hWnd );
245 return DefWindowProcA( hWnd, WM_QUIT, wParam, lParam );
248 else if ( uMsg == WM_SETCURSOR )
253 TFIXME(
"Use data from TMouse_D3D8_Win to set cursor properties" );
255 else if ( uMsg == WM_SYSCOMMAND )
257 if ( wParam == SC_CLOSE )
261 TTODO(
"FUN_006bbb80" );
265 else if ( wParam == SC_SCREENSAVE )
269 else if ( wParam == SC_MONITORPOWER )
274 else if ( uMsg == WM_MOUSEFIRST )
277 pMouse->SetCurrentPosition( GET_X_LPARAM( lParam ), GET_Y_LPARAM( lParam ) );
282 return DefWindowProcA( hWnd, uMsg, wParam, lParam );
#define TREINTERPRETCAST(TYPE, VALUE)
#define TOSHI_NAMESPACE_START
#define TOSHI_NAMESPACE_END
#define TDEFINE_CLASS(...)
TSystemManager g_oSystemManager
TInputDevice * GetDeviceByIndex(TClass *a_pClass, TUINT a_uiIndex)
static void SetFocused(TBOOL a_bFocused)
TBOOL Create(TRenderInterface *renderer, LPCSTR title)
static TBOOL ms_bIsFocused
void UnregisterWindowClass()
void Update(TFLOAT a_fDeltaTime)
void SetPosition(UINT x, UINT y, UINT width, UINT height)
static STICKYKEYS ms_StickyKeys
DirectX 8 implementation of the render interface Handles DirectX 8 specific rendering functionality a...
TFORCEINLINE IDirect3DDevice8 * GetDirect3DDevice() const
Gets the Direct3D device.
void Exit()
Signals the render interface to exit.
static TFORCEINLINE TRenderInterface * GetSingleton()
static TFORCEINLINE TInputInterface * GetSingletonSafe()