diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/bind/core_bind.cpp | 10 | ||||
| -rw-r--r-- | core/bind/core_bind.h | 3 | ||||
| -rw-r--r-- | core/os/os.cpp | 9 | ||||
| -rw-r--r-- | core/os/os.h | 5 | ||||
| -rw-r--r-- | core/variant_call.cpp | 2 | ||||
| -rw-r--r-- | core/variant_op.cpp | 4 |
6 files changed, 31 insertions, 2 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 28906354ab..1b4ca8151b 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -199,6 +199,14 @@ int _OS::get_iterations_per_second() const { } +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); @@ -537,6 +545,8 @@ void _OS::_bind_methods() { 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); + ObjectTypeDB::bind_method(_MD("set_target_fps","target_fps"),&_OS::set_target_fps); + ObjectTypeDB::bind_method(_MD("get_target_fps"),&_OS::get_target_fps); ObjectTypeDB::bind_method(_MD("has_touchscreen_ui_hint"),&_OS::has_touchscreen_ui_hint); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 0c80fb3fc4..3d03247c07 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -106,6 +106,9 @@ public: 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; diff --git a/core/os/os.cpp b/core/os/os.cpp index c9a5cb1af8..f678d38f56 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -92,6 +92,14 @@ int OS::get_iterations_per_second() const { return ips; } +void OS::set_target_fps(int p_fps) { + _target_fps=p_fps>0? p_fps : 0; +} + +float OS::get_target_fps() const { + return _target_fps; +} + void OS::set_low_processor_usage_mode(bool p_enabled) { low_processor_usage_mode=p_enabled; @@ -474,6 +482,7 @@ OS::OS() { _exit_code=0; _orientation=SCREEN_LANDSCAPE; _fps=1; + _target_fps=0; _render_thread_mode=RENDER_THREAD_SAFE; Math::seed(1234567); } diff --git a/core/os/os.h b/core/os/os.h index c790b38635..b41bf6ce73 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -54,6 +54,7 @@ class OS { int _exit_code; int _orientation; float _fps; + int _target_fps; char *last_error; @@ -149,8 +150,12 @@ public: virtual void set_iterations_per_second(int p_ips); virtual int get_iterations_per_second() const; + virtual void set_target_fps(int p_fps); + virtual float get_target_fps() const; + virtual float get_frames_per_second() const { return _fps; }; + virtual void set_low_processor_usage_mode(bool p_enabled); virtual bool is_in_low_processor_usage_mode() const; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index be1b0eb3d3..6ab33b7bcc 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -600,6 +600,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var VCALL_PTR0R( Matrix3, determinant ); VCALL_PTR2R( Matrix3, rotated ); VCALL_PTR1R( Matrix3, scaled ); + VCALL_PTR0R( Matrix3, get_scale ); VCALL_PTR0R( Matrix3, get_euler ); VCALL_PTR1R( Matrix3, tdotx ); VCALL_PTR1R( Matrix3, tdoty ); @@ -1390,6 +1391,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl ADDFUNC0(MATRIX3,REAL,Matrix3,determinant,varray()); ADDFUNC2(MATRIX3,MATRIX3,Matrix3,rotated,VECTOR3,"axis",REAL,"phi",varray()); ADDFUNC1(MATRIX3,MATRIX3,Matrix3,scaled,VECTOR3,"scale",varray()); + ADDFUNC0(MATRIX3,VECTOR3,Matrix3,get_scale,varray()); ADDFUNC0(MATRIX3,VECTOR3,Matrix3,get_euler,varray()); ADDFUNC1(MATRIX3,REAL,Matrix3,tdotx,VECTOR3,"with",varray()); ADDFUNC1(MATRIX3,REAL,Matrix3,tdoty,VECTOR3,"with",varray()); diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 50908bbf94..7f46f4c322 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -103,8 +103,8 @@ case m_name: {\ case BOOL: _RETURN( p_a._data.m_type m_op p_b._data._bool);\ case INT: _RETURN( p_a._data.m_type m_op p_b._data._int);\ case REAL: _RETURN( p_a._data.m_type m_op p_b._data._real);\ - case VECTOR2: _RETURN( p_a._data.m_type m_op *reinterpret_cast<const Vector2*>(p_a._data._mem));\ - case VECTOR3: _RETURN( p_a._data.m_type m_op *reinterpret_cast<const Vector3*>(p_a._data._mem));\ + case VECTOR2: _RETURN( p_a._data.m_type m_op *reinterpret_cast<const Vector2*>(p_b._data._mem));\ + case VECTOR3: _RETURN( p_a._data.m_type m_op *reinterpret_cast<const Vector3*>(p_b._data._mem));\ default: {}\ }\ r_valid=false;\ |