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

Method ListMonitors

engine/PoseidonGL33/EngineGL33_Lifecycle.cpp:784–804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

782}
783
784void EngineGL33::ListMonitors(FindArray<MonitorInfo>& ret)
785{
786 ret.Clear();
787 int count = 0;
788 SDL_DisplayID* displays = SDL_GetDisplays(&count);
789 if (!displays)
790 return;
791 for (int i = 0; i < count; ++i)
792 {
793 const SDL_DisplayMode* mode = SDL_GetDesktopDisplayMode(displays[i]);
794 const char* name = SDL_GetDisplayName(displays[i]);
795 MonitorInfo info;
796 info.index = i;
797 info.name = name ? name : "Unknown";
798 info.w = mode ? mode->w : 0;
799 info.h = mode ? mode->h : 0;
800 info.refresh = mode ? (int)(mode->refresh_rate + 0.5f) : 0;
801 ret.Add(info);
802 }
803 SDL_free(displays);
804}
805
806int EngineGL33::GetCurrentMonitor() const
807{

Callers

nothing calls this directly

Calls 2

ClearMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected