summaryrefslogtreecommitdiff
path: root/src/gui/sdlinput.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/sdlinput.cpp')
-rw-r--r--src/gui/sdlinput.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp
index 6eb58a36..c0f24a7a 100644
--- a/src/gui/sdlinput.cpp
+++ b/src/gui/sdlinput.cpp
@@ -60,6 +60,8 @@
#include <guichan/exception.hpp>
+#include "graphics.h"
+
SDLInput::SDLInput()
{
mMouseInWindow = true;
@@ -73,14 +75,12 @@ bool SDLInput::isKeyQueueEmpty()
gcn::KeyInput SDLInput::dequeueKeyInput()
{
- gcn::KeyInput keyInput;
-
if (mKeyInputQueue.empty())
{
throw GCN_EXCEPTION("The queue is empty.");
}
- keyInput = mKeyInputQueue.front();
+ gcn::KeyInput keyInput = mKeyInputQueue.front();
mKeyInputQueue.pop();
return keyInput;
@@ -93,16 +93,19 @@ bool SDLInput::isMouseQueueEmpty()
gcn::MouseInput SDLInput::dequeueMouseInput()
{
- gcn::MouseInput mouseInput;
-
if (mMouseInputQueue.empty())
{
throw GCN_EXCEPTION("The queue is empty.");
}
- mouseInput = mMouseInputQueue.front();
+ gcn::MouseInput mouseInput = mMouseInputQueue.front();
mMouseInputQueue.pop();
+ // Scale the mouse input by the graphics scale ratio
+ int scale = graphics->getScale();
+ mouseInput.setX(mouseInput.getX() / scale);
+ mouseInput.setY(mouseInput.getY() / scale);
+
return mouseInput;
}