aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/ios7
diff options
context:
space:
mode:
authorsluicebox2019-11-15 01:38:21 -0800
committerEugene Sandulenko2019-11-19 00:20:40 +0100
commitb8390fa161c0c324af0e52a4f3a740cca9e9a479 (patch)
treee88f1e7cbb2c35c1b1c3319c9481c4edafca734d /backends/platform/ios7
parent3238e523ee2ac442c7562830a85b347400b7da88 (diff)
downloadscummvm-rg350-b8390fa161c0c324af0e52a4f3a740cca9e9a479.tar.gz
scummvm-rg350-b8390fa161c0c324af0e52a4f3a740cca9e9a479.tar.bz2
scummvm-rg350-b8390fa161c0c324af0e52a4f3a740cca9e9a479.zip
GRAPHICS: Add interface for horizontal shake
Diffstat (limited to 'backends/platform/ios7')
-rw-r--r--backends/platform/ios7/ios7_common.h6
-rw-r--r--backends/platform/ios7/ios7_osys_main.h2
-rw-r--r--backends/platform/ios7/ios7_osys_video.mm10
-rw-r--r--backends/platform/ios7/ios7_video.h3
-rw-r--r--backends/platform/ios7/ios7_video.mm11
5 files changed, 19 insertions, 13 deletions
diff --git a/backends/platform/ios7/ios7_common.h b/backends/platform/ios7/ios7_common.h
index aa5134335e..dd1e85a884 100644
--- a/backends/platform/ios7/ios7_common.h
+++ b/backends/platform/ios7/ios7_common.h
@@ -80,7 +80,8 @@ struct VideoContext {
VideoContext() : asprectRatioCorrection(), screenWidth(), screenHeight(), overlayVisible(false),
overlayWidth(), overlayHeight(), mouseX(), mouseY(),
mouseHotspotX(), mouseHotspotY(), mouseWidth(), mouseHeight(),
- mouseIsVisible(), graphicsMode(kGraphicsModeNone), filtering(false), shakeOffsetY() {
+ mouseIsVisible(), graphicsMode(kGraphicsModeNone), filtering(false),
+ shakeXOffset(), shakeYOffset() {
}
// Game screen state
@@ -103,7 +104,8 @@ struct VideoContext {
// Misc state
GraphicsModes graphicsMode;
bool filtering;
- int shakeOffsetY;
+ int shakeXOffset;
+ int shakeYOffset;
};
struct InternalEvent {
diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h
index 994a67dddb..f70e48e7de 100644
--- a/backends/platform/ios7/ios7_osys_main.h
+++ b/backends/platform/ios7/ios7_osys_main.h
@@ -161,7 +161,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/ios7/ios7_osys_video.mm b/backends/platform/ios7/ios7_osys_video.mm
index 20cf687709..d31ca10ea3 100644
--- a/backends/platform/ios7/ios7_osys_video.mm
+++ b/backends/platform/ios7/ios7_osys_video.mm
@@ -138,7 +138,8 @@ void OSystem_iOS7::initSize(uint width, uint height, const Graphics::PixelFormat
_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.
@@ -354,9 +355,10 @@ void OSystem_iOS7::unlockScreen() {
dirtyFullScreen();
}
-void OSystem_iOS7::setShakePos(int shakeOffset) {
- //printf("setShakePos(%i)\n", shakeOffset);
- _videoContext->shakeOffsetY = shakeOffset;
+void OSystem_iOS7::setShakePos(int shakeXOffset, int shakeYOffset) {
+ //printf("setShakePos(%i, %i)\n", shakeXOffset, shakeYOffset);
+ _videoContext->shakeXOffset = shakeXOffset;
+ _videoContext->shakeYOffset = shakeYOffset;
execute_on_main_thread(^ {
[[iOS7AppDelegate iPhoneView] setViewTransformation];
});
diff --git a/backends/platform/ios7/ios7_video.h b/backends/platform/ios7/ios7_video.h
index a26213f28e..030d81cd9f 100644
--- a/backends/platform/ios7/ios7_video.h
+++ b/backends/platform/ios7/ios7_video.h
@@ -84,7 +84,8 @@ typedef struct {
GLint _mouseWidth, _mouseHeight;
GLfloat _mouseScaleX, _mouseScaleY;
- int _scaledShakeOffsetY;
+ int _scaledShakeXOffset;
+ int _scaledShakeYOffset;
UITouch *_firstTouch;
UITouch *_secondTouch;
diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm
index 321ccdb63d..914dc6ded1 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -454,7 +454,8 @@ uint getSizeNextPOT(uint size) {
_overlayTexture = 0;
_mouseCursorTexture = 0;
- _scaledShakeOffsetY = 0;
+ _scaledShakeXOffset = 0;
+ _scaledShakeYOffset = 0;
_firstTouch = NULL;
_secondTouch = NULL;
@@ -868,9 +869,9 @@ uint getSizeNextPOT(uint size) {
- (void)setViewTransformation {
// 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));
- glUniform1f(_shakeSlot, _scaledShakeOffsetY);
+ glUniform1f(_shakeSlot, _scaledShakeYOffset);
}
- (void)clearColorBuffer {
@@ -914,12 +915,12 @@ uint getSizeNextPOT(uint size) {
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);