summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-09 00:29:58 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-09 00:29:58 +0300
commiteef58035c1848a8cffbcb17373b6afbe43be1440 (patch)
treeec8ff687c1c15c6b3f8448e596f51de066a5717b /src/gui
parent1f0070646425aeb23f01d769f5b1cf071d1d3d15 (diff)
downloadplus-eef58035c1848a8cffbcb17373b6afbe43be1440.tar.gz
plus-eef58035c1848a8cffbcb17373b6afbe43be1440.tar.bz2
plus-eef58035c1848a8cffbcb17373b6afbe43be1440.tar.xz
plus-eef58035c1848a8cffbcb17373b6afbe43be1440.zip
Add chat command for send any gui key.
New chat command: guikey.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/sdlinput.cpp11
-rw-r--r--src/gui/sdlinput.h3
2 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp
index 7d964b030..29b6534c1 100644
--- a/src/gui/sdlinput.cpp
+++ b/src/gui/sdlinput.cpp
@@ -359,3 +359,14 @@ void SDLInput::simulateMouseMove()
mouseInput.setTimeStamp(SDL_GetTicks());
mMouseInputQueue.push(mouseInput);
}
+
+void SDLInput::simulateKey(const int guiKey,
+ const InputActionT actionId)
+{
+ KeyInput keyInput;
+ keyInput.setType(KeyEventType::PRESSED);
+ keyInput.setKey(Key(guiKey));
+ if (actionId > InputAction::NO_VALUE)
+ keyInput.setActionId(actionId);
+ mKeyInputQueue.push(keyInput);
+}
diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h
index 7ef0034bb..142a942aa 100644
--- a/src/gui/sdlinput.h
+++ b/src/gui/sdlinput.h
@@ -128,6 +128,9 @@ class SDLInput final
void simulateMouseMove();
+ void simulateKey(const int guiKey,
+ const InputActionT actionId);
+
protected:
/**
* Converts a mouse button from SDL to a Guichan mouse button