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

Method GetCurrentMonitor

engine/PoseidonGL33/EngineGL33_Lifecycle.cpp:806–825  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

804 SDL_DisplayID* displays = SDL_GetDisplays(&count);
805 if (!displays)
806 return;
807 for (int i = 0; i < count; ++i)
808 {
809 const SDL_DisplayMode* mode = SDL_GetDesktopDisplayMode(displays[i]);
810 const char* name = SDL_GetDisplayName(displays[i]);
811 MonitorInfo info;
812 info.index = i;
813 info.name = name ? name : "Unknown";
814 info.w = mode ? mode->w : 0;
815 info.h = mode ? mode->h : 0;
816 info.refresh = mode ? (int)(mode->refresh_rate + 0.5f) : 0;
817 ret.Add(info);
818 }
819 SDL_free(displays);
820}
821
822int EngineGL33::GetCurrentMonitor() const
823{
824 if (!_sdlWindow)
825 return 0;
826 SDL_DisplayID id = SDL_GetDisplayForWindow(_sdlWindow);
827 int count = 0;
828 SDL_DisplayID* displays = SDL_GetDisplays(&count);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected