@@ -481,7 +481,7 @@ bool Game::InitGUI()
481
481
settings.Get (optionmap);
482
482
gui.SetOptions (optionmap);
483
483
484
- // Set driver/edit num to update gui explicitely
484
+ // Set driver/edit num to update gui explicitly
485
485
// as they are not stored in settings
486
486
gui.SetOptionValue (" game.car_edit" , " 0" );
487
487
gui.SetOptionValue (" game.driver" , " " );
@@ -2089,9 +2089,9 @@ static void PopulateTrackSet(
2089
2089
template <class T0 , class T1 >
2090
2090
struct SortPairBySecond
2091
2091
{
2092
- bool operator ()(const std::pair<T0, T1> & first , const std::pair<T0, T1> & second )
2092
+ bool operator ()(const std::pair<T0, T1> & a , const std::pair<T0, T1> & b )
2093
2093
{
2094
- return first .second < second .second ;
2094
+ return a .second < b .second ;
2095
2095
}
2096
2096
};
2097
2097
@@ -2306,6 +2306,36 @@ void Game::PopulateAntialiasList(GuiOption::List & antialiaslist)
2306
2306
}
2307
2307
}
2308
2308
2309
+ void Game::PopulateResolutionList (GuiOption::List & resolutionlist)
2310
+ {
2311
+ resolutionlist.clear ();
2312
+ int w = 0 , h = 0 ;
2313
+ int n = window.GetNumSupportedResolutions (error_output);
2314
+ std::vector<int > res (n);
2315
+ for (int i = 0 ; i < n; i++)
2316
+ {
2317
+ window.GetSupportedResolution (i, w, h, error_output);
2318
+ assert (w <= 0xFFFF && h <= 0xFFFF );
2319
+ res[i] = (w << 16 ) | h;
2320
+ }
2321
+ std::sort (res.begin (), res.end ());
2322
+ int wp = 0 , hp = 0 ;
2323
+ for (int i = 0 ; i < n; i++)
2324
+ {
2325
+ w = res[i] >> 16 ;
2326
+ h = res[i] & 0xFFFF ;
2327
+ if (w != wp || h != hp)
2328
+ {
2329
+ std::ostringstream ds, vs;
2330
+ ds << w << " X " << h;
2331
+ vs << w << ' ,' << h;
2332
+ resolutionlist.push_back (std::make_pair (vs.str (), ds.str ()));
2333
+ wp = w;
2334
+ hp = h;
2335
+ }
2336
+ }
2337
+ }
2338
+
2309
2339
void Game::PopulateValueLists (std::map<std::string, GuiOption::List> & valuelists)
2310
2340
{
2311
2341
PopulateTrackList (valuelists[" tracks" ]);
@@ -2334,6 +2364,8 @@ void Game::PopulateValueLists(std::map<std::string, GuiOption::List> & valuelist
2334
2364
2335
2365
PopulateAntialiasList (valuelists[" antialiasing" ]);
2336
2366
2367
+ PopulateResolutionList (valuelists[" resolution" ]);
2368
+
2337
2369
// PopulateJoystickList
2338
2370
valuelists[" joy_indices" ].push_back (std::make_pair (" 0" , " 0" ));
2339
2371
}
0 commit comments