From b8390fa161c0c324af0e52a4f3a740cca9e9a479 Mon Sep 17 00:00:00 2001 From: sluicebox Date: Fri, 15 Nov 2019 01:38:21 -0800 Subject: GRAPHICS: Add interface for horizontal shake --- backends/platform/psp/default_display_client.cpp | 7 ++++--- backends/platform/psp/default_display_client.h | 7 ++++--- backends/platform/psp/osys_psp.cpp | 4 ++-- backends/platform/psp/osys_psp.h | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) (limited to 'backends/platform/psp') diff --git a/backends/platform/psp/default_display_client.cpp b/backends/platform/psp/default_display_client.cpp index 1f0cef2e6c..91183a2238 100644 --- a/backends/platform/psp/default_display_client.cpp +++ b/backends/platform/psp/default_display_client.cpp @@ -157,9 +157,10 @@ void Screen::init() { _renderer.setFullScreen(true); } -void Screen::setShakePos(int pos) { - _shakePos = pos; - _renderer.setOffsetOnScreen(0, pos); +void Screen::setShakePos(int shakeXOffset, int shakeYOffset) { + _shakeXOffset = shakeXOffset; + _shakeYOffset = shakeYOffset; + _renderer.setOffsetOnScreen(0, shakeYOffset); setDirty(); } diff --git a/backends/platform/psp/default_display_client.h b/backends/platform/psp/default_display_client.h index f2972e0b49..ed7239720e 100644 --- a/backends/platform/psp/default_display_client.h +++ b/backends/platform/psp/default_display_client.h @@ -78,14 +78,14 @@ public: */ class Screen : public DefaultDisplayClient { public: - Screen() : _shakePos(0) { + Screen() : _shakeXOffset(0), _shakeYOffset(0) { memset(&_pixelFormat, 0, sizeof(_pixelFormat)); memset(&_frameBuffer, 0, sizeof(_frameBuffer)); } void init(); bool allocate(); - void setShakePos(int pos); + void setShakePos(int shakeXOffset, int shakeYOffset); void setScummvmPixelFormat(const Graphics::PixelFormat *format); const Graphics::PixelFormat &getScummvmPixelFormat() const { return _pixelFormat; } Graphics::Surface *lockAndGetForEditing(); @@ -93,7 +93,8 @@ public: void setSize(uint32 width, uint32 height); private: - uint32 _shakePos; + uint32 _shakeXOffset; + uint32 _shakeYOffset; Graphics::PixelFormat _pixelFormat; Graphics::Surface _frameBuffer; }; diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 006305c6fd..a65840669b 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -231,11 +231,11 @@ void OSystem_PSP::updateScreen() { _pendingUpdate = !_displayManager.renderAll(); // if we didn't update, we have a pending update } -void OSystem_PSP::setShakePos(int shakeOffset) { +void OSystem_PSP::setShakePos(int shakeXOffset, int shakeYOffset) { DEBUG_ENTER_FUNC(); _displayManager.waitUntilRenderFinished(); _pendingUpdate = false; - _screen.setShakePos(shakeOffset); + _screen.setShakePos(shakeXOffset, shakeYOffset); } void OSystem_PSP::showOverlay() { diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index 58354bfbce..ff9dd101d2 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -102,7 +102,7 @@ public: Graphics::Surface *lockScreen(); void unlockScreen(); void updateScreen(); - void setShakePos(int shakeOffset); + void setShakePos(int shakeXOffset, int shakeYOffset); // Overlay related void showOverlay(); -- cgit v1.2.3