OPENGL: Switch to native resolution fullscreen as default.
svn-id: r51560
This commit is contained in:
parent
7dbe257da8
commit
dd7bcc051f
2 changed files with 15 additions and 0 deletions
|
@ -40,6 +40,11 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager()
|
||||||
|
|
||||||
// Disable OS cursor
|
// Disable OS cursor
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
|
|
||||||
|
// Get desktop resolution
|
||||||
|
const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo();
|
||||||
|
_desktopWidth = videoInfo->current_w;
|
||||||
|
_desktopHeight = videoInfo->current_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() {
|
OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() {
|
||||||
|
@ -229,6 +234,13 @@ bool OpenGLSdlGraphicsManager::loadGFXMode() {
|
||||||
|
|
||||||
// Iterate over all available fullscreen modes
|
// Iterate over all available fullscreen modes
|
||||||
for (int i = 0; const SDL_Rect *mode = availableModes[i]; i++) {
|
for (int i = 0; const SDL_Rect *mode = availableModes[i]; i++) {
|
||||||
|
// Prefer the native resolution over other modes
|
||||||
|
if(mode->w == _desktopWidth && mode->h == _desktopHeight) {
|
||||||
|
bestMode = mode;
|
||||||
|
bestModeIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (mode->w < _videoMode.hardwareWidth)
|
if (mode->w < _videoMode.hardwareWidth)
|
||||||
continue;
|
continue;
|
||||||
if (mode->h < _videoMode.hardwareHeight)
|
if (mode->h < _videoMode.hardwareHeight)
|
||||||
|
|
|
@ -84,6 +84,9 @@ protected:
|
||||||
SDL_Surface *_hwscreen;
|
SDL_Surface *_hwscreen;
|
||||||
|
|
||||||
bool _screenResized;
|
bool _screenResized;
|
||||||
|
|
||||||
|
int _desktopWidth;
|
||||||
|
int _desktopHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue