summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-01-15 00:08:46 +0100
committerGitHub <noreply@github.com>2017-01-15 00:08:46 +0100
commitd4eb8ec884c0519dc02de4451e249f6f5cca962a (patch)
treef0fe3497f7bbba49de5e938000ca463101b6c50c /main
parentdab73c701a9785be443977a613e57600d1e136c8 (diff)
parent5e4dcb3b7f93cfe19a5c12700df5a7c82045f37c (diff)
Merge pull request #7127 from BastiaanOlij/ios_meters
Core motion implementation for iPhone (Accelerometer/Gyro/Magnetometer support)
Diffstat (limited to 'main')
-rw-r--r--main/input_default.cpp14
-rw-r--r--main/input_default.h3
2 files changed, 17 insertions, 0 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 50b0006438..a7d06dbdbe 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -277,6 +277,12 @@ void InputDefault::joy_connection_changed(int p_idx, bool p_connected, String p_
emit_signal("joy_connection_changed", p_idx, p_connected);
};
+Vector3 InputDefault::get_gravity() const{
+
+ _THREAD_SAFE_METHOD_
+ return gravity;
+}
+
Vector3 InputDefault::get_accelerometer() const{
_THREAD_SAFE_METHOD_
@@ -423,6 +429,14 @@ void InputDefault::stop_joy_vibration(int p_device) {
joy_vibration[p_device] = vibration;
}
+void InputDefault::set_gravity(const Vector3& p_gravity) {
+
+ _THREAD_SAFE_METHOD_
+
+ gravity=p_gravity;
+
+}
+
void InputDefault::set_accelerometer(const Vector3& p_accel) {
_THREAD_SAFE_METHOD_
diff --git a/main/input_default.h b/main/input_default.h
index cab505644d..3e41c494c1 100644
--- a/main/input_default.h
+++ b/main/input_default.h
@@ -44,6 +44,7 @@ class InputDefault : public Input {
Set<int> joy_buttons_pressed;
Map<int,float> _joy_axis;
//Map<StringName,int> custom_action_press;
+ Vector3 gravity;
Vector3 accelerometer;
Vector3 magnetometer;
Vector3 gyroscope;
@@ -191,6 +192,7 @@ public:
void joy_connection_changed(int p_idx, bool p_connected, String p_name, String p_guid = "");
void parse_joypad_mapping(String p_mapping, bool p_update_existing);
+ virtual Vector3 get_gravity() const;
virtual Vector3 get_accelerometer() const;
virtual Vector3 get_magnetometer() const;
virtual Vector3 get_gyroscope() const;
@@ -203,6 +205,7 @@ public:
void parse_input_event(const InputEvent& p_event);
+ void set_gravity(const Vector3& p_gravity);
void set_accelerometer(const Vector3& p_accel);
void set_magnetometer(const Vector3& p_magnetometer);
void set_gyroscope(const Vector3& p_gyroscope);