MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / SwitchMonitor

Method SwitchMonitor

engine/PoseidonGL33/EngineGL33_Lifecycle.cpp:827–848  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

825}
826
827bool EngineGL33::SwitchMonitor(int idx)
828{
829 if (!_sdlWindow)
830 return false;
831 int count = 0;
832 SDL_DisplayID* displays = SDL_GetDisplays(&count);
833 if (!displays || idx < 0 || idx >= count)
834 {
835 SDL_free(displays);
836 return false;
837 }
838 SDL_DisplayID target = displays[idx];
839 SDL_free(displays);
840 SDL_Rect bounds;
841 if (!SDL_GetDisplayBounds(target, &bounds))
842 return false;
843 int windowW = _w;
844 int windowH = _h;
845 SDL_GetWindowSize(_sdlWindow, &windowW, &windowH);
846 SDL_SetWindowPosition(_sdlWindow, bounds.x + (bounds.w - windowW) / 2, bounds.y + (bounds.h - windowH) / 2);
847 return true;
848}
849
850bool EngineGL33::GetDesktopDisplayMode(int& w, int& h, int& refresh) const
851{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected