mirror of
https://github.com/godotengine/godot.git
synced 2025-11-02 06:31:13 +00:00
[HTML5] Opt-in virtual keyboard support.
Added as an export option "Experimental Virtual Keyboard". There is no zoom, so text/line edit must be in the top part of the screen, or it will get hidden by the virtual keyboard. UTF8/Latin-1 only (I think regular UTF-8 should work out of the box in 4.0 but I can't test it). It uses an hidden textarea or input, based on the multiline variable, and only gets activated if the device has a touchscreen. This could cause problems on devices with both touchscreen and a real keyboard (although input should still work in general with some minor focus issues). I'm thinking of a system to detect the first physical keystroke and disable it in case, but it might do more harm then good, so it must be well thought.
This commit is contained in:
parent
9952a5039a
commit
4b38aefd33
7 changed files with 195 additions and 8 deletions
|
|
@ -60,9 +60,6 @@ private:
|
|||
double last_click_ms;
|
||||
int last_click_button_index;
|
||||
|
||||
int last_width;
|
||||
int last_height;
|
||||
|
||||
MainLoop *main_loop;
|
||||
int video_driver_index;
|
||||
AudioDriverJavaScript *audio_driver_javascript;
|
||||
|
|
@ -89,6 +86,7 @@ private:
|
|||
static EM_BOOL touchmove_callback(int p_event_type, const EmscriptenTouchEvent *p_event, void *p_user_data);
|
||||
|
||||
static void gamepad_callback(int p_index, int p_connected, const char *p_id, const char *p_guid);
|
||||
static void input_text_callback(const char *p_text, int p_cursor);
|
||||
void process_joypads();
|
||||
|
||||
static void file_access_close_callback(const String &p_file, int p_flags);
|
||||
|
|
@ -120,6 +118,10 @@ public:
|
|||
// Override return type to make writing static callbacks less tedious.
|
||||
static OS_JavaScript *get_singleton();
|
||||
|
||||
virtual bool has_virtual_keyboard() const;
|
||||
virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2(), bool p_multiline = false, int p_max_input_length = -1, int p_cursor_start = -1, int p_cursor_end = -1);
|
||||
virtual void hide_virtual_keyboard();
|
||||
|
||||
virtual bool get_swap_ok_cancel();
|
||||
virtual void swap_buffers();
|
||||
virtual void set_video_mode(const VideoMode &p_video_mode, int p_screen = 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue