summaryrefslogtreecommitdiff
path: root/src/gui/gui.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-25 15:41:57 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-25 15:41:57 +0100
commit2c51c98625b225cecfb9628c30d62d4e30f7e3e1 (patch)
tree5f8f85a40785439b6a9ea249a75e81e26d1b44f1 /src/gui/gui.cpp
parent8fdbae08d7f269c72889f89b56493071a2279350 (diff)
downloadmana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.tar.gz
mana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.tar.bz2
mana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.tar.xz
mana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.zip
Ported to SDL2
Diffstat (limited to 'src/gui/gui.cpp')
-rw-r--r--src/gui/gui.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 019d3002..64509e21 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -26,6 +26,7 @@
#include "gui/sdlinput.h"
#include "gui/truetypefont.h"
+#include "gui/widgets/textfield.h"
#include "gui/widgets/window.h"
#include "gui/widgets/windowcontainer.h"
@@ -190,6 +191,12 @@ void Gui::logic()
Palette::advanceGradients();
gcn::Gui::logic();
+
+ while (!guiInput->isTextQueueEmpty())
+ {
+ TextInput textInput = guiInput->dequeueTextInput();
+ handleTextInput(textInput);
+ }
}
void Gui::draw()
@@ -264,3 +271,14 @@ void Gui::handleMouseMoved(const gcn::MouseInput &mouseInput)
gcn::Gui::handleMouseMoved(mouseInput);
mMouseInactivityTimer = 0;
}
+
+void Gui::handleTextInput(const TextInput &textInput)
+{
+ if (auto focused = mFocusHandler->getFocused())
+ {
+ if (auto textField = dynamic_cast<TextField*>(focused))
+ {
+ textField->textInput(textInput);
+ }
+ }
+}