diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/input_default.cpp | 14 | ||||
-rw-r--r-- | main/input_default.h | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp index c8b8062eee..5b4ae7f2cb 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -200,6 +200,12 @@ Vector3 InputDefault::get_accelerometer() { return accelerometer; } +Vector3 InputDefault::get_magnetometer() { + + _THREAD_SAFE_METHOD_ + return magnetometer; +} + void InputDefault::parse_input_event(const InputEvent& p_event) { _THREAD_SAFE_METHOD_ @@ -296,6 +302,14 @@ void InputDefault::set_accelerometer(const Vector3& p_accel) { } +void InputDefault::set_magnetometer(const Vector3& p_magnetometer) { + + _THREAD_SAFE_METHOD_ + + magnetometer=p_magnetometer; + +} + void InputDefault::set_main_loop(MainLoop *p_main_loop) { main_loop=p_main_loop; diff --git a/main/input_default.h b/main/input_default.h index 471ae9e692..8f6a430436 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -14,6 +14,7 @@ class InputDefault : public Input { Map<int,float> _joy_axis; Map<StringName,int> custom_action_press; Vector3 accelerometer; + Vector3 magnetometer; Vector2 mouse_pos; MainLoop *main_loop; @@ -132,6 +133,7 @@ public: void parse_joystick_mapping(String p_mapping, bool p_update_existing); virtual Vector3 get_accelerometer(); + virtual Vector3 get_magnetometer(); virtual Point2 get_mouse_pos() const; virtual Point2 get_mouse_speed() const; @@ -142,6 +144,7 @@ public: void parse_input_event(const InputEvent& p_event); void set_accelerometer(const Vector3& p_accel); + void set_magnetometer(const Vector3& p_magnetometer); void set_joy_axis(int p_device,int p_axis,float p_value); void set_main_loop(MainLoop *main_loop); |