mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-17 02:43:26 +00:00
Improve CVideo::get_available_resolutions.
If there is a main window use that else fall back to the original code. Based on a patch by AI0867.
This commit is contained in:
parent
572ac8ea66
commit
d8409507ae
@ -559,12 +559,22 @@ sdl::twindow *CVideo::get_window()
|
||||
|
||||
#endif
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
static int sdl_display_index()
|
||||
{
|
||||
if(window) {
|
||||
return SDL_GetWindowDisplayIndex(*window);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
std::vector<std::pair<int, int> > CVideo::get_available_resolutions()
|
||||
{
|
||||
std::vector<std::pair<int, int> > result;
|
||||
|
||||
const int modes = SDL_GetNumDisplayModes(0);
|
||||
const int modes = SDL_GetNumDisplayModes(sdl_display_index());
|
||||
if(modes <= 0) {
|
||||
std::cerr << "No modes supported\n";
|
||||
return result;
|
||||
|
Loading…
x
Reference in New Issue
Block a user