MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / GetAllSupportedScreenResolutions

Function GetAllSupportedScreenResolutions

TombEngine/Specific/winmain.cpp:140–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140std::vector<Vector2i> GetAllSupportedScreenResolutions()
141{
142 auto resList = std::vector<Vector2i>{};
143
144 DEVMODE dm = { 0 };
145 dm.dmSize = sizeof(dm);
146 for (int iModeNum = 0; EnumDisplaySettings(NULL, iModeNum, &dm) != 0; iModeNum++)
147 {
148 bool add = true;
149 for (auto m : resList)
150 {
151 if (m.x == dm.dmPelsWidth && m.y == dm.dmPelsHeight)
152 {
153 add = false;
154 break;
155 }
156 }
157 if (add)
158 {
159 auto res = Vector2i(dm.dmPelsWidth, dm.dmPelsHeight);
160 resList.push_back(res);
161 }
162 }
163
164 std::sort(
165 resList.begin(), resList.end(),
166 [](Vector2i& a, Vector2i& b)
167 {
168 return ((a.x == b.x) ? (a.y < b.y) : (a.x < b.x));
169 });
170
171 return resList;
172}
173
174void DisableDpiAwareness()
175{

Callers 1

InitDefaultConfigurationFunction · 0.85

Calls 4

Vector2iClass · 0.50
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected