OPENGL: Simplify shake offset application.
This commit is contained in:
parent
1709486859
commit
6576dd758b
1 changed files with 3 additions and 17 deletions
|
@ -353,15 +353,7 @@ void OpenGLGraphicsManager::updateScreen() {
|
||||||
const GLfloat shakeOffset = _gameScreenShakeOffset * (GLfloat)_displayHeight / _gameScreen->getHeight();
|
const GLfloat shakeOffset = _gameScreenShakeOffset * (GLfloat)_displayHeight / _gameScreen->getHeight();
|
||||||
|
|
||||||
// First step: Draw the (virtual) game screen.
|
// First step: Draw the (virtual) game screen.
|
||||||
glPushMatrix();
|
_gameScreen->draw(_displayX, _displayY + shakeOffset, _displayWidth, _displayHeight);
|
||||||
|
|
||||||
// Adjust game screen shake position
|
|
||||||
GLCALL(glTranslatef(0, shakeOffset, 0));
|
|
||||||
|
|
||||||
// Draw the game screen
|
|
||||||
_gameScreen->draw(_displayX, _displayY, _displayWidth, _displayHeight);
|
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
|
|
||||||
// Second step: Draw the overlay if visible.
|
// Second step: Draw the overlay if visible.
|
||||||
if (_overlayVisible) {
|
if (_overlayVisible) {
|
||||||
|
@ -370,18 +362,12 @@ void OpenGLGraphicsManager::updateScreen() {
|
||||||
|
|
||||||
// Third step: Draw the cursor if visible.
|
// Third step: Draw the cursor if visible.
|
||||||
if (_cursorVisible && _cursor) {
|
if (_cursorVisible && _cursor) {
|
||||||
glPushMatrix();
|
|
||||||
|
|
||||||
// Adjust game screen shake position, but only when the overlay is not
|
// Adjust game screen shake position, but only when the overlay is not
|
||||||
// visible.
|
// visible.
|
||||||
if (!_overlayVisible) {
|
const GLfloat cursorOffset = _overlayVisible ? 0 : shakeOffset;
|
||||||
GLCALL(glTranslatef(0, shakeOffset, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
_cursor->draw(_cursorX - _cursorHotspotXScaled, _cursorY - _cursorHotspotYScaled,
|
_cursor->draw(_cursorX - _cursorHotspotXScaled, _cursorY - _cursorHotspotYScaled + cursorOffset,
|
||||||
_cursorWidthScaled, _cursorHeightScaled);
|
_cursorWidthScaled, _cursorHeightScaled);
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_OSD
|
#ifdef USE_OSD
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue