@@ -64,12 +64,11 @@ void CHW::DestroyD3D()
6464 _RELEASE (m_pFactory);
6565}
6666
67- void CHW::CreateDevice (SDL_Window* m_sdlWnd, bool move_window )
67+ void CHW::CreateDevice (SDL_Window* m_sdlWnd)
6868{
69- m_move_window = move_window;
7069 CreateD3D ();
7170
72- bool bWindowed = !psDeviceFlags.is (rsFullscreen);
71+ bool bWindowed = !psDeviceFlags.is (rsFullscreen) || Device. editor () ;
7372
7473 m_DriverType = Caps.bForceGPU_REF ? D3D_DRIVER_TYPE_REFERENCE : D3D_DRIVER_TYPE_HARDWARE;
7574
@@ -196,10 +195,7 @@ void CHW::CreateDevice(SDL_Window* m_sdlWnd, bool move_window)
196195 const auto memory = Desc.DedicatedVideoMemory ;
197196 Msg (" * Texture memory: %d M" , memory / (1024 * 1024 ));
198197 // Msg("* DDI-level: %2.1f", float(D3DXGetDriverLevel(pDevice)) / 100.f);
199- #ifndef _EDITOR
200- updateWindowProps (m_sdlWnd);
201198 fill_vid_mode_list (this );
202- #endif
203199}
204200
205201void CHW::DestroyDevice ()
@@ -241,7 +237,7 @@ void CHW::DestroyDevice()
241237// ////////////////////////////////////////////////////////////////////
242238// Resetting device
243239// ////////////////////////////////////////////////////////////////////
244- void CHW::Reset (SDL_Window* m_sdlWnd )
240+ void CHW::Reset ()
245241{
246242 DXGI_SWAP_CHAIN_DESC& cd = m_ChainDesc;
247243 BOOL bWindowed = !psDeviceFlags.is (rsFullscreen);
@@ -265,9 +261,6 @@ void CHW::Reset(SDL_Window* m_sdlWnd)
265261 CHK_DX (m_pSwapChain->ResizeBuffers (
266262 cd.BufferCount , desc.Width , desc.Height , desc.Format , DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH));
267263 UpdateViews ();
268-
269- updateWindowProps (m_sdlWnd);
270- SDL_ShowWindow (m_sdlWnd);
271264}
272265
273266D3DFORMAT CHW::selectDepthStencil (D3DFORMAT /* fTarget*/ )
@@ -353,52 +346,6 @@ BOOL CHW::support(D3DFORMAT fmt, DWORD type, DWORD usage)
353346 return TRUE ;
354347}
355348
356- void CHW::updateWindowProps (SDL_Window* m_sdlWnd)
357- {
358- bool bWindowed = !psDeviceFlags.is (rsFullscreen);
359-
360- u32 dwWindowStyle = 0 ;
361- // Set window properties depending on what mode were in.
362- if (bWindowed)
363- {
364- if (m_move_window)
365- {
366- if (NULL != strstr (Core.Params , " -draw_borders" ))
367- SDL_SetWindowBordered (m_sdlWnd, SDL_TRUE);
368- // When moving from fullscreen to windowed mode, it is important to
369- // adjust the window size after recreating the device rather than
370- // beforehand to ensure that you get the window size you want. For
371- // example, when switching from 640x480 fullscreen to windowed with
372- // a 1000x600 window on a 1024x768 desktop, it is impossible to set
373- // the window size to 1000x600 until after the display mode has
374- // changed to 1024x768, because windows cannot be larger than the
375- // desktop.
376-
377- bool centerScreen = false ;
378- if (GEnv.isDedicatedServer || strstr (Core.Params , " -center_screen" ))
379- centerScreen = true ;
380-
381- SDL_SetWindowSize (m_sdlWnd, m_ChainDesc.BufferDesc .Width , m_ChainDesc.BufferDesc .Height );
382-
383- if (centerScreen)
384- {
385- SDL_SetWindowPosition (m_sdlWnd, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
386- }
387- else
388- {
389- SDL_SetWindowPosition (m_sdlWnd, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED);
390- }
391- }
392- }
393- else
394- {
395- SDL_ShowWindow (m_sdlWnd);
396- }
397-
398- if (!GEnv.isDedicatedServer )
399- SDL_SetWindowGrab (m_sdlWnd, SDL_TRUE);
400- }
401-
402349struct uniqueRenderingMode
403350{
404351 uniqueRenderingMode (pcstr v) : value(v) {}
0 commit comments