OPENGL(SDL): Use the whole window/screen size for the overlay.
This makes the overlay looking nicer in fullscreen mode.
This commit is contained in:
parent
ee6853daf2
commit
4841079075
2 changed files with 21 additions and 29 deletions
|
@ -1002,7 +1002,7 @@ void OpenGLGraphicsManager::internUpdateScreen() {
|
||||||
refreshOverlay();
|
refreshOverlay();
|
||||||
|
|
||||||
// Draw the overlay
|
// Draw the overlay
|
||||||
_overlayTexture->drawTexture(_displayX, _displayY, _displayWidth, _displayHeight);
|
_overlayTexture->drawTexture(0, 0, _videoMode.overlayWidth, _videoMode.overlayHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_cursorVisible) {
|
if (_cursorVisible) {
|
||||||
|
@ -1218,32 +1218,20 @@ uint OpenGLGraphicsManager::getAspectRatio() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLGraphicsManager::adjustMousePosition(int16 &x, int16 &y) {
|
void OpenGLGraphicsManager::adjustMousePosition(int16 &x, int16 &y) {
|
||||||
|
if (_overlayVisible)
|
||||||
|
return;
|
||||||
|
|
||||||
if (_videoMode.mode == OpenGL::GFX_NORMAL) {
|
if (_videoMode.mode == OpenGL::GFX_NORMAL) {
|
||||||
if (_videoMode.hardwareWidth != _videoMode.overlayWidth)
|
x /= _videoMode.scaleFactor;
|
||||||
x = x * _videoMode.overlayWidth / _videoMode.hardwareWidth;
|
y /= _videoMode.scaleFactor;
|
||||||
if (_videoMode.hardwareHeight != _videoMode.overlayHeight)
|
} else if (!_overlayVisible) {
|
||||||
y = y * _videoMode.overlayHeight / _videoMode.hardwareHeight;
|
|
||||||
|
|
||||||
if (!_overlayVisible) {
|
|
||||||
x /= _videoMode.scaleFactor;
|
|
||||||
y /= _videoMode.scaleFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
x -= _displayX;
|
x -= _displayX;
|
||||||
y -= _displayY;
|
y -= _displayY;
|
||||||
|
|
||||||
if (_overlayVisible) {
|
if (_displayWidth != _videoMode.screenWidth)
|
||||||
if (_displayWidth != _videoMode.overlayWidth)
|
x = x * _videoMode.screenWidth / _displayWidth;
|
||||||
x = x * _videoMode.overlayWidth / _displayWidth;
|
if (_displayHeight != _videoMode.screenHeight)
|
||||||
if (_displayHeight != _videoMode.overlayHeight)
|
y = y * _videoMode.screenHeight / _displayHeight;
|
||||||
y = y * _videoMode.overlayHeight / _displayHeight;
|
|
||||||
} else {
|
|
||||||
if (_displayWidth != _videoMode.screenWidth)
|
|
||||||
x = x * _videoMode.screenWidth / _displayWidth;
|
|
||||||
if (_displayHeight != _videoMode.screenHeight)
|
|
||||||
y = y * _videoMode.screenHeight / _displayHeight;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -345,13 +345,10 @@ bool OpenGLSdlGraphicsManager::loadGFXMode() {
|
||||||
if (_aspectRatioCorrection)
|
if (_aspectRatioCorrection)
|
||||||
_videoMode.mode = OpenGL::GFX_4_3;
|
_videoMode.mode = OpenGL::GFX_4_3;
|
||||||
|
|
||||||
_videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
|
|
||||||
_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
|
|
||||||
|
|
||||||
// If the screen was resized, do not change its size
|
// If the screen was resized, do not change its size
|
||||||
if (!_screenResized) {
|
if (!_screenResized) {
|
||||||
_videoMode.hardwareWidth = _videoMode.overlayWidth;
|
_videoMode.overlayWidth = _videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
|
||||||
_videoMode.hardwareHeight = _videoMode.overlayHeight;
|
_videoMode.overlayHeight = _videoMode.hardwareHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
|
||||||
|
|
||||||
int screenAspectRatio = _videoMode.screenWidth * 10000 / _videoMode.screenHeight;
|
int screenAspectRatio = _videoMode.screenWidth * 10000 / _videoMode.screenHeight;
|
||||||
int desiredAspectRatio = getAspectRatio();
|
int desiredAspectRatio = getAspectRatio();
|
||||||
|
@ -366,6 +363,9 @@ bool OpenGLSdlGraphicsManager::loadGFXMode() {
|
||||||
// the width is modified it can break the overlay.
|
// the width is modified it can break the overlay.
|
||||||
if (_videoMode.hardwareHeight > _videoMode.overlayHeight)
|
if (_videoMode.hardwareHeight > _videoMode.overlayHeight)
|
||||||
_videoMode.overlayHeight = _videoMode.hardwareHeight;
|
_videoMode.overlayHeight = _videoMode.hardwareHeight;
|
||||||
|
} else {
|
||||||
|
_videoMode.overlayWidth = _videoMode.hardwareWidth;
|
||||||
|
_videoMode.overlayHeight = _videoMode.hardwareHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
_screenResized = false;
|
_screenResized = false;
|
||||||
|
@ -377,11 +377,15 @@ bool OpenGLSdlGraphicsManager::loadGFXMode() {
|
||||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
|
||||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||||
|
|
||||||
if (_videoMode.fullscreen)
|
if (_videoMode.fullscreen) {
|
||||||
if (!setupFullscreenMode())
|
if (!setupFullscreenMode())
|
||||||
// Failed setuping a fullscreen mode
|
// Failed setuping a fullscreen mode
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
_videoMode.overlayWidth = _videoMode.hardwareWidth;
|
||||||
|
_videoMode.overlayHeight = _videoMode.hardwareHeight;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 flags = SDL_OPENGL;
|
uint32 flags = SDL_OPENGL;
|
||||||
|
|
||||||
if (_videoMode.fullscreen)
|
if (_videoMode.fullscreen)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue