diff options
author | Juan Linietsky <red@kyoko> | 2015-05-21 15:02:49 -0300 |
---|---|---|
committer | Juan Linietsky <red@kyoko> | 2015-05-21 15:02:49 -0300 |
commit | bb5d46bb113bca3204db7678eb69900f159e8087 (patch) | |
tree | cd34e10d67a196d217559ab8d4973b8f5bc4ccde /core/bind/core_bind.cpp | |
parent | 4b8745ad63409cf14b02735981ee35d2f794421c (diff) | |
parent | 6049479a99f66b620d59498a76ed9f2c3891f4c8 (diff) | |
download | redot-engine-bb5d46bb113bca3204db7678eb69900f159e8087.tar.gz |
Merge branch 'master' of https://github.com/okamstudio/godot
Diffstat (limited to 'core/bind/core_bind.cpp')
-rw-r--r-- | core/bind/core_bind.cpp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index cde328bc6f..128bc94989 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -5,7 +5,7 @@ #include "io/base64.h" #include "core/globals.h" #include "io/file_access_encrypted.h" - +#include "os/keyboard.h" _ResourceLoader *_ResourceLoader::singleton=NULL; Ref<ResourceInteractiveLoader> _ResourceLoader::load_interactive(const String& p_path,const String& p_type_hint) { @@ -694,6 +694,20 @@ String _OS::get_custom_level() const { return OS::get_singleton()->get_custom_level(); } + +String _OS::get_scancode_string(uint32_t p_code) const { + + return keycode_get_string(p_code); +} +bool _OS::is_scancode_unicode(uint32_t p_unicode) const { + + return keycode_has_unicode(p_unicode); +} +int _OS::find_scancode_from_string(const String& p_code) const { + + return find_keycode(p_code); +} + _OS *_OS::singleton=NULL; void _OS::_bind_methods() { @@ -810,6 +824,9 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("native_video_stop"),&_OS::native_video_stop); ObjectTypeDB::bind_method(_MD("native_video_pause"),&_OS::native_video_pause); + ObjectTypeDB::bind_method(_MD("get_scancode_string","code"),&_OS::get_scancode_string); + ObjectTypeDB::bind_method(_MD("is_scancode_unicode","code"),&_OS::is_scancode_unicode); + ObjectTypeDB::bind_method(_MD("find_scancode_from_string","string"),&_OS::find_scancode_from_string); ObjectTypeDB::bind_method(_MD("set_use_file_access_save_and_swap","enabled"),&_OS::set_use_file_access_save_and_swap); @@ -1740,7 +1757,9 @@ _Mutex::~_Mutex(){ void _Thread::_start_func(void *ud) { - _Thread *t=(_Thread*)ud; + Ref<_Thread>* tud=(Ref<_Thread>*)ud; + Ref<_Thread> t=*tud; + memdelete(tud); Variant::CallError ce; const Variant* arg[1]={&t->userdata}; t->ret=t->target_instance->call(t->target_method,arg,1,ce); @@ -1787,9 +1806,11 @@ Error _Thread::start(Object *p_instance,const StringName& p_method,const Variant userdata=p_userdata; active=true; + Ref<_Thread> *ud = memnew( Ref<_Thread>(this) ); + Thread::Settings s; s.priority=(Thread::Priority)p_priority; - thread = Thread::create(_start_func,this,s); + thread = Thread::create(_start_func,ud,s); if (!thread) { active=false; target_method=StringName(); @@ -1850,5 +1871,8 @@ _Thread::_Thread() { _Thread::~_Thread() { + if (active) { + ERR_EXPLAIN("Reference to a Thread object object was lost while the thread is still running.."); + } ERR_FAIL_COND(active==true); } |