mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-21 18:58:13 +00:00
Added SDL_GetDisplayOrientation() to get the display orientation, and added a new event SDL_DISPLAYEVENT to notify the application when the orientation changes.
Documented the values returned by the accelerometer and gyroscope sensors
This commit is contained in:
@@ -32,8 +32,6 @@
|
||||
#include "../SDL_syssensor.h"
|
||||
#include "../SDL_sensor_c.h"
|
||||
|
||||
#define STANDARD_GRAVITY 9.80665f
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SDL_SensorType type;
|
||||
@@ -160,9 +158,9 @@ SDL_COREMOTION_SensorUpdate(SDL_Sensor *sensor)
|
||||
if (accelerometerData) {
|
||||
CMAcceleration acceleration = accelerometerData.acceleration;
|
||||
float data[3];
|
||||
data[0] = acceleration.x * STANDARD_GRAVITY;
|
||||
data[1] = acceleration.y * STANDARD_GRAVITY;
|
||||
data[2] = acceleration.z * STANDARD_GRAVITY;
|
||||
data[0] = acceleration.x * SDL_STANDARD_GRAVITY;
|
||||
data[1] = acceleration.y * SDL_STANDARD_GRAVITY;
|
||||
data[2] = acceleration.z * SDL_STANDARD_GRAVITY;
|
||||
if (SDL_memcmp(data, sensor->hwdata->data, sizeof(data)) != 0) {
|
||||
SDL_PrivateSensorUpdate(sensor, data, SDL_arraysize(data));
|
||||
SDL_memcpy(sensor->hwdata->data, data, sizeof(data));
|
||||
|
Reference in New Issue
Block a user