diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-25 15:41:57 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-25 15:41:57 +0100 |
commit | 2c51c98625b225cecfb9628c30d62d4e30f7e3e1 (patch) | |
tree | 5f8f85a40785439b6a9ea249a75e81e26d1b44f1 /src/gui/sdlinput.h | |
parent | 8fdbae08d7f269c72889f89b56493071a2279350 (diff) | |
download | mana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.tar.gz mana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.tar.bz2 mana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.tar.xz mana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.zip |
Ported to SDL2
Diffstat (limited to 'src/gui/sdlinput.h')
-rw-r--r-- | src/gui/sdlinput.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index 90f70df3..09bb788e 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -61,13 +61,15 @@ #include <queue> -#include <SDL/SDL.h> +#include <SDL.h> #include <guichan/input.hpp> #include <guichan/keyinput.hpp> #include <guichan/mouseinput.hpp> #include <guichan/platform.hpp> +#include <string> + namespace Key { enum @@ -122,6 +124,19 @@ namespace Key }; } +class TextInput +{ +public: + TextInput(const char *text) + : mText(text) + {} + + const std::string &getText() const { return mText; } + +private: + std::string mText; +}; + /** * SDL implementation of Input. */ @@ -160,6 +175,10 @@ public: virtual gcn::MouseInput dequeueMouseInput(); + bool isTextQueueEmpty() const; + + TextInput dequeueTextInput(); + protected: /** * Converts a mouse button from SDL to a Guichan mouse button @@ -181,6 +200,7 @@ protected: std::queue<gcn::KeyInput> mKeyInputQueue; std::queue<gcn::MouseInput> mMouseInputQueue; + std::queue<TextInput> mTextInputQueue; bool mMouseDown; bool mMouseInWindow; |