diff options
| author | XaviDCR92 <xavi.dcr@gmail.com> | 2018-08-05 18:02:42 +0200 |
|---|---|---|
| committer | XaviDCR92 <xavi.dcr@gmail.com> | 2018-08-05 18:02:42 +0200 |
| commit | 37070c559d37069ddd05f77b803ab92c5266e80c (patch) | |
| tree | 93f616ca5d790a6c22e8c4bf5d8830843e466c8d /Cursor.cpp | |
| parent | 4efe5ad6f9c8abb53df1e06921ce010ced24868e (diff) | |
| download | pocketempires-37070c559d37069ddd05f77b803ab92c5266e80c.tar.gz | |
* Cursor: fixed invalid returned position when cursor was pointing to anything over X or Y screen resolution/2.
Diffstat (limited to 'Cursor.cpp')
| -rw-r--r-- | Cursor.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -3,6 +3,7 @@ * ******************************************************************/ #include "Cursor.h" +#include "Camera.h" #include <stdint.h> /* ******************************************************************* @@ -37,9 +38,10 @@ * \brief Constructor for Cursor class. * *********************************************************************/ -Cursor::Cursor(void) : +Cursor::Cursor(const Camera& c) : _x(CURSOR_DEFAULT_X), -_y(CURSOR_DEFAULT_Y) +_y(CURSOR_DEFAULT_Y), +_cam(c) { } @@ -73,6 +75,16 @@ void Cursor::move(const int8_t x, const int8_t y) } } +uint8_t Cursor::getScreenX(void) +{ + return _x; +} + +uint8_t Cursor::getScreenY(void) +{ + return _y; +} + /*****************************************************************//** * * \brief This function simply returns cursor X position. @@ -82,7 +94,7 @@ void Cursor::move(const int8_t x, const int8_t y) *********************************************************************/ uint8_t Cursor::getX(void) { - return _x; + return _cam.getRealX(_x); } /*****************************************************************//** @@ -94,7 +106,7 @@ uint8_t Cursor::getX(void) *********************************************************************/ uint8_t Cursor::getY(void) { - return _y; + return _cam.getRealY(_y); } /*****************************************************************//** |
