[Scummvm-cvs-logs] SF.net SVN: scummvm:[51344] scummvm/branches/gsoc2010-opengl/backends/ graphics/opengl

vgvgf at users.sourceforge.net vgvgf at users.sourceforge.net
Tue Jul 27 05:16:10 CEST 2010


Revision: 51344
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51344&view=rev
Author:   vgvgf
Date:     2010-07-27 03:16:10 +0000 (Tue, 27 Jul 2010)

Log Message:
-----------
OPENGL: Add shake effect.

Modified Paths:
--------------
    scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp
    scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp	2010-07-27 02:46:06 UTC (rev 51343)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp	2010-07-27 03:16:10 UTC (rev 51344)
@@ -40,7 +40,7 @@
 #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::setShakePos(int shakeOffset) {
 	assert (_transactionMode == kTransactionNone);
-	_newShakePos = shakeOffset;
+	_shakePos = shakeOffset;
 }
 
 void OpenGLGraphicsManager::setFocusRectangle(const Common::Rect& rect) {
@@ -866,9 +866,17 @@
 		// 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 @@
 			// 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 @@
 		else
 			_cursorTexture->drawTexture(_cursorState.x - _cursorState.vHotX,
 				_cursorState.y - _cursorState.vHotY, _cursorState.vW, _cursorState.vH);
+
+		glPopMatrix();
 	}
 
 #ifdef USE_OSD

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h	2010-07-27 02:46:06 UTC (rev 51343)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h	2010-07-27 03:16:10 UTC (rev 51344)
@@ -183,8 +183,7 @@
 	virtual void refreshGameScreen();
 
 	// Shake mode
-	int _currentShakePos;
-	int _newShakePos;
+	int _shakePos;
 
 	//
 	// Overlay


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list