From 1f2c805fe8dc0aa8254aa65716371e5ece4ad3a3 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 20 Mar 2010 07:19:45 +0000 Subject: [PATCH] Added new setting to allow playing glest using multiple monitors --- mk/linux/configuration.xml | 10 ++++++++++ source/glest_game/main/program.cpp | 7 +++++++ source/shared_lib/include/platform/sdl/platform_util.h | 1 + .../shared_lib/sources/platform/sdl/platform_util.cpp | 8 ++++++++ .../sources/platform/win32/platform_util.cpp | 9 +++++++++ 5 files changed, 35 insertions(+) diff --git a/mk/linux/configuration.xml b/mk/linux/configuration.xml index 160e5e7d..780f8b63 100644 --- a/mk/linux/configuration.xml +++ b/mk/linux/configuration.xml @@ -215,6 +215,16 @@ shadows and shadow mapping, bigger sizes result in less pixelized shadows but ar + + + + + + + + + + diff --git a/source/glest_game/main/program.cpp b/source/glest_game/main/program.cpp index 46f74926..21d53488 100644 --- a/source/glest_game/main/program.cpp +++ b/source/glest_game/main/program.cpp @@ -319,6 +319,13 @@ void Program::setDisplaySettings(){ int screenWidth= config.getInt("ScreenWidth"); int screenHeight= config.getInt("ScreenHeight"); + if(config.getBool("AutoMaxFullScreen","false") == true) { + getFullscreenVideoInfo(colorBits,screenWidth,screenHeight); + config.setInt("ColorBits",colorBits); + config.setInt("ScreenWidth",screenWidth); + config.setInt("ScreenHeight",screenHeight); + } + if(!(changeVideoMode(screenWidth, screenHeight, colorBits, freq) || changeVideoMode(screenWidth, screenHeight, colorBits, 0))) { diff --git a/source/shared_lib/include/platform/sdl/platform_util.h b/source/shared_lib/include/platform/sdl/platform_util.h index 5dd43ce1..9813dc0e 100644 --- a/source/shared_lib/include/platform/sdl/platform_util.h +++ b/source/shared_lib/include/platform/sdl/platform_util.h @@ -97,6 +97,7 @@ vector > getFolderTreeContentsCheckSumListRecursively(co void createDirectoryPaths(string Path); string extractDirectoryPathFromFile(string filename); +void getFullscreenVideoInfo(int &colorBits,int &screenWidth,int &screenHeight); bool changeVideoMode(int resH, int resW, int colorBits, int refreshFrequency); void restoreVideoMode(); diff --git a/source/shared_lib/sources/platform/sdl/platform_util.cpp b/source/shared_lib/sources/platform/sdl/platform_util.cpp index c540edc1..1fb1241e 100644 --- a/source/shared_lib/sources/platform/sdl/platform_util.cpp +++ b/source/shared_lib/sources/platform/sdl/platform_util.cpp @@ -435,6 +435,14 @@ void createDirectoryPaths(string Path) mkdir(DirName, S_IRWXO); } +void getFullscreenVideoInfo(int &colorBits,int &screenWidth,int &screenHeight) { + // Get the current video hardware information + const SDL_VideoInfo* vidInfo = SDL_GetVideoInfo(); + colorBits = vidInfo->vfmt->BitsPerPixel; + screenWidth = vidInfo->current_w; + screenHeight = vidInfo->current_h; +} + bool changeVideoMode(int resW, int resH, int colorBits, int ) { Private::shouldBeFullscreen = true; return true; diff --git a/source/shared_lib/sources/platform/win32/platform_util.cpp b/source/shared_lib/sources/platform/win32/platform_util.cpp index cb68b8f6..8738ce22 100644 --- a/source/shared_lib/sources/platform/win32/platform_util.cpp +++ b/source/shared_lib/sources/platform/win32/platform_util.cpp @@ -23,6 +23,7 @@ #include #include #include +#include "opengl.h" #include "leak_dumper.h" @@ -452,6 +453,14 @@ void createDirectoryPaths(string Path) } _mkdir(DirName); } + +void getFullscreenVideoInfo(int &colorBits,int &screenWidth,int &screenHeight) { + // Get the current video hardware information + const SDL_VideoInfo* vidInfo = SDL_GetVideoInfo(); + colorBits = vidInfo->vfmt->BitsPerPixel; + screenWidth = vidInfo->current_w; + screenHeight = vidInfo->current_h; +} bool changeVideoMode(int resW, int resH, int colorBits, int refreshFrequency){ DEVMODE devMode;