MCPcopy Create free account
hub / github.com/ddnet/ddnet / SwitchWindowScreen

Method SwitchWindowScreen

src/engine/client/graphics_threaded.cpp:2554–2588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2552}
2553
2554bool CGraphics_Threaded::SwitchWindowScreen(int Index, bool MoveToCenter)
2555{
2556 const int IsFullscreen = g_Config.m_GfxFullscreen;
2557 const int IsBorderless = g_Config.m_GfxBorderless;
2558 const bool IsPurelyWindowed = IsFullscreen == 0 && !IsBorderless;
2559
2560 if(!SetWindowScreen(Index, !IsPurelyWindowed || MoveToCenter))
2561 {
2562 return false;
2563 }
2564
2565 if(IsFullscreen != 3 && !IsPurelyWindowed)
2566 {
2567 // Prevent window from being stretched over multiple monitors by temporarily switching to
2568 // windowed fullscreen mode on Windows, which is desktop fullscreen mode on other systems.
2569 SetWindowParams(3, false);
2570 }
2571
2572 // In purely windowed mode we preserve the window's size instead of resizing to the screen.
2573 if(!IsPurelyWindowed)
2574 {
2575 CVideoMode CurMode;
2576 GetCurrentVideoMode(CurMode, Index);
2577
2578 g_Config.m_GfxColorDepth = CurMode.m_Red + CurMode.m_Green + CurMode.m_Blue > 16 ? 24 : 16;
2579 g_Config.m_GfxScreenWidth = CurMode.m_WindowWidth;
2580 g_Config.m_GfxScreenHeight = CurMode.m_WindowHeight;
2581 g_Config.m_GfxScreenRefreshRate = CurMode.m_RefreshRate;
2582
2583 ResizeToScreen();
2584 }
2585
2586 SetWindowParams(IsFullscreen, IsBorderless);
2587 return true;
2588}
2589
2590void CGraphics_Threaded::Move(int x, int y)
2591{

Callers 3

ConchainWindowScreenMethod · 0.80
UpdateMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected