From 60c34bff19340d2f31af6612d31efcee0df0993f Mon Sep 17 00:00:00 2001 From: Jonathan De Wachter Date: Sun, 8 Jun 2014 08:12:50 +0200 Subject: [PATCH] [Android] Made the remaining sensors available --- src/SFML/Window/Android/SensorImpl.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/SFML/Window/Android/SensorImpl.cpp b/src/SFML/Window/Android/SensorImpl.cpp index 77810cd8..998825bc 100644 --- a/src/SFML/Window/Android/SensorImpl.cpp +++ b/src/SFML/Window/Android/SensorImpl.cpp @@ -29,6 +29,11 @@ #include #include +// Define missing constants +#define ASENSOR_TYPE_GRAVITY 0x00000009 +#define ASENSOR_TYPE_LINEAR_ACCELERATION 0x0000000a +#define ASENSOR_TYPE_ORIENTATION 0x00000003 + namespace { ALooper* looper; @@ -127,15 +132,10 @@ void SensorImpl::setEnabled(bool enabled) //////////////////////////////////////////////////////////// ASensor const* SensorImpl::getDefaultSensor(Sensor::Type sensor) { - // These sensors are unavailable from the Android C API - if ((sensor == Sensor::Gravity) || - (sensor == Sensor::UserAcceleration) || - (sensor == Sensor::Orientation)) - return NULL; - // Find the Android sensor type - static int types[] = {ASENSOR_TYPE_ACCELEROMETER, - ASENSOR_TYPE_GYROSCOPE, ASENSOR_TYPE_MAGNETIC_FIELD}; + static int types[] = {ASENSOR_TYPE_ACCELEROMETER, ASENSOR_TYPE_GYROSCOPE, + ASENSOR_TYPE_MAGNETIC_FIELD, ASENSOR_TYPE_GRAVITY, ASENSOR_TYPE_LINEAR_ACCELERATION, + ASENSOR_TYPE_ORIENTATION}; int type = types[sensor];