diff options
Diffstat (limited to 'core/bind')
| -rw-r--r-- | core/bind/core_bind.cpp | 189 | ||||
| -rw-r--r-- | core/bind/core_bind.h | 54 |
2 files changed, 147 insertions, 96 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 8f1c1779b..657f527a5 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -340,24 +340,6 @@ Array _OS::get_fullscreen_mode_list(int p_screen) const { return vmarr; } -void _OS::set_iterations_per_second(int p_ips) { - - OS::get_singleton()->set_iterations_per_second(p_ips); -} -int _OS::get_iterations_per_second() const { - - return OS::get_singleton()->get_iterations_per_second(); - -} - -void _OS::set_target_fps(int p_fps) { - OS::get_singleton()->set_target_fps(p_fps); -} - -float _OS::get_target_fps() const { - return OS::get_singleton()->get_target_fps(); -} - void _OS::set_low_processor_usage_mode(bool p_enabled) { OS::get_singleton()->set_low_processor_usage_mode(p_enabled); @@ -449,22 +431,10 @@ String _OS::get_latin_keyboard_variant() const { String _OS::get_model_name() const { - return OS::get_singleton()->get_model_name(); + return OS::get_singleton()->get_model_name(); } -MainLoop *_OS::get_main_loop() const { - return OS::get_singleton()->get_main_loop(); -} - -void _OS::set_time_scale(float p_scale) { - OS::get_singleton()->set_time_scale(p_scale); -} - -float _OS::get_time_scale() { - - return OS::get_singleton()->get_time_scale(); -} bool _OS::is_ok_left_and_cancel_right() const { @@ -804,10 +774,6 @@ bool _OS::can_draw() const { return OS::get_singleton()->can_draw(); } -int _OS::get_frames_drawn() { - - return OS::get_singleton()->get_frames_drawn(); -} int _OS::get_processor_count() const { @@ -936,11 +902,6 @@ String _OS::get_data_dir() const { return OS::get_singleton()->get_data_dir(); }; -float _OS::get_frames_per_second() const { - - return OS::get_singleton()->get_frames_per_second(); -} - Error _OS::native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) { return OS::get_singleton()->native_video_play(p_path, p_volume, p_audio_track, p_subtitle_track); @@ -1005,10 +966,7 @@ String _OS::get_system_dir(SystemDir p_dir) const { return OS::get_singleton()->get_system_dir(OS::SystemDir(p_dir)); } -String _OS::get_custom_level() const { - return OS::get_singleton()->get_custom_level(); -} String _OS::get_scancode_string(uint32_t p_code) const { @@ -1028,11 +986,6 @@ void _OS::alert(const String& p_alert,const String& p_title) { OS::get_singleton()->alert(p_alert,p_title); } -Dictionary _OS::get_engine_version() const { - - return OS::get_singleton()->get_engine_version(); -} - _OS *_OS::singleton=NULL; void _OS::_bind_methods() { @@ -1043,11 +996,12 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("set_clipboard","clipboard"),&_OS::set_clipboard); ClassDB::bind_method(_MD("get_clipboard"),&_OS::get_clipboard); - ClassDB::bind_method(_MD("set_video_mode","size","fullscreen","resizable","screen"),&_OS::set_video_mode,DEFVAL(0)); - ClassDB::bind_method(_MD("get_video_mode_size","screen"),&_OS::get_video_mode,DEFVAL(0)); - ClassDB::bind_method(_MD("is_video_mode_fullscreen","screen"),&_OS::is_video_mode_fullscreen,DEFVAL(0)); - ClassDB::bind_method(_MD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0)); - ClassDB::bind_method(_MD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0)); + //will not delete for now, just unexpose + //ClassDB::bind_method(_MD("set_video_mode","size","fullscreen","resizable","screen"),&_OS::set_video_mode,DEFVAL(0)); + //ClassDB::bind_method(_MD("get_video_mode_size","screen"),&_OS::get_video_mode,DEFVAL(0)); + //ClassDB::bind_method(_MD("is_video_mode_fullscreen","screen"),&_OS::is_video_mode_fullscreen,DEFVAL(0)); + //ClassDB::bind_method(_MD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0)); + //ClassDB::bind_method(_MD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0)); ClassDB::bind_method(_MD("get_screen_count"),&_OS::get_screen_count); @@ -1079,13 +1033,6 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("set_keep_screen_on","enabled"),&_OS::set_keep_screen_on); ClassDB::bind_method(_MD("is_keep_screen_on"),&_OS::is_keep_screen_on); - ClassDB::bind_method(_MD("set_iterations_per_second","iterations_per_second"),&_OS::set_iterations_per_second); - ClassDB::bind_method(_MD("get_iterations_per_second"),&_OS::get_iterations_per_second); - ClassDB::bind_method(_MD("set_target_fps","target_fps"),&_OS::set_target_fps); - ClassDB::bind_method(_MD("get_target_fps"),&_OS::get_target_fps); - - ClassDB::bind_method(_MD("set_time_scale","time_scale"),&_OS::set_time_scale); - ClassDB::bind_method(_MD("get_time_scale"),&_OS::get_time_scale); ClassDB::bind_method(_MD("has_touchscreen_ui_hint"),&_OS::has_touchscreen_ui_hint); @@ -1107,7 +1054,6 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("get_name"),&_OS::get_name); ClassDB::bind_method(_MD("get_cmdline_args"),&_OS::get_cmdline_args); - ClassDB::bind_method(_MD("get_main_loop"),&_OS::get_main_loop); ClassDB::bind_method(_MD("get_datetime","utc"),&_OS::get_datetime,DEFVAL(false)); ClassDB::bind_method(_MD("get_date","utc"),&_OS::get_date,DEFVAL(false)); @@ -1133,10 +1079,8 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("get_latin_keyboard_variant"),&_OS::get_latin_keyboard_variant); ClassDB::bind_method(_MD("get_model_name"),&_OS::get_model_name); - ClassDB::bind_method(_MD("get_custom_level"),&_OS::get_custom_level); ClassDB::bind_method(_MD("can_draw"),&_OS::can_draw); - ClassDB::bind_method(_MD("get_frames_drawn"),&_OS::get_frames_drawn); ClassDB::bind_method(_MD("is_stdout_verbose"),&_OS::is_stdout_verbose); ClassDB::bind_method(_MD("can_use_threads"),&_OS::can_use_threads); @@ -1163,7 +1107,6 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("is_ok_left_and_cancel_right"),&_OS::is_ok_left_and_cancel_right); - ClassDB::bind_method(_MD("get_frames_per_second"),&_OS::get_frames_per_second); ClassDB::bind_method(_MD("print_all_textures_by_size"),&_OS::print_all_textures_by_size); ClassDB::bind_method(_MD("print_resources_by_type","types"),&_OS::print_resources_by_type); @@ -1187,8 +1130,6 @@ void _OS::_bind_methods() { ClassDB::bind_method(_MD("set_use_vsync","enable"),&_OS::set_use_vsync); ClassDB::bind_method(_MD("is_vsync_enabled"),&_OS::is_vsync_enabled); - ClassDB::bind_method(_MD("get_engine_version"),&_OS::get_engine_version); - BIND_CONSTANT( DAY_SUNDAY ); BIND_CONSTANT( DAY_MONDAY ); BIND_CONSTANT( DAY_TUESDAY ); @@ -1890,9 +1831,9 @@ Error _Directory::open(const String& p_path) { return OK; } -bool _Directory::list_dir_begin() { +Error _Directory::list_dir_begin() { - ERR_FAIL_COND_V(!d,false); + ERR_FAIL_COND_V(!d,ERR_UNCONFIGURED); return d->list_dir_begin(); } @@ -1923,6 +1864,10 @@ String _Directory::get_drive(int p_drive){ ERR_FAIL_COND_V(!d,""); return d->get_drive(p_drive); } +int _Directory::get_current_drive() { + ERR_FAIL_COND_V(!d,0); + return d->get_current_drive(); +} Error _Directory::change_dir(String p_dir){ @@ -2031,13 +1976,14 @@ void _Directory::_bind_methods() { ClassDB::bind_method(_MD("list_dir_end"),&_Directory::list_dir_end); ClassDB::bind_method(_MD("get_drive_count"),&_Directory::get_drive_count); ClassDB::bind_method(_MD("get_drive","idx"),&_Directory::get_drive); + ClassDB::bind_method(_MD("get_current_drive"),&_Directory::get_current_drive); ClassDB::bind_method(_MD("change_dir:Error","todir"),&_Directory::change_dir); ClassDB::bind_method(_MD("get_current_dir"),&_Directory::get_current_dir); ClassDB::bind_method(_MD("make_dir:Error","path"),&_Directory::make_dir); ClassDB::bind_method(_MD("make_dir_recursive:Error","path"),&_Directory::make_dir_recursive); ClassDB::bind_method(_MD("file_exists","path"),&_Directory::file_exists); ClassDB::bind_method(_MD("dir_exists","path"),&_Directory::dir_exists); -// ClassDB::bind_method(_MD("get_modified_time","file"),&_Directory::get_modified_time); + //ClassDB::bind_method(_MD("get_modified_time","file"),&_Directory::get_modified_time); ClassDB::bind_method(_MD("get_space_left"),&_Directory::get_space_left); ClassDB::bind_method(_MD("copy:Error","from","to"),&_Directory::copy); ClassDB::bind_method(_MD("rename:Error","from","to"),&_Directory::rename); @@ -2567,22 +2513,22 @@ void _ClassDB::_bind_methods() { ClassDB::bind_method(_MD("can_instance","class"),&_ClassDB::can_instance); ClassDB::bind_method(_MD("instance","class"),&_ClassDB::instance); - ClassDB::bind_method(_MD("has_signal","class","signal"),&_ClassDB::has_signal); - ClassDB::bind_method(_MD("get_signal","class","signal"),&_ClassDB::get_signal); - ClassDB::bind_method(_MD("get_signal_list","class","no_inheritance"),&_ClassDB::get_signal_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_has_signal","class","signal"),&_ClassDB::has_signal); + ClassDB::bind_method(_MD("class_get_signal","class","signal"),&_ClassDB::get_signal); + ClassDB::bind_method(_MD("class_get_signal_list","class","no_inheritance"),&_ClassDB::get_signal_list,DEFVAL(false)); - ClassDB::bind_method(_MD("get_property_list","class","no_inheritance"),&_ClassDB::get_property_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_get_property_list","class","no_inheritance"),&_ClassDB::get_property_list,DEFVAL(false)); - ClassDB::bind_method(_MD("has_method","class","method","no_inheritance"),&_ClassDB::has_method,DEFVAL(false)); + ClassDB::bind_method(_MD("class_has_method","class","method","no_inheritance"),&_ClassDB::has_method,DEFVAL(false)); - ClassDB::bind_method(_MD("get_method_list","class","no_inheritance"),&_ClassDB::get_method_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_get_method_list","class","no_inheritance"),&_ClassDB::get_method_list,DEFVAL(false)); - ClassDB::bind_method(_MD("get_integer_constant_list","class","no_inheritance"),&_ClassDB::get_integer_constant_list,DEFVAL(false)); + ClassDB::bind_method(_MD("class_get_integer_constant_list","class","no_inheritance"),&_ClassDB::get_integer_constant_list,DEFVAL(false)); - ClassDB::bind_method(_MD("has_integer_constant","class","name"),&_ClassDB::has_integer_constant); - ClassDB::bind_method(_MD("get_integer_constant","class","name"),&_ClassDB::get_integer_constant); + ClassDB::bind_method(_MD("class_has_integer_constant","class","name"),&_ClassDB::has_integer_constant); + ClassDB::bind_method(_MD("class_get_integer_constant","class","name"),&_ClassDB::get_integer_constant); - ClassDB::bind_method(_MD("get_category","class"),&_ClassDB::get_category); + ClassDB::bind_method(_MD("class_get_category","class"),&_ClassDB::get_category); ClassDB::bind_method(_MD("is_class_enabled","class"),&_ClassDB::is_class_enabled); @@ -2596,3 +2542,88 @@ _ClassDB::~_ClassDB(){ } +/////////////////////////////// + + +void _Engine::set_iterations_per_second(int p_ips) { + + Engine::get_singleton()->set_iterations_per_second(p_ips); +} +int _Engine::get_iterations_per_second() const { + + return Engine::get_singleton()->get_iterations_per_second(); + +} + +void _Engine::set_target_fps(int p_fps) { + Engine::get_singleton()->set_target_fps(p_fps); +} + +float _Engine::get_target_fps() const { + return Engine::get_singleton()->get_target_fps(); +} + + + +float _Engine::get_frames_per_second() const { + + return Engine::get_singleton()->get_frames_per_second(); +} + +String _Engine::get_custom_level() const { + + return Engine::get_singleton()->get_custom_level(); +} + +void _Engine::set_time_scale(float p_scale) { + Engine::get_singleton()->set_time_scale(p_scale); +} + +float _Engine::get_time_scale() { + + return Engine::get_singleton()->get_time_scale(); +} + +int _Engine::get_frames_drawn() { + + return Engine::get_singleton()->get_frames_drawn(); +} + +MainLoop *_Engine::get_main_loop() const { + + //needs to remain in OS, since it's actually OS that interacts with it, but it's better exposed here + return OS::get_singleton()->get_main_loop(); +} + +Dictionary _Engine::get_version_info() const { + + return Engine::get_singleton()->get_version_info(); +} + + +void _Engine::_bind_methods() { + + ClassDB::bind_method(_MD("set_iterations_per_second","iterations_per_second"),&_Engine::set_iterations_per_second); + ClassDB::bind_method(_MD("get_iterations_per_second"),&_Engine::get_iterations_per_second); + ClassDB::bind_method(_MD("set_target_fps","target_fps"),&_Engine::set_target_fps); + ClassDB::bind_method(_MD("get_target_fps"),&_Engine::get_target_fps); + + ClassDB::bind_method(_MD("set_time_scale","time_scale"),&_Engine::set_time_scale); + ClassDB::bind_method(_MD("get_time_scale"),&_Engine::get_time_scale); + + ClassDB::bind_method(_MD("get_custom_level"),&_Engine::get_custom_level); + + ClassDB::bind_method(_MD("get_frames_drawn"),&_Engine::get_frames_drawn); + ClassDB::bind_method(_MD("get_frames_per_second"),&_Engine::get_frames_per_second); + + ClassDB::bind_method(_MD("get_main_loop:MainLoop"),&_Engine::get_main_loop); + + ClassDB::bind_method(_MD("get_version_info"),&_Engine::get_version_info); + +} + +_Engine *_Engine::singleton = NULL; + +_Engine::_Engine() { + singleton=this; +} diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index d491483d8..f10714720 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -169,12 +169,6 @@ public: void native_video_unpause(); void native_video_stop(); - void set_iterations_per_second(int p_ips); - int get_iterations_per_second() const; - - void set_target_fps(int p_fps); - float get_target_fps() const; - void set_low_processor_usage_mode(bool p_enabled); bool is_in_low_processor_usage_mode() const; @@ -196,11 +190,7 @@ public: String get_latin_keyboard_variant() const; String get_model_name() const; - MainLoop *get_main_loop() const; - String get_custom_level() const; - - float get_frames_per_second() const; void dump_memory_to_file(const String& p_file); void dump_resources_to_file(const String& p_file); @@ -271,8 +261,6 @@ public: bool can_draw() const; - int get_frames_drawn(); - bool is_stdout_verbose() const; int get_processor_count() const; @@ -313,8 +301,6 @@ public: void set_keep_screen_on(bool p_enabled); bool is_keep_screen_on() const; - void set_time_scale(float p_scale); - float get_time_scale(); bool is_ok_left_and_cancel_right() const; @@ -323,8 +309,6 @@ public: void set_use_vsync(bool p_enable); bool is_vsync_enabled() const; - Dictionary get_engine_version() const; - static _OS *get_singleton() { return singleton; } _OS(); @@ -472,7 +456,7 @@ public: Error open(const String& p_path); - bool list_dir_begin(); ///< This starts dir listing + Error list_dir_begin(); ///< This starts dir listing String get_next(); bool current_is_dir() const; @@ -480,6 +464,7 @@ public: int get_drive_count(); String get_drive(int p_drive); + int get_current_drive(); Error change_dir(String p_dir); ///< can be relative or absolute, return false on success String get_current_dir(); ///< return current dir location @@ -632,4 +617,39 @@ public: ~_ClassDB(); }; + +class _Engine : public Object { + GDCLASS(_Engine,Object); + +protected: + + static void _bind_methods(); + static _Engine *singleton; + +public: + + static _Engine* get_singleton() { return singleton; } + void set_iterations_per_second(int p_ips); + int get_iterations_per_second() const; + + void set_target_fps(int p_fps); + float get_target_fps() const; + + float get_frames_per_second() const; + + int get_frames_drawn(); + + void set_time_scale(float p_scale); + float get_time_scale(); + + String get_custom_level() const; + + MainLoop *get_main_loop() const; + + Dictionary get_version_info() const; + + _Engine(); +}; + + #endif // CORE_BIND_H |
