From e4483eca01b48b943cd0461e24a74ae1a3139ed4 Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Wed, 12 Feb 2025 21:57:46 +1100 Subject: Update to most recent version (old initial commit) --- src/client/window/text_input_window.hh | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/client/window/text_input_window.hh (limited to 'src/client/window/text_input_window.hh') diff --git a/src/client/window/text_input_window.hh b/src/client/window/text_input_window.hh new file mode 100644 index 0000000..edff672 --- /dev/null +++ b/src/client/window/text_input_window.hh @@ -0,0 +1,43 @@ +#ifndef CLIENT_WINDOW_TEXT_INPUT_WINDOW_HH_ +#define CLIENT_WINDOW_TEXT_INPUT_WINDOW_HH_ + +#include + +#include "client/input.hh" +#include "client/shared.hh" +#include "client/state/state.hh" +#include "client/window/basic_window.hh" +#include "shared/net/proto.hh" + +namespace client { +namespace window { + +void pop_window() noexcept; // forward declaration + +class text_input_window : public basic_window { +private: + // text restricted to a size of 32. + static const std::string& get_send_text() noexcept; + static proto::packet make_say_packet() noexcept; + + static bool maybe_handle_keydown(const SDL_Event& event) noexcept; + static const glm::vec3& get_draw_colour() noexcept; + +public: + template + text_input_window(Args&&... args) noexcept + : basic_window(std::forward(args)...) { + client::input::set_text_input(true); + } + virtual ~text_input_window() noexcept { + client::input::set_text_input(false); + } + virtual bool maybe_handle_event(const SDL_Event& event) noexcept override; + + virtual void draw() noexcept override; +}; + +} // namespace window +} // namespace client + +#endif -- cgit v1.2.3