summaryrefslogtreecommitdiff
path: root/src/gui/sdlinput.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-18 16:27:04 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-18 16:27:04 +0300
commit03c74387d37cefcc18e59db203d17d78cda40e8e (patch)
tree74e7291b97b67bb75984f5f5819944f058a9ace7 /src/gui/sdlinput.cpp
parent3d7cb45edeb4f75bad321d54d84fe2d13b487db9 (diff)
downloadplus-03c74387d37cefcc18e59db203d17d78cda40e8e.tar.gz
plus-03c74387d37cefcc18e59db203d17d78cda40e8e.tar.bz2
plus-03c74387d37cefcc18e59db203d17d78cda40e8e.tar.xz
plus-03c74387d37cefcc18e59db203d17d78cda40e8e.zip
Move mousebutton into separate file.
Diffstat (limited to 'src/gui/sdlinput.cpp')
-rw-r--r--src/gui/sdlinput.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp
index b10147bc7..aa8824bbd 100644
--- a/src/gui/sdlinput.cpp
+++ b/src/gui/sdlinput.cpp
@@ -75,6 +75,7 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "logger.h"
#include "sdlshared.h"
#include "input/inputmanager.h"
@@ -250,7 +251,7 @@ void SDLInput::pushInput(const SDL_Event &event)
event.motion.realy / scale);
#endif
#endif
- mouseInput.setButton(MouseInput::EMPTY);
+ mouseInput.setButton(MouseButton::EMPTY);
mouseInput.setType(MouseInput::MOVED);
mouseInput.setTimeStamp(SDL_GetTicks());
mMouseInputQueue.push(mouseInput);
@@ -270,7 +271,7 @@ void SDLInput::pushInput(const SDL_Event &event)
{
mouseInput.setX(-1);
mouseInput.setY(-1);
- mouseInput.setButton(MouseInput::EMPTY);
+ mouseInput.setButton(MouseButton::EMPTY);
mouseInput.setType(MouseInput::MOVED);
mMouseInputQueue.push(mouseInput);
}
@@ -293,19 +294,20 @@ void SDLInput::convertKeyEventToKey(const SDL_Event &event, KeyInput &keyInput)
keyInput.setActionId(actionId);
}
-int SDLInput::convertMouseButton(const int button)
+MouseButton::Type SDLInput::convertMouseButton(const int button)
{
switch (button)
{
- case SDL_BUTTON_LEFT:
- return MouseInput::LEFT;
- case SDL_BUTTON_RIGHT:
- return MouseInput::RIGHT;
- case SDL_BUTTON_MIDDLE:
- return MouseInput::MIDDLE;
- default:
- // We have an unknown mouse type which is ignored.
- return button;
+ case SDL_BUTTON_LEFT:
+ return MouseButton::LEFT;
+ case SDL_BUTTON_RIGHT:
+ return MouseButton::RIGHT;
+ case SDL_BUTTON_MIDDLE:
+ return MouseButton::MIDDLE;
+ default:
+ // We have an unknown mouse type which is ignored.
+ logger->log("unknown button type: %u", button);
+ return MouseButton::EMPTY;
}
}
@@ -522,7 +524,7 @@ int SDLInput::convertKeyCharacter(const SDL_Event &event)
}
void SDLInput::simulateMouseClick(const int x, const int y,
- const unsigned int button)
+ const MouseButton::Type button)
{
MouseInput mouseInput;
mouseInput.setX(x);