From ec8c6e2c7c6689856a9a5547ece905339df994a8 Mon Sep 17 00:00:00 2001 From: Johan Manuel Date: Thu, 21 Jul 2016 23:58:58 +0200 Subject: Expose virtual keyboard functions to GDScript --- core/bind/core_bind.cpp | 14 ++++++++++++++ core/bind/core_bind.h | 4 ++++ core/os/os.cpp | 5 +---- 3 files changed, 19 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 9cc934bb6f..c2ed637b79 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -894,6 +894,17 @@ void _OS::print_resources_by_type(const Vector& p_types) { }; +bool _OS::has_virtual_keyboard() const { + return OS::get_singleton()->has_virtual_keyboard(); +} + +void _OS::show_virtual_keyboard(const String& p_existing_text) { + OS::get_singleton()->show_virtual_keyboard(p_existing_text, Rect2()); +} + +void _OS::hide_virtual_keyboard() { + OS::get_singleton()->hide_virtual_keyboard(); +} void _OS::print_all_resources(const String& p_to_file ) { @@ -1117,6 +1128,9 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("dump_memory_to_file","file"),&_OS::dump_memory_to_file); ObjectTypeDB::bind_method(_MD("dump_resources_to_file","file"),&_OS::dump_resources_to_file); + ObjectTypeDB::bind_method(_MD("has_virtual_keyboard"),&_OS::has_virtual_keyboard); + ObjectTypeDB::bind_method(_MD("show_virtual_keyboard", "existing_text"),&_OS::show_virtual_keyboard,DEFVAL("")); + ObjectTypeDB::bind_method(_MD("hide_virtual_keyboard"),&_OS::hide_virtual_keyboard); ObjectTypeDB::bind_method(_MD("print_resources_in_use","short"),&_OS::print_resources_in_use,DEFVAL(false)); ObjectTypeDB::bind_method(_MD("print_all_resources","tofile"),&_OS::print_all_resources,DEFVAL("")); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index b43c5246ed..64ecd48db1 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -204,6 +204,10 @@ public: void dump_memory_to_file(const String& p_file); void dump_resources_to_file(const String& p_file); + bool has_virtual_keyboard() const; + void show_virtual_keyboard(const String& p_existing_text=""); + void hide_virtual_keyboard(); + void print_resources_in_use(bool p_short=false); void print_all_resources(const String& p_to_file); void print_all_textures_by_size(); diff --git a/core/os/os.cpp b/core/os/os.cpp index 284bcb30cb..5f86962048 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -209,18 +209,15 @@ bool OS::has_virtual_keyboard() const { return false; } -void OS::show_virtual_keyboard(const String& p_existing_text,const Rect2& p_screen_rect) { - +void OS::show_virtual_keyboard(const String& p_existing_text,const Rect2& p_screen_rect) { } void OS::hide_virtual_keyboard(){ - } - void OS::print_all_resources(String p_to_file) { ERR_FAIL_COND(p_to_file!="" && _OSPRF); -- cgit v1.2.3