diff options
author | Yotam Barnoy | 2010-10-29 07:55:18 +0000 |
---|---|---|
committer | Yotam Barnoy | 2010-10-29 07:55:18 +0000 |
commit | 547e028b93cdc279d4ee871b94aac5701534cb28 (patch) | |
tree | e08152dd5d2cf289ccb760598bc887ff2b7e5067 /backends | |
parent | 082d9a446571ae034d4deaeb81c0affde450224d (diff) | |
download | scummvm-rg350-547e028b93cdc279d4ee871b94aac5701534cb28.tar.gz scummvm-rg350-547e028b93cdc279d4ee871b94aac5701534cb28.tar.bz2 scummvm-rg350-547e028b93cdc279d4ee871b94aac5701534cb28.zip |
PSP: Improved image viewer movement
Before the limit was arbitrary. Now we check the proper location on screen and move in increments relative to the size on screen.
svn-id: r53918
Diffstat (limited to 'backends')
-rw-r--r-- | backends/platform/psp/image_viewer.cpp | 16 | ||||
-rw-r--r-- | backends/platform/psp/image_viewer.h | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/backends/platform/psp/image_viewer.cpp b/backends/platform/psp/image_viewer.cpp index 66512e450b..b859fe21d1 100644 --- a/backends/platform/psp/image_viewer.cpp +++ b/backends/platform/psp/image_viewer.cpp @@ -218,16 +218,16 @@ void ImageViewer::render() { // move the image slightly. Note that we count on the renderer's timing switch (_movement) { case EVENT_MOVE_LEFT: - moveImageX(-2); + moveImageX(-_visibleWidth / 100.0f); break; case EVENT_MOVE_UP: - moveImageY(-2); + moveImageY(-_visibleHeight / 100.0f); break; case EVENT_MOVE_RIGHT: - moveImageX(2); + moveImageX(_visibleWidth / 100.0f); break; case EVENT_MOVE_DOWN: - moveImageY(2); + moveImageY(_visibleHeight / 100.0f); break; default: break; @@ -255,19 +255,19 @@ void ImageViewer::setZoom(float value) { setOffsetParams(); } -void ImageViewer::moveImageX(int val) { +void ImageViewer::moveImageX(float val) { float newVal = _centerX + val; - if (newVal < 0 || newVal > PSP_SCREEN_WIDTH) + if (newVal - (_visibleWidth / 2) > PSP_SCREEN_WIDTH - 4 || newVal + (_visibleWidth / 2) < 4) return; _centerX = newVal; setOffsetParams(); } -void ImageViewer::moveImageY(int val) { +void ImageViewer::moveImageY(float val) { float newVal = _centerY + val; - if (newVal < 0 || newVal > PSP_SCREEN_HEIGHT) + if (newVal - (_visibleHeight / 2) > PSP_SCREEN_HEIGHT - 4 || newVal + (_visibleHeight / 2) < 4) return; _centerY = newVal; setOffsetParams(); diff --git a/backends/platform/psp/image_viewer.h b/backends/platform/psp/image_viewer.h index 1946b0ffe2..ef8b196dbe 100644 --- a/backends/platform/psp/image_viewer.h +++ b/backends/platform/psp/image_viewer.h @@ -66,8 +66,8 @@ private: void loadLastImage(); void setViewerButtons(bool active); void setConstantRendererOptions(); - void moveImageX(int val); - void moveImageY(int val); + void moveImageX(float val); + void moveImageY(float val); bool load(int imageNum); void unload(); void runLoop(); // to get total pausing we have to do our own loop |