diff options
author | Cameron Cawley | 2019-07-27 14:40:50 +0100 |
---|---|---|
committer | Filippos Karapetis | 2019-08-15 02:01:21 +0300 |
commit | 1feb86ee97eaaaf326918d4945cdaa0a2f61d33f (patch) | |
tree | ee051b4732b9d65bb57940af07e3d4cf91aba7f5 /backends/graphics/opengl | |
parent | 0bf74e590d6da396ae10793191fad92f4424ae6d (diff) | |
download | scummvm-rg350-1feb86ee97eaaaf326918d4945cdaa0a2f61d33f.tar.gz scummvm-rg350-1feb86ee97eaaaf326918d4945cdaa0a2f61d33f.tar.bz2 scummvm-rg350-1feb86ee97eaaaf326918d4945cdaa0a2f61d33f.zip |
BACKENDS: Handle screen shaking in WindowedGraphicsManager
Diffstat (limited to 'backends/graphics/opengl')
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.cpp | 19 | ||||
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.h | 7 |
2 files changed, 3 insertions, 23 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 3ee374eaab..a6f31e64fb 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -56,7 +56,7 @@ OpenGLGraphicsManager::OpenGLGraphicsManager() : _currentState(), _oldState(), _transactionMode(kTransactionNone), _screenChangeID(1 << (sizeof(int) * 8 - 2)), _pipeline(nullptr), _stretchMode(STRETCH_FIT), _defaultFormat(), _defaultFormatAlpha(), - _gameScreen(nullptr), _gameScreenShakeOffset(0), _overlay(nullptr), + _gameScreen(nullptr), _overlay(nullptr), _cursor(nullptr), _cursorHotspotX(0), _cursorHotspotY(0), _cursorHotspotXScaled(0), _cursorHotspotYScaled(0), _cursorWidthScaled(0), _cursorHeightScaled(0), @@ -456,13 +456,6 @@ void OpenGLGraphicsManager::fillScreen(uint32 col) { _gameScreen->fill(col); } -void OpenGLGraphicsManager::setShakePos(int shakeOffset) { - if (_gameScreenShakeOffset != shakeOffset) { - _gameScreenShakeOffset = shakeOffset; - _forceRedraw = true; - } -} - void OpenGLGraphicsManager::updateScreen() { if (!_gameScreen) { return; @@ -508,13 +501,11 @@ void OpenGLGraphicsManager::updateScreen() { _backBuffer.enableScissorTest(true); } - const GLfloat shakeOffset = _gameScreenShakeOffset * (GLfloat)_gameDrawRect.height() / _gameScreen->getHeight(); - // Alpha blending is disabled when drawing the screen _backBuffer.enableBlend(Framebuffer::kBlendModeDisabled); // First step: Draw the (virtual) game screen. - g_context.getActivePipeline()->drawTexture(_gameScreen->getGLTexture(), _gameDrawRect.left, _gameDrawRect.top + shakeOffset, _gameDrawRect.width(), _gameDrawRect.height()); + g_context.getActivePipeline()->drawTexture(_gameScreen->getGLTexture(), _gameDrawRect.left, _gameDrawRect.top, _gameDrawRect.width(), _gameDrawRect.height()); // Second step: Draw the overlay if visible. if (_overlayVisible) { @@ -526,13 +517,9 @@ void OpenGLGraphicsManager::updateScreen() { if (_cursorVisible && _cursor) { _backBuffer.enableBlend(Framebuffer::kBlendModePremultipliedTransparency); - // Adjust game screen shake position, but only when the overlay is not - // visible. - const GLfloat cursorOffset = _overlayVisible ? 0 : shakeOffset; - g_context.getActivePipeline()->drawTexture(_cursor->getGLTexture(), _cursorX - _cursorHotspotXScaled, - _cursorY - _cursorHotspotYScaled + cursorOffset, + _cursorY - _cursorHotspotYScaled, _cursorWidthScaled, _cursorHeightScaled); } diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index 0cf85ddfd6..f88315bf30 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -93,8 +93,6 @@ public: virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) override; virtual void fillScreen(uint32 col) override; - virtual void setShakePos(int shakeOffset) override; - virtual void updateScreen() override; virtual Graphics::Surface *lockScreen() override; @@ -333,11 +331,6 @@ protected: */ byte _gamePalette[3 * 256]; - /** - * The offset by which the screen is moved vertically. - */ - int _gameScreenShakeOffset; - // // Overlay // |