InputManager::OpenKeyboard

This commit is contained in:
zetaPRIME 2017-03-17 02:21:41 -04:00
parent c969d48e6b
commit 59f3099b68
4 changed files with 25 additions and 11 deletions

View File

@ -6,12 +6,18 @@
#include <math.h>
#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<UIElement>(nullptr);
e->OnDragRelease();
}
void InputManager::OpenKeyboard(InputHandler* handler) {
// todo: open different keyboard type depending on user settings
OSK::New(handler)->Open();
}

View File

@ -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() {}
};

View File

@ -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();
}

View File

@ -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