diff --git a/libstarlight/source/starlight/InputManager.cpp b/libstarlight/source/starlight/InputManager.cpp index 1984ca4..46c5dab 100644 --- a/libstarlight/source/starlight/InputManager.cpp +++ b/libstarlight/source/starlight/InputManager.cpp @@ -6,12 +6,18 @@ #include #include <3ds.h> -#include "datatypes/Vector2.h" +#include "starlight/datatypes/Vector2.h" + +#include "starlight/dialog/OSK.h" #include "InputManager.h" using starlight::Vector2; using starlight::ui::UIElement; + +using starlight::dialog::OSK; +using starlight::dialog::osk::InputHandler; + using starlight::DragHandle; using starlight::InputManager; @@ -120,3 +126,8 @@ void DragHandle::Release() { wptr = std::shared_ptr(nullptr); e->OnDragRelease(); } + +void InputManager::OpenKeyboard(InputHandler* handler) { + // todo: open different keyboard type depending on user settings + OSK::New(handler)->Open(); +} diff --git a/libstarlight/source/starlight/InputManager.h b/libstarlight/source/starlight/InputManager.h index c7a3a99..ab901c5 100644 --- a/libstarlight/source/starlight/InputManager.h +++ b/libstarlight/source/starlight/InputManager.h @@ -44,6 +44,13 @@ enum class Keys : unsigned int { }; namespace starlight { + // forward declare this for OpenKeyboard + namespace dialog { + namespace osk { + class InputHandler; + } + } + class InputManager; class DragHandle { friend class starlight::InputManager; @@ -101,6 +108,8 @@ namespace starlight { static DragHandle& GetDragHandle() { return InputManager::drag; } + static void OpenKeyboard(dialog::osk::InputHandler* handler); + private: InputManager() {} }; diff --git a/libstarlight/source/starlight/ui/TextBox.cpp b/libstarlight/source/starlight/ui/TextBox.cpp index 3df8ac5..9c9f660 100644 --- a/libstarlight/source/starlight/ui/TextBox.cpp +++ b/libstarlight/source/starlight/ui/TextBox.cpp @@ -97,7 +97,7 @@ void TextBox::OnDragHold() { void TextBox::OnDragRelease() { if (InputManager::Released(Keys::Touch)) { // pop up osk - OSK::New(new InputHandlerBuffered(text, multiLine, [this](auto& str){ this->SetText(str); }))->Open(); + InputManager::OpenKeyboard(new InputHandlerBuffered(text, multiLine, [this](auto& str){ this->SetText(str); })); } MarkForRedraw(); } diff --git a/libstarlight/todo.txt b/libstarlight/todo.txt index edf0635..06824d2 100644 --- a/libstarlight/todo.txt +++ b/libstarlight/todo.txt @@ -2,23 +2,17 @@ roadmap to first release, in no particular order { - finish implementing OSK! { - polish! { - actual cursor image? - } - InputManager::OpenKeyboard - } - - - whee, fixed softlock/crash on exit, hopefully permanently! + knock out some low-hanging fruit from \V/ add license!! (MIT?) ADD README.MD PLS } then consider these before 1.0 "gold" { - - should form priority be a float? make closing forms a bit less finicky (add them to a separate list and let the Application remove them from the list) add customization for Button (alternate idle/press images, optional glyph drawable) ^ use that to spice up the OSK + actual cursor image for OSK instead of just using a | glypyh input prompt dialog + "shortcut" overloads for InputManager::OpenKeyboard language config and atlas support maybe implement some way of "knocking out" and replacing metrics during runtime for theme switching fix font glyph padding to eliminate slight "crosstalk" in bordered variants