From 02af656d1cd87132182c197b1b2f2ae3c8ec8854 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 10 Apr 2016 00:54:45 -0400 Subject: [PATCH] Whoops, forgot to actually enumerate physical display resolutions. --- Sources/Engine/Graphics/Adapter.cpp | 62 ++++++++++++++--------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/Sources/Engine/Graphics/Adapter.cpp b/Sources/Engine/Graphics/Adapter.cpp index b41b6aa..09880ef 100644 --- a/Sources/Engine/Graphics/Adapter.cpp +++ b/Sources/Engine/Graphics/Adapter.cpp @@ -231,39 +231,6 @@ void CGfxLibrary::InitAPIs(void) #else -static void sdl_addmodes(CDisplayAdapter *pda, Uint32 flags) -{ - const int dpy = 0; // !!! FIXME: hook up a cvar? - - const int total = SDL_GetNumDisplayModes(dpy); - for (int i = 0; i < total; i++) - { - if (pda->da_ctDisplayModes >= ARRAYCOUNT(pda->da_admDisplayModes)) - break; - - SDL_DisplayMode mode; - if (SDL_GetDisplayMode(dpy, i, &mode) == 0) - { - const int bpp = (int) SDL_BITSPERPIXEL(mode.format); - if (bpp < 16) continue; - DisplayDepth bits = DD_DEFAULT; - switch (bpp) - { - case 16: bits = DD_16BIT; break; - case 32: bits = DD_32BIT; break; - case 24: bits = DD_24BIT; break; - default: break; - } - - CDisplayMode &dm = pda->da_admDisplayModes[pda->da_ctDisplayModes]; - dm.dm_pixSizeI = mode.w; - dm.dm_pixSizeJ = mode.h; - dm.dm_ddDepth = bits; - pda->da_ctDisplayModes++; - } - } -} - // initialize CDS support (enumerate modes at startup) void CGfxLibrary::InitAPIs(void) @@ -286,6 +253,35 @@ void CGfxLibrary::InitAPIs(void) // detect modes for OpenGL ICD pda->da_ctDisplayModes = 0; pda->da_iCurrentDisplayMode = -1; + + const int dpy = 0; // !!! FIXME: hook up a cvar? + const int total = SDL_GetNumDisplayModes(dpy); + for (int i = 0; i < total; i++) + { + if (pda->da_ctDisplayModes >= ARRAYCOUNT(pda->da_admDisplayModes)) + break; + + SDL_DisplayMode mode; + if (SDL_GetDisplayMode(dpy, i, &mode) == 0) + { + const int bpp = (int) SDL_BITSPERPIXEL(mode.format); + if (bpp < 16) continue; + DisplayDepth bits = DD_DEFAULT; + switch (bpp) + { + case 16: bits = DD_16BIT; break; + case 32: bits = DD_32BIT; break; + case 24: bits = DD_24BIT; break; + default: break; + } + + CDisplayMode &dm = pda->da_admDisplayModes[pda->da_ctDisplayModes]; + dm.dm_pixSizeI = mode.w; + dm.dm_pixSizeJ = mode.h; + dm.dm_ddDepth = bits; + pda->da_ctDisplayModes++; + } + } } #endif