diff options
author | Alejandro Marzini | 2010-07-27 03:16:10 +0000 |
---|---|---|
committer | Alejandro Marzini | 2010-07-27 03:16:10 +0000 |
commit | 591b371f2be62a8140431e9e482011c4315bc7de (patch) | |
tree | ef1e3c1aa3fc9444526effe743844811bbe54f18 /backends/graphics/opengl/opengl-graphics.cpp | |
parent | 126fe84d3d0ef923d89cadcba229643856c229e5 (diff) | |
download | scummvm-rg350-591b371f2be62a8140431e9e482011c4315bc7de.tar.gz scummvm-rg350-591b371f2be62a8140431e9e482011c4315bc7de.tar.bz2 scummvm-rg350-591b371f2be62a8140431e9e482011c4315bc7de.zip |
OPENGL: Add shake effect.
svn-id: r51344
Diffstat (limited to 'backends/graphics/opengl/opengl-graphics.cpp')
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index b3808a75ee..ac3f561f9e 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -40,7 +40,7 @@ OpenGLGraphicsManager::OpenGLGraphicsManager() #endif _gameTexture(0), _overlayTexture(0), _cursorTexture(0), _screenChangeCount(0), _screenNeedsRedraw(false), - _currentShakePos(0), _newShakePos(0), + _shakePos(0), _overlayVisible(false), _overlayNeedsRedraw(false), _transactionMode(kTransactionNone), _cursorNeedsRedraw(false), _cursorPaletteDisabled(true), @@ -410,7 +410,7 @@ void OpenGLGraphicsManager::updateScreen() { void OpenGLGraphicsManager::setShakePos(int shakeOffset) { assert (_transactionMode == kTransactionNone); - _newShakePos = shakeOffset; + _shakePos = shakeOffset; } void OpenGLGraphicsManager::setFocusRectangle(const Common::Rect& rect) { @@ -866,9 +866,17 @@ void OpenGLGraphicsManager::internUpdateScreen() { // Refresh texture if dirty refreshGameScreen(); + int scaleFactor = _videoMode.hardwareHeight / _videoMode.screenHeight; + + glPushMatrix(); + + glTranslatef(0, _shakePos * scaleFactor, 0); CHECK_GL_ERROR(); + // Draw the game screen _gameTexture->drawTexture(0, 0, _videoMode.hardwareWidth, _videoMode.hardwareHeight); + glPopMatrix(); + if (_overlayVisible) { if (_overlayNeedsRedraw || !_overlayDirtyRect.isEmpty()) // Refresh texture if dirty @@ -883,6 +891,9 @@ void OpenGLGraphicsManager::internUpdateScreen() { // Refresh texture if dirty refreshCursor(); + glPushMatrix(); + glTranslatef(0, _overlayVisible ? 0 : _shakePos * scaleFactor, 0); CHECK_GL_ERROR(); + // Draw the cursor if (_overlayVisible) _cursorTexture->drawTexture(_cursorState.x - _cursorState.rHotX, @@ -890,6 +901,8 @@ void OpenGLGraphicsManager::internUpdateScreen() { else _cursorTexture->drawTexture(_cursorState.x - _cursorState.vHotX, _cursorState.y - _cursorState.vHotY, _cursorState.vW, _cursorState.vH); + + glPopMatrix(); } #ifdef USE_OSD |