diff options
author | sluicebox | 2019-11-15 01:38:21 -0800 |
---|---|---|
committer | Eugene Sandulenko | 2019-11-19 00:20:40 +0100 |
commit | b8390fa161c0c324af0e52a4f3a740cca9e9a479 (patch) | |
tree | e88f1e7cbb2c35c1b1c3319c9481c4edafca734d /backends/platform/iphone | |
parent | 3238e523ee2ac442c7562830a85b347400b7da88 (diff) | |
download | scummvm-rg350-b8390fa161c0c324af0e52a4f3a740cca9e9a479.tar.gz scummvm-rg350-b8390fa161c0c324af0e52a4f3a740cca9e9a479.tar.bz2 scummvm-rg350-b8390fa161c0c324af0e52a4f3a740cca9e9a479.zip |
GRAPHICS: Add interface for horizontal shake
Diffstat (limited to 'backends/platform/iphone')
-rw-r--r-- | backends/platform/iphone/iphone_common.h | 6 | ||||
-rw-r--r-- | backends/platform/iphone/iphone_video.h | 3 | ||||
-rw-r--r-- | backends/platform/iphone/iphone_video.mm | 13 | ||||
-rw-r--r-- | backends/platform/iphone/osys_main.h | 2 | ||||
-rw-r--r-- | backends/platform/iphone/osys_video.mm | 10 |
5 files changed, 20 insertions, 14 deletions
diff --git a/backends/platform/iphone/iphone_common.h b/backends/platform/iphone/iphone_common.h index 59dca84b85..a09ddd462c 100644 --- a/backends/platform/iphone/iphone_common.h +++ b/backends/platform/iphone/iphone_common.h @@ -61,7 +61,8 @@ struct VideoContext { VideoContext() : asprectRatioCorrection(), screenWidth(), screenHeight(), overlayVisible(false), overlayWidth(), overlayHeight(), mouseX(), mouseY(), mouseHotspotX(), mouseHotspotY(), mouseWidth(), mouseHeight(), - mouseIsVisible(), graphicsMode(kGraphicsModeLinear), shakeOffsetY() { + mouseIsVisible(), graphicsMode(kGraphicsModeLinear), + shakeXOffset(), shakeYOffset() { } // Game screen state @@ -83,7 +84,8 @@ struct VideoContext { // Misc state GraphicsModes graphicsMode; - int shakeOffsetY; + int shakeXOffset; + int shakeYOffset; }; struct InternalEvent { diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h index 26c32183ce..8cba07c409 100644 --- a/backends/platform/iphone/iphone_video.h +++ b/backends/platform/iphone/iphone_video.h @@ -69,7 +69,8 @@ GLint _mouseWidth, _mouseHeight; GLfloat _mouseScaleX, _mouseScaleY; - int _scaledShakeOffsetY; + int _scaledShakeXOffset; + int _scaledShakeYOffset; CGFloat _contentScaleFactor; UITouch *_firstTouch; diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm index 9e521de179..1866bf5f96 100644 --- a/backends/platform/iphone/iphone_video.mm +++ b/backends/platform/iphone/iphone_video.mm @@ -191,7 +191,8 @@ const char *iPhone_getDocumentsDir() { _overlayTexture = 0; _mouseCursorTexture = 0; - _scaledShakeOffsetY = 0; + _scaledShakeXOffset = 0; + _scaledShakeYOffset = 0; _firstTouch = NULL; _secondTouch = NULL; @@ -567,10 +568,10 @@ const char *iPhone_getDocumentsDir() { // Scale the shake offset according to the overlay size. We need this to // adjust the overlay mouse click coordinates when an offset is set. - _scaledShakeOffsetY = (int)(_videoContext.shakeOffsetY / (GLfloat)_videoContext.screenHeight * CGRectGetHeight(_overlayRect)); + _scaledShakeYOffset = (int)(_videoContext.shakeYOffset / (GLfloat)_videoContext.screenHeight * CGRectGetHeight(_overlayRect)); - // Apply the shakeing to the output screen. - glTranslatef(0, -_scaledShakeOffsetY, 0); + // Apply the shaking to the output screen. + glTranslatef(0, -_scaledShakeYOffset, 0); } - (void)clearColorBuffer { @@ -641,12 +642,12 @@ const char *iPhone_getDocumentsDir() { area = &_overlayRect; width = _videoContext.overlayWidth; height = _videoContext.overlayHeight; - offsetY = _scaledShakeOffsetY; + offsetY = _scaledShakeYOffset; } else { area = &_gameScreenRect; width = _videoContext.screenWidth; height = _videoContext.screenHeight; - offsetY = _videoContext.shakeOffsetY; + offsetY = _videoContext.shakeYOffset; } point.x = (point.x - CGRectGetMinX(*area)) / CGRectGetWidth(*area); diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h index 6aa77e291d..427d8063e4 100644 --- a/backends/platform/iphone/osys_main.h +++ b/backends/platform/iphone/osys_main.h @@ -147,7 +147,7 @@ public: virtual void updateScreen(); virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); - virtual void setShakePos(int shakeOffset); + virtual void setShakePos(int shakeXOffset, int shakeYOffset); virtual void showOverlay(); virtual void hideOverlay(); diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm index f07160d350..a5dca7ffb7 100644 --- a/backends/platform/iphone/osys_video.mm +++ b/backends/platform/iphone/osys_video.mm @@ -72,7 +72,8 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm _videoContext->screenWidth = width; _videoContext->screenHeight = height; - _videoContext->shakeOffsetY = 0; + _videoContext->shakeXOffset = 0; + _videoContext->shakeYOffset = 0; // In case we use the screen texture as frame buffer we reset the pixels // pointer here to avoid freeing the screen texture. @@ -282,9 +283,10 @@ void OSystem_IPHONE::unlockScreen() { dirtyFullScreen(); } -void OSystem_IPHONE::setShakePos(int shakeOffset) { - //printf("setShakePos(%i)\n", shakeOffset); - _videoContext->shakeOffsetY = shakeOffset; +void OSystem_IPHONE::setShakePos(int shakeXOffset, int shakeYOffset) { + //printf("setShakePos(%i, %i)\n", shakeXOffset, shakeYOffset); + _videoContext->shakeXOffset = shakeXOffset; + _videoContext->shakeYOffset = shakeYOffset; [g_iPhoneViewInstance performSelectorOnMainThread:@selector(setViewTransformation) withObject:nil waitUntilDone: YES]; // HACK: We use this to force a redraw. _mouseDirty = true; |