OPENGL: Save last fullscreen mode size to config file.

svn-id: r51604
This commit is contained in:
Alejandro Marzini 2010-08-02 03:17:12 +00:00
parent 4d8f8195b8
commit 905ec1104e
2 changed files with 10 additions and 2 deletions

View File

@ -27,6 +27,7 @@
#include "backends/graphics/opengl/opengl-graphics.h"
#include "backends/graphics/opengl/glerrorcheck.h"
#include "common/config-manager.h"
#include "common/file.h"
#include "common/mutex.h"
#include "common/translation.h"
@ -55,7 +56,7 @@ OpenGLGraphicsManager::OpenGLGraphicsManager()
_videoMode.mode = OpenGL::GFX_DOUBLESIZE;
_videoMode.scaleFactor = 2;
_videoMode.fullscreen = false;
_videoMode.fullscreen = ConfMan.getBool("fullscreen");
_videoMode.antialiasing = false;
_videoMode.aspectRatioCorrection = 0;

View File

@ -47,7 +47,12 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager()
// Get desktop resolution
const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo();
if (videoInfo->current_w > 0 && videoInfo->current_h > 0)
_desktopAspectRatio = videoInfo->current_w * 10000 / videoInfo->current_h;
_desktopAspectRatio = videoInfo->current_w * 10000 / videoInfo->current_h;
if (ConfMan.hasKey("last_fullscreen_mode_width") && ConfMan.hasKey("last_fullscreen_mode_height")) {
_lastFullscreenModeWidth = ConfMan.getInt("last_fullscreen_mode_width");
_lastFullscreenModeHeight = ConfMan.getInt("last_fullscreen_mode_height");
}
}
OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() {
@ -360,6 +365,8 @@ bool OpenGLSdlGraphicsManager::loadGFXMode() {
if (_videoMode.fullscreen) {
_lastFullscreenModeWidth = _videoMode.hardwareWidth;
_lastFullscreenModeHeight = _videoMode.hardwareHeight;
ConfMan.setInt("last_fullscreen_mode_width", _lastFullscreenModeWidth);
ConfMan.setInt("last_fullscreen_mode_height", _lastFullscreenModeHeight);
}
// Call and return parent implementation of this method