diff options
author | Juan Linietsky <red@kyoko> | 2015-08-04 18:09:51 -0300 |
---|---|---|
committer | Juan Linietsky <red@kyoko> | 2015-08-04 18:09:51 -0300 |
commit | 09a2de99169e9cf50d00febafad3a6705aa8d88a (patch) | |
tree | 2866cb380e3bf0ced2720fcd42255288f05f2260 /core/bind | |
parent | d1da2c29955c851d74037a5196168a0a90507f9a (diff) |
added bindings for screen rotation in OS
Diffstat (limited to 'core/bind')
-rw-r--r-- | core/bind/core_bind.cpp | 22 | ||||
-rw-r--r-- | core/bind/core_bind.h | 15 |
2 files changed, 37 insertions, 0 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 95cafdb36d..6a3023cdb2 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -694,6 +694,17 @@ bool _OS::is_debug_build() const { } +void _OS::set_screen_orientation(ScreenOrientation p_orientation) { + + OS::get_singleton()->set_screen_orientation(OS::ScreenOrientation(p_orientation)); +} + +_OS::ScreenOrientation _OS::get_screen_orientation() const { + + return ScreenOrientation(OS::get_singleton()->get_screen_orientation()); +} + + String _OS::get_system_dir(SystemDir p_dir) const { return OS::get_singleton()->get_system_dir(OS::SystemDir(p_dir)); @@ -752,6 +763,9 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_window_maximized", "enabled"),&_OS::set_window_maximized); ObjectTypeDB::bind_method(_MD("is_window_maximized"),&_OS::is_window_maximized); + ObjectTypeDB::bind_method(_MD("set_screen_orientation","orientation"),&_OS::set_screen_orientation); + ObjectTypeDB::bind_method(_MD("get_screen_orientation"),&_OS::get_screen_orientation); + ObjectTypeDB::bind_method(_MD("set_iterations_per_second","iterations_per_second"),&_OS::set_iterations_per_second); ObjectTypeDB::bind_method(_MD("get_iterations_per_second"),&_OS::get_iterations_per_second); @@ -863,6 +877,14 @@ void _OS::_bind_methods() { BIND_CONSTANT( MONTH_NOVEMBER ); BIND_CONSTANT( MONTH_DECEMBER ); + BIND_CONSTANT( SCREEN_ORIENTATION_LANDSCAPE ); + BIND_CONSTANT( SCREEN_ORIENTATION_PORTRAIT ); + BIND_CONSTANT( SCREEN_ORIENTATION_REVERSE_LANDSCAPE ); + BIND_CONSTANT( SCREEN_ORIENTATION_REVERSE_PORTRAIT ); + BIND_CONSTANT( SCREEN_ORIENTATION_SENSOR_LANDSCAPE ); + BIND_CONSTANT( SCREEN_ORIENTATION_SENSOR_PORTRAIT ); + BIND_CONSTANT( SCREEN_ORIENTATION_SENSOR ); + BIND_CONSTANT( SYSTEM_DIR_DESKTOP); BIND_CONSTANT( SYSTEM_DIR_DCIM ); BIND_CONSTANT( SYSTEM_DIR_DOCUMENTS ); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 83f9e533ea..6b916a395e 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -239,11 +239,25 @@ public: SYSTEM_DIR_RINGTONES, }; + enum ScreenOrientation { + + SCREEN_ORIENTATION_LANDSCAPE, + SCREEN_ORIENTATION_PORTRAIT, + SCREEN_ORIENTATION_REVERSE_LANDSCAPE, + SCREEN_ORIENTATION_REVERSE_PORTRAIT, + SCREEN_ORIENTATION_SENSOR_LANDSCAPE, + SCREEN_ORIENTATION_SENSOR_PORTRAIT, + SCREEN_ORIENTATION_SENSOR, + }; + String get_system_dir(SystemDir p_dir) const; String get_data_dir() const; + void set_screen_orientation(ScreenOrientation p_orientation); + ScreenOrientation get_screen_orientation() const; + void set_time_scale(float p_scale); float get_time_scale(); @@ -255,6 +269,7 @@ public: }; VARIANT_ENUM_CAST(_OS::SystemDir); +VARIANT_ENUM_CAST(_OS::ScreenOrientation); class _Geometry : public Object { |