diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/bind/core_bind.cpp | 13 | ||||
-rw-r--r-- | core/bind/core_bind.h | 2 | ||||
-rw-r--r-- | core/os/input.cpp | 1 | ||||
-rw-r--r-- | core/os/input.h | 1 | ||||
-rw-r--r-- | core/variant_op.cpp | 24 |
5 files changed, 41 insertions, 0 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index ace7e7c7b7..6edc292b62 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -435,6 +435,18 @@ String _OS::get_locale() const { return OS::get_singleton()->get_locale(); } +String _OS::get_latin_keyboard_variant() const { + switch( OS::get_singleton()->get_latin_keyboard_variant() ) { + case OS::LATIN_KEYBOARD_QWERTY: return "QWERTY"; + case OS::LATIN_KEYBOARD_QWERTZ: return "QWERTZ"; + case OS::LATIN_KEYBOARD_AZERTY: return "AZERTY"; + case OS::LATIN_KEYBOARD_QZERTY: return "QZERTY"; + case OS::LATIN_KEYBOARD_DVORAK: return "DVORAK"; + case OS::LATIN_KEYBOARD_NEO : return "NEO"; + default: return "ERROR"; + } +} + String _OS::get_model_name() const { return OS::get_singleton()->get_model_name(); @@ -1097,6 +1109,7 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_ticks_msec"),&_OS::get_ticks_msec); ObjectTypeDB::bind_method(_MD("get_splash_tick_msec"),&_OS::get_splash_tick_msec); ObjectTypeDB::bind_method(_MD("get_locale"),&_OS::get_locale); + ObjectTypeDB::bind_method(_MD("get_latin_keyboard_variant"),&_OS::get_latin_keyboard_variant); ObjectTypeDB::bind_method(_MD("get_model_name"),&_OS::get_model_name); ObjectTypeDB::bind_method(_MD("get_custom_level"),&_OS::get_custom_level); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 856d942d02..5bd427578a 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -192,6 +192,8 @@ public: Vector<String> get_cmdline_args(); String get_locale() const; + String get_latin_keyboard_variant() const; + String get_model_name() const; MainLoop *get_main_loop() const; diff --git a/core/os/input.cpp b/core/os/input.cpp index dacddc0928..efbae57950 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -59,6 +59,7 @@ void Input::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_joy_axis","device","axis"),&Input::get_joy_axis); ObjectTypeDB::bind_method(_MD("get_joy_name","device"),&Input::get_joy_name); ObjectTypeDB::bind_method(_MD("get_joy_guid","device"),&Input::get_joy_guid); + ObjectTypeDB::bind_method(_MD("get_connected_joysticks"),&Input::get_connected_joysticks); ObjectTypeDB::bind_method(_MD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength); ObjectTypeDB::bind_method(_MD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration); ObjectTypeDB::bind_method(_MD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration, DEFVAL(0)); diff --git a/core/os/input.h b/core/os/input.h index fa2cef5467..d11703470b 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -62,6 +62,7 @@ public: virtual float get_joy_axis(int p_device,int p_axis)=0; virtual String get_joy_name(int p_idx)=0; + virtual Array get_connected_joysticks()=0; virtual void joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid)=0; virtual void add_joy_mapping(String p_mapping, bool p_update_existing=false)=0; virtual void remove_joy_mapping(String p_guid)=0; diff --git a/core/variant_op.cpp b/core/variant_op.cpp index e549161de9..9182dcde1a 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -2911,6 +2911,14 @@ bool Variant::iter_init(Variant& r_iter,bool &valid) const { return ret; } break; + case STRING: { + + const String *str=reinterpret_cast<const String*>(_data._mem); + if (str->empty()) + return false; + r_iter = 0; + return true; + } break; case DICTIONARY: { const Dictionary *dic=reinterpret_cast<const Dictionary*>(_data._mem); @@ -3028,6 +3036,17 @@ bool Variant::iter_next(Variant& r_iter,bool &valid) const { return ret; } break; + + case STRING: { + + const String *str=reinterpret_cast<const String*>(_data._mem); + int idx = r_iter; + idx++; + if (idx >= str->size()) + return false; + r_iter = idx; + return true; + } break; case DICTIONARY: { const Dictionary *dic=reinterpret_cast<const Dictionary*>(_data._mem); @@ -3158,6 +3177,11 @@ Variant Variant::iter_get(const Variant& r_iter,bool &r_valid) const { return ret; } break; + case STRING: { + + const String *str=reinterpret_cast<const String*>(_data._mem); + return str->substr(r_iter,1); + } break; case DICTIONARY: { return r_iter; //iterator is the same as the key |