From e290b6db824f33a09f6761368ecf8f887215213d Mon Sep 17 00:00:00 2001 From: Titus Tscharntke Date: Wed, 7 Apr 2010 16:38:14 +0000 Subject: [PATCH] resolution switch for windows fixed ( hopefully ) --- .../sources/platform/sdl/platform_util.cpp | 4 +-- .../sources/platform/win32/platform_util.cpp | 35 +++++++++++-------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/source/shared_lib/sources/platform/sdl/platform_util.cpp b/source/shared_lib/sources/platform/sdl/platform_util.cpp index 55d11c3a3..179f8519c 100644 --- a/source/shared_lib/sources/platform/sdl/platform_util.cpp +++ b/source/shared_lib/sources/platform/sdl/platform_util.cpp @@ -643,8 +643,6 @@ void getFullscreenVideoModes(list *modeinfos) { /* Print valid modes */ SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] available Modes are:\n",__FILE__,__FUNCTION__,__LINE__); - int bestW = -1; - int bestH = -1; for(int i=0; modes[i]; ++i) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"%d x %d\n",modes[i]->w, modes[i]->h,bpp); string lookupKey = intToStr(modes[i]->w) + "_" + intToStr(modes[i]->h) + "_" + intToStr(bpp); @@ -653,7 +651,7 @@ void getFullscreenVideoModes(list *modeinfos) { modeinfos->push_back(ModeInfo(modes[i]->w,modes[i]->h,bpp)); SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] adding resolution: %d x %d - %d.\n",__FILE__,__FUNCTION__,__LINE__,modes[i]->w,modes[i]->h,bpp); } - // fake the missing 16 bit resolutions in linux + // fake the missing 16 bit resolutions string lookupKey16 = intToStr(modes[i]->w) + "_" + intToStr(modes[i]->h) + "_" + intToStr(16); if(uniqueResList.find(lookupKey16) == uniqueResList.end()) { uniqueResList[lookupKey16] = true; diff --git a/source/shared_lib/sources/platform/win32/platform_util.cpp b/source/shared_lib/sources/platform/win32/platform_util.cpp index 74bc5ab8a..c7ea84b6e 100644 --- a/source/shared_lib/sources/platform/win32/platform_util.cpp +++ b/source/shared_lib/sources/platform/win32/platform_util.cpp @@ -748,15 +748,20 @@ void getFullscreenVideoModes(list *modeinfos) { /* Print valid modes */ SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] available Modes are:\n",__FILE__,__FUNCTION__,__LINE__); - int bestW = -1; - int bestH = -1; for(int i=0; modes[i]; ++i) { - SystemFlags::OutputDebug(SystemFlags::debugSystem,"%d x %d\n",modes[i]->w, modes[i]->h,modes[i]->x); - string lookupKey = intToStr(modes[i]->w) + "_" + intToStr(modes[i]->h) + "_" + intToStr(modes[i]->x); + SystemFlags::OutputDebug(SystemFlags::debugSystem,"%d x %d\n",modes[i]->w, modes[i]->h,bpp); + string lookupKey = intToStr(modes[i]->w) + "_" + intToStr(modes[i]->h) + "_" + intToStr(bpp); if(uniqueResList.find(lookupKey) == uniqueResList.end()) { uniqueResList[lookupKey] = true; - modeinfos->push_back(ModeInfo(modes[i]->w,modes[i]->h,modes[i]->x)); - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] adding resolution: %d x %d.\n",__FILE__,__FUNCTION__,__LINE__,modes[i]->w,modes[i]->h); + modeinfos->push_back(ModeInfo(modes[i]->w,modes[i]->h,bpp)); + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] adding resolution: %d x %d - %d.\n",__FILE__,__FUNCTION__,__LINE__,modes[i]->w,modes[i]->h,bpp); + } + // fake the missing 16 bit resolutions + string lookupKey16 = intToStr(modes[i]->w) + "_" + intToStr(modes[i]->h) + "_" + intToStr(16); + if(uniqueResList.find(lookupKey16) == uniqueResList.end()) { + uniqueResList[lookupKey16] = true; + modeinfos->push_back(ModeInfo(modes[i]->w,modes[i]->h,16)); + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] adding resolution: %d x %d - %d.\n",__FILE__,__FUNCTION__,__LINE__,modes[i]->w,modes[i]->h,16); } } } @@ -865,14 +870,14 @@ bool isKeyDown(int virtualKey){ // ModeInfo // ===================================== -ModeInfo::ModeInfo(int w, int h, int d) { - width=w; - height=h; - depth=d; -} - -string ModeInfo::getString() const{ - return intToStr(width)+"x"+intToStr(height); -} +ModeInfo::ModeInfo(int w, int h, int d) { + width=w; + height=h; + depth=d; +} + +string ModeInfo::getString() const{ + return intToStr(width)+"x"+intToStr(height)+"-"+intToStr(depth); +} }}//end namespace