summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/sdlinput.cpp16
-rw-r--r--src/gui/sdlinput.h3
2 files changed, 19 insertions, 0 deletions
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp
index c869cd99b..3dcbd4caa 100644
--- a/src/gui/sdlinput.cpp
+++ b/src/gui/sdlinput.cpp
@@ -529,3 +529,19 @@ int SDLInput::convertKeyCharacter(const SDL_Event &event)
}
return value;
}
+
+void SDLInput::simulateMouseClick(const int x, const int y,
+ const unsigned int button)
+{
+ MouseInput mouseInput;
+ mouseInput.setX(x);
+ mouseInput.setY(y);
+ mouseInput.setReal(x, y);
+ mouseInput.setButton(button);
+ mouseInput.setType(gcn::MouseInput::PRESSED);
+ mouseInput.setTimeStamp(SDL_GetTicks());
+ mMouseInputQueue.push(mouseInput);
+ mouseInput.setType(gcn::MouseInput::RELEASED);
+ mouseInput.setTimeStamp(SDL_GetTicks());
+ mMouseInputQueue.push(mouseInput);
+}
diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h
index 29f24784f..77e8ea8db 100644
--- a/src/gui/sdlinput.h
+++ b/src/gui/sdlinput.h
@@ -170,6 +170,9 @@ public:
MouseInput dequeueMouseInput2() A_WARN_UNUSED;
+ void simulateMouseClick(const int x, const int y,
+ const unsigned int button);
+
protected:
/**
* Converts a mouse button from SDL to a Guichan mouse button