2018-08-21 22:11:34 +03:00
|
|
|
/*
|
|
|
|
Simple DirectMedia Layer
|
2024-01-02 00:15:26 +03:00
|
|
|
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
2018-08-21 22:11:34 +03:00
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied
|
|
|
|
warranty. In no event will the authors be held liable for any damages
|
|
|
|
arising from the use of this software.
|
|
|
|
|
|
|
|
Permission is granted to anyone to use this software for any purpose,
|
|
|
|
including commercial applications, and to alter it and redistribute it
|
|
|
|
freely, subject to the following restrictions:
|
|
|
|
|
|
|
|
1. The origin of this software must not be misrepresented; you must not
|
|
|
|
claim that you wrote the original software. If you use this software
|
|
|
|
in a product, an acknowledgment in the product documentation would be
|
|
|
|
appreciated but is not required.
|
|
|
|
2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
misrepresented as being the original software.
|
|
|
|
3. This notice may not be removed or altered from any source distribution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2024-05-16 17:44:37 +03:00
|
|
|
* # CategorySensor
|
2018-08-21 22:11:34 +03:00
|
|
|
*
|
2024-05-16 17:44:37 +03:00
|
|
|
* SDL sensor management.
|
2018-08-21 22:11:34 +03:00
|
|
|
*/
|
|
|
|
|
2018-12-10 15:32:24 +03:00
|
|
|
#ifndef SDL_sensor_h_
|
|
|
|
#define SDL_sensor_h_
|
2018-08-21 22:11:34 +03:00
|
|
|
|
2022-11-27 07:43:38 +03:00
|
|
|
#include <SDL3/SDL_stdinc.h>
|
|
|
|
#include <SDL3/SDL_error.h>
|
2023-10-12 02:59:51 +03:00
|
|
|
#include <SDL3/SDL_properties.h>
|
2018-08-21 22:11:34 +03:00
|
|
|
|
2022-12-22 19:38:59 +03:00
|
|
|
#include <SDL3/SDL_begin_code.h>
|
2018-08-21 22:11:34 +03:00
|
|
|
/* Set up for C function definitions, even when using C++ */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
/* *INDENT-OFF* */
|
|
|
|
extern "C" {
|
|
|
|
/* *INDENT-ON* */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2023-11-06 18:26:06 +03:00
|
|
|
* SDL_sensor.h
|
2018-08-21 22:11:34 +03:00
|
|
|
*
|
|
|
|
* In order to use these functions, SDL_Init() must have been called
|
2024-05-16 19:16:57 +03:00
|
|
|
* with the SDL_INIT_SENSOR flag. This causes SDL to scan the system
|
2018-08-21 22:11:34 +03:00
|
|
|
* for sensors, and load appropriate drivers.
|
|
|
|
*/
|
|
|
|
|
2022-12-27 21:35:53 +03:00
|
|
|
struct SDL_Sensor;
|
|
|
|
typedef struct SDL_Sensor SDL_Sensor;
|
2018-08-21 22:11:34 +03:00
|
|
|
|
|
|
|
/**
|
2024-04-11 15:59:41 +03:00
|
|
|
* This is a unique ID for a sensor for the time it is connected to the
|
|
|
|
* system, and is never reused for the lifetime of the application.
|
2018-08-21 22:11:34 +03:00
|
|
|
*
|
2024-04-11 15:59:41 +03:00
|
|
|
* The ID value starts at 1 and increments from there. The value 0 is an
|
|
|
|
* invalid ID.
|
2024-04-11 20:34:29 +03:00
|
|
|
*
|
|
|
|
* \since This datatype is available since SDL 3.0.0.
|
2018-08-21 22:11:34 +03:00
|
|
|
*/
|
2022-12-28 05:10:06 +03:00
|
|
|
typedef Uint32 SDL_SensorID;
|
2018-08-21 22:11:34 +03:00
|
|
|
|
2024-04-12 00:56:51 +03:00
|
|
|
/**
|
2024-04-16 20:29:26 +03:00
|
|
|
* A constant to represent standard gravity for accelerometer sensors.
|
2018-08-23 20:51:54 +03:00
|
|
|
*
|
2024-04-16 20:29:26 +03:00
|
|
|
* The accelerometer returns the current acceleration in SI meters per second
|
|
|
|
* squared. This measurement includes the force of gravity, so a device at
|
|
|
|
* rest will have an value of SDL_STANDARD_GRAVITY away from the center of the
|
|
|
|
* earth, which is a positive Y value.
|
2018-08-23 20:51:54 +03:00
|
|
|
*
|
2024-04-16 20:29:26 +03:00
|
|
|
* \since This macro is available since SDL 3.0.0.
|
2018-08-23 20:51:54 +03:00
|
|
|
*/
|
2024-04-16 20:29:26 +03:00
|
|
|
#define SDL_STANDARD_GRAVITY 9.80665f
|
2018-08-21 22:11:34 +03:00
|
|
|
|
2018-08-23 07:48:28 +03:00
|
|
|
/**
|
2024-04-16 20:29:26 +03:00
|
|
|
* The different sensors defined by SDL.
|
|
|
|
*
|
|
|
|
* Additional sensors may be available, using platform dependent semantics.
|
|
|
|
*
|
2024-04-23 21:37:44 +03:00
|
|
|
* Here are the additional Android sensors:
|
|
|
|
*
|
2024-04-16 20:29:26 +03:00
|
|
|
* https://developer.android.com/reference/android/hardware/SensorEvent.html#values
|
|
|
|
*
|
|
|
|
* Accelerometer sensor notes:
|
2018-08-23 07:48:28 +03:00
|
|
|
*
|
2024-04-09 07:49:23 +03:00
|
|
|
* The accelerometer returns the current acceleration in SI meters per second
|
|
|
|
* squared. This measurement includes the force of gravity, so a device at
|
|
|
|
* rest will have an value of SDL_STANDARD_GRAVITY away from the center of the
|
|
|
|
* earth, which is a positive Y value.
|
2018-08-23 07:48:28 +03:00
|
|
|
*
|
2024-04-16 20:29:26 +03:00
|
|
|
* - `values[0]`: Acceleration on the x axis
|
|
|
|
* - `values[1]`: Acceleration on the y axis
|
|
|
|
* - `values[2]`: Acceleration on the z axis
|
2018-08-23 07:48:28 +03:00
|
|
|
*
|
2024-04-09 07:49:23 +03:00
|
|
|
* For phones and tablets held in natural orientation and game controllers
|
|
|
|
* held in front of you, the axes are defined as follows:
|
2024-04-09 05:36:57 +03:00
|
|
|
*
|
|
|
|
* - -X ... +X : left ... right
|
|
|
|
* - -Y ... +Y : bottom ... top
|
|
|
|
* - -Z ... +Z : farther ... closer
|
2022-12-28 05:10:06 +03:00
|
|
|
*
|
2024-04-16 20:29:26 +03:00
|
|
|
* The accelerometer axis data is not changed when the device is rotated.
|
2024-04-11 20:34:29 +03:00
|
|
|
*
|
2024-04-16 20:29:26 +03:00
|
|
|
* Gyroscope sensor notes:
|
2018-08-23 07:48:28 +03:00
|
|
|
*
|
|
|
|
* The gyroscope returns the current rate of rotation in radians per second.
|
2024-04-16 20:30:27 +03:00
|
|
|
* The rotation is positive in the counter-clockwise direction. That is, an
|
|
|
|
* observer looking from a positive location on one of the axes would see
|
|
|
|
* positive rotation on that axis when it appeared to be rotating
|
2018-08-23 07:48:28 +03:00
|
|
|
* counter-clockwise.
|
|
|
|
*
|
2024-04-16 20:29:26 +03:00
|
|
|
* - `values[0]`: Angular speed around the x axis (pitch)
|
|
|
|
* - `values[1]`: Angular speed around the y axis (yaw)
|
|
|
|
* - `values[2]`: Angular speed around the z axis (roll)
|
2018-08-23 07:48:28 +03:00
|
|
|
*
|
2024-04-16 20:30:27 +03:00
|
|
|
* For phones and tablets held in natural orientation and game controllers
|
|
|
|
* held in front of you, the axes are defined as follows:
|
2024-04-09 05:36:57 +03:00
|
|
|
*
|
|
|
|
* - -X ... +X : left ... right
|
|
|
|
* - -Y ... +Y : bottom ... top
|
|
|
|
* - -Z ... +Z : farther ... closer
|
2022-12-28 05:10:06 +03:00
|
|
|
*
|
2024-04-16 20:29:26 +03:00
|
|
|
* The gyroscope axis data is not changed when the device is rotated.
|
2018-08-23 07:48:28 +03:00
|
|
|
*
|
2024-04-16 20:29:26 +03:00
|
|
|
* \since This enum is available since SDL 3.0.0.
|
|
|
|
*
|
|
|
|
* \sa SDL_GetCurrentDisplayOrientation
|
2018-08-23 07:48:28 +03:00
|
|
|
*/
|
2024-04-16 20:29:26 +03:00
|
|
|
typedef enum SDL_SensorType
|
|
|
|
{
|
|
|
|
SDL_SENSOR_INVALID = -1, /**< Returned for an invalid sensor */
|
|
|
|
SDL_SENSOR_UNKNOWN, /**< Unknown sensor type */
|
|
|
|
SDL_SENSOR_ACCEL, /**< Accelerometer */
|
|
|
|
SDL_SENSOR_GYRO, /**< Gyroscope */
|
|
|
|
SDL_SENSOR_ACCEL_L, /**< Accelerometer for left Joy-Con controller and Wii nunchuk */
|
|
|
|
SDL_SENSOR_GYRO_L, /**< Gyroscope for left Joy-Con controller */
|
|
|
|
SDL_SENSOR_ACCEL_R, /**< Accelerometer for right Joy-Con controller */
|
|
|
|
SDL_SENSOR_GYRO_R /**< Gyroscope for right Joy-Con controller */
|
|
|
|
} SDL_SensorType;
|
|
|
|
|
2018-08-23 07:48:28 +03:00
|
|
|
|
2018-08-21 22:11:34 +03:00
|
|
|
/* Function prototypes */
|
|
|
|
|
|
|
|
/**
|
2022-12-28 05:10:06 +03:00
|
|
|
* Get a list of currently connected sensors.
|
2021-03-21 21:18:39 +03:00
|
|
|
*
|
2024-07-19 22:23:24 +03:00
|
|
|
* \param count a pointer filled in with the number of sensors returned, may
|
|
|
|
* be NULL.
|
|
|
|
* \returns a 0 terminated array of sensor instance IDs or NULL on failure;
|
|
|
|
* call SDL_GetError() for more information.
|
2021-10-27 04:36:05 +03:00
|
|
|
*
|
2022-11-23 01:40:14 +03:00
|
|
|
* \since This function is available since SDL 3.0.0.
|
2018-08-21 22:11:34 +03:00
|
|
|
*/
|
2024-07-19 08:10:29 +03:00
|
|
|
extern SDL_DECLSPEC const SDL_SensorID * SDLCALL SDL_GetSensors(int *count);
|
2018-08-21 22:11:34 +03:00
|
|
|
|
|
|
|
/**
|
2021-03-21 21:18:39 +03:00
|
|
|
* Get the implementation dependent name of a sensor.
|
2018-08-21 22:11:34 +03:00
|
|
|
*
|
2024-07-14 18:46:24 +03:00
|
|
|
* This can be called before any sensors are opened.
|
|
|
|
*
|
2024-07-19 22:23:24 +03:00
|
|
|
* This returns temporary memory which will be automatically freed later, and
|
|
|
|
* can be claimed with SDL_ClaimTemporaryMemory().
|
2024-06-02 05:05:21 +03:00
|
|
|
*
|
2024-06-14 09:09:55 +03:00
|
|
|
* \param instance_id the sensor instance ID.
|
|
|
|
* \returns the sensor name, or NULL if `instance_id` is not valid.
|
2021-10-27 04:36:05 +03:00
|
|
|
*
|
2022-11-23 01:40:14 +03:00
|
|
|
* \since This function is available since SDL 3.0.0.
|
2018-08-21 22:11:34 +03:00
|
|
|
*/
|
Standardize placement of '*' in function declarations
Implemented using these sed commands on the headers:
sed -E -i'' '/SDLCALL|;/ s,([a-z])\* ,\1 *,g' *
sed -E -i'' 's,(\(.*[^\*])\* ([a-z])(.*\)),\1*\2\3,g' *
sed -E -i'' 's,\*const,* const,g' *
sed -E -i'' 's,\*SDLCALL,* SDLCALL,g' *
sed -E -i'' 's,void\(,void (,g' *
git checkout *gl*
2024-07-18 18:54:50 +03:00
|
|
|
extern SDL_DECLSPEC const char * SDLCALL SDL_GetSensorNameForID(SDL_SensorID instance_id);
|
2018-08-21 22:11:34 +03:00
|
|
|
|
|
|
|
/**
|
2021-03-21 21:18:39 +03:00
|
|
|
* Get the type of a sensor.
|
2018-08-21 22:11:34 +03:00
|
|
|
*
|
2024-07-14 18:46:24 +03:00
|
|
|
* This can be called before any sensors are opened.
|
|
|
|
*
|
2024-06-14 09:09:55 +03:00
|
|
|
* \param instance_id the sensor instance ID.
|
2023-01-25 20:58:29 +03:00
|
|
|
* \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `instance_id` is
|
2024-06-14 09:09:55 +03:00
|
|
|
* not valid.
|
2021-10-27 04:36:05 +03:00
|
|
|
*
|
2022-11-23 01:40:14 +03:00
|
|
|
* \since This function is available since SDL 3.0.0.
|
2018-08-21 22:11:34 +03:00
|
|
|
*/
|
2024-07-15 01:22:03 +03:00
|
|
|
extern SDL_DECLSPEC SDL_SensorType SDLCALL SDL_GetSensorTypeForID(SDL_SensorID instance_id);
|
2018-08-21 22:11:34 +03:00
|
|
|
|
|
|
|
/**
|
2021-03-21 21:18:39 +03:00
|
|
|
* Get the platform dependent type of a sensor.
|
2018-08-21 22:11:34 +03:00
|
|
|
*
|
2024-07-14 18:46:24 +03:00
|
|
|
* This can be called before any sensors are opened.
|
|
|
|
*
|
2024-06-14 09:09:55 +03:00
|
|
|
* \param instance_id the sensor instance ID.
|
2023-01-25 20:58:29 +03:00
|
|
|
* \returns the sensor platform dependent type, or -1 if `instance_id` is not
|
2024-06-14 09:09:55 +03:00
|
|
|
* valid.
|
2021-10-27 04:36:05 +03:00
|
|
|
*
|
2022-11-23 01:40:14 +03:00
|
|
|
* \since This function is available since SDL 3.0.0.
|
2018-08-21 22:11:34 +03:00
|
|
|
*/
|
2024-07-15 01:22:03 +03:00
|
|
|
extern SDL_DECLSPEC int SDLCALL SDL_GetSensorNonPortableTypeForID(SDL_SensorID instance_id);
|
2018-08-21 22:11:34 +03:00
|
|
|
|
|
|
|
/**
|
2021-03-21 21:18:39 +03:00
|
|
|
* Open a sensor for use.
|
2018-08-21 22:11:34 +03:00
|
|
|
*
|
2024-06-14 09:09:55 +03:00
|
|
|
* \param instance_id the sensor instance ID.
|
2024-07-19 22:23:24 +03:00
|
|
|
* \returns an SDL_Sensor object or NULL on failure; call SDL_GetError() for
|
|
|
|
* more information.
|
2021-10-27 04:36:05 +03:00
|
|
|
*
|
2022-11-23 01:40:14 +03:00
|
|
|
* \since This function is available since SDL 3.0.0.
|
2018-08-21 22:11:34 +03:00
|
|
|
*/
|
Standardize placement of '*' in function declarations
Implemented using these sed commands on the headers:
sed -E -i'' '/SDLCALL|;/ s,([a-z])\* ,\1 *,g' *
sed -E -i'' 's,(\(.*[^\*])\* ([a-z])(.*\)),\1*\2\3,g' *
sed -E -i'' 's,\*const,* const,g' *
sed -E -i'' 's,\*SDLCALL,* SDLCALL,g' *
sed -E -i'' 's,void\(,void (,g' *
git checkout *gl*
2024-07-18 18:54:50 +03:00
|
|
|
extern SDL_DECLSPEC SDL_Sensor * SDLCALL SDL_OpenSensor(SDL_SensorID instance_id);
|
2018-08-21 22:11:34 +03:00
|
|
|
|
|
|
|
/**
|
2022-12-28 05:10:06 +03:00
|
|
|
* Return the SDL_Sensor associated with an instance ID.
|
2021-03-21 21:18:39 +03:00
|
|
|
*
|
2024-06-14 09:09:55 +03:00
|
|
|
* \param instance_id the sensor instance ID.
|
2024-07-19 22:23:24 +03:00
|
|
|
* \returns an SDL_Sensor object or NULL on failure; call SDL_GetError() for
|
|
|
|
* more information.
|
2021-10-27 04:36:05 +03:00
|
|
|
*
|
2022-11-23 01:40:14 +03:00
|
|
|
* \since This function is available since SDL 3.0.0.
|
2018-08-21 22:11:34 +03:00
|
|
|
*/
|
Standardize placement of '*' in function declarations
Implemented using these sed commands on the headers:
sed -E -i'' '/SDLCALL|;/ s,([a-z])\* ,\1 *,g' *
sed -E -i'' 's,(\(.*[^\*])\* ([a-z])(.*\)),\1*\2\3,g' *
sed -E -i'' 's,\*const,* const,g' *
sed -E -i'' 's,\*SDLCALL,* SDLCALL,g' *
sed -E -i'' 's,void\(,void (,g' *
git checkout *gl*
2024-07-18 18:54:50 +03:00
|
|
|
extern SDL_DECLSPEC SDL_Sensor * SDLCALL SDL_GetSensorFromID(SDL_SensorID instance_id);
|
2018-08-21 22:11:34 +03:00
|
|
|
|
2023-10-12 02:59:51 +03:00
|
|
|
/**
|
|
|
|
* Get the properties associated with a sensor.
|
|
|
|
*
|
2024-06-14 09:09:55 +03:00
|
|
|
* \param sensor the SDL_Sensor object.
|
2023-10-12 22:20:53 +03:00
|
|
|
* \returns a valid property ID on success or 0 on failure; call
|
|
|
|
* SDL_GetError() for more information.
|
2023-10-12 02:59:51 +03:00
|
|
|
*
|
|
|
|
* \since This function is available since SDL 3.0.0.
|
|
|
|
*/
|
2024-05-18 02:52:36 +03:00
|
|
|
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSensorProperties(SDL_Sensor *sensor);
|
2023-10-12 02:59:51 +03:00
|
|
|
|
2018-08-21 22:11:34 +03:00
|
|
|
/**
|
2024-04-09 05:36:57 +03:00
|
|
|
* Get the implementation dependent name of a sensor.
|
2018-08-21 22:11:34 +03:00
|
|
|
*
|
2024-07-19 22:23:24 +03:00
|
|
|
* This returns temporary memory which will be automatically freed later, and
|
|
|
|
* can be claimed with SDL_ClaimTemporaryMemory().
|
2024-06-02 05:05:21 +03:00
|
|
|
*
|
2024-06-14 09:09:55 +03:00
|
|
|
* \param sensor the SDL_Sensor object.
|
2024-07-19 22:23:24 +03:00
|
|
|
* \returns the sensor name or NULL on failure; call SDL_GetError() for more
|
|
|
|
* information.
|
2021-10-27 04:36:05 +03:00
|
|
|
*
|
2022-11-23 01:40:14 +03:00
|
|
|
* \since This function is available since SDL 3.0.0.
|
2018-08-21 22:11:34 +03:00
|
|
|
*/
|
Standardize placement of '*' in function declarations
Implemented using these sed commands on the headers:
sed -E -i'' '/SDLCALL|;/ s,([a-z])\* ,\1 *,g' *
sed -E -i'' 's,(\(.*[^\*])\* ([a-z])(.*\)),\1*\2\3,g' *
sed -E -i'' 's,\*const,* const,g' *
sed -E -i'' 's,\*SDLCALL,* SDLCALL,g' *
sed -E -i'' 's,void\(,void (,g' *
git checkout *gl*
2024-07-18 18:54:50 +03:00
|
|
|
extern SDL_DECLSPEC const char * SDLCALL SDL_GetSensorName(SDL_Sensor *sensor);
|
2018-08-21 22:11:34 +03:00
|
|
|
|
|
|
|
/**
|
2021-03-21 21:18:39 +03:00
|
|
|
* Get the type of a sensor.
|
2018-08-21 22:11:34 +03:00
|
|
|
*
|
2024-06-14 09:09:55 +03:00
|
|
|
* \param sensor the SDL_Sensor object to inspect.
|
2021-07-14 21:15:30 +03:00
|
|
|
* \returns the SDL_SensorType type, or `SDL_SENSOR_INVALID` if `sensor` is
|
2021-03-21 21:18:39 +03:00
|
|
|
* NULL.
|
2021-10-27 04:36:05 +03:00
|
|
|
*
|
2022-11-23 01:40:14 +03:00
|
|
|
* \since This function is available since SDL 3.0.0.
|
2018-08-21 22:11:34 +03:00
|
|
|
*/
|
2024-05-18 02:52:36 +03:00
|
|
|
extern SDL_DECLSPEC SDL_SensorType SDLCALL SDL_GetSensorType(SDL_Sensor *sensor);
|
2018-08-21 22:11:34 +03:00
|
|
|
|
|
|
|
/**
|
2021-03-21 21:18:39 +03:00
|
|
|
* Get the platform dependent type of a sensor.
|
2018-08-21 22:11:34 +03:00
|
|
|
*
|
2024-06-14 09:09:55 +03:00
|
|
|
* \param sensor the SDL_Sensor object to inspect.
|
2021-07-14 21:15:30 +03:00
|
|
|
* \returns the sensor platform dependent type, or -1 if `sensor` is NULL.
|
2021-10-27 04:36:05 +03:00
|
|
|
*
|
2022-11-23 01:40:14 +03:00
|
|
|
* \since This function is available since SDL 3.0.0.
|
2018-08-21 22:11:34 +03:00
|
|
|
*/
|
2024-05-18 02:52:36 +03:00
|
|
|
extern SDL_DECLSPEC int SDLCALL SDL_GetSensorNonPortableType(SDL_Sensor *sensor);
|
2018-08-21 22:11:34 +03:00
|
|
|
|
|
|
|
/**
|
2021-03-21 21:18:39 +03:00
|
|
|
* Get the instance ID of a sensor.
|
2018-08-21 22:11:34 +03:00
|
|
|
*
|
2024-06-14 09:09:55 +03:00
|
|
|
* \param sensor the SDL_Sensor object to inspect.
|
2024-07-19 22:23:24 +03:00
|
|
|
* \returns the sensor instance ID, or 0 on failure; call SDL_GetError() for
|
|
|
|
* more information.
|
2021-10-27 04:36:05 +03:00
|
|
|
*
|
2022-11-23 01:40:14 +03:00
|
|
|
* \since This function is available since SDL 3.0.0.
|
2018-08-21 22:11:34 +03:00
|
|
|
*/
|
2024-07-14 18:46:24 +03:00
|
|
|
extern SDL_DECLSPEC SDL_SensorID SDLCALL SDL_GetSensorID(SDL_Sensor *sensor);
|
2018-08-21 22:11:34 +03:00
|
|
|
|
|
|
|
/**
|
2021-03-21 21:18:39 +03:00
|
|
|
* Get the current state of an opened sensor.
|
2018-08-21 22:11:34 +03:00
|
|
|
*
|
2021-07-15 00:07:04 +03:00
|
|
|
* The number of values and interpretation of the data is sensor dependent.
|
2018-08-21 22:11:34 +03:00
|
|
|
*
|
2024-06-14 09:09:55 +03:00
|
|
|
* \param sensor the SDL_Sensor object to query.
|
|
|
|
* \param data a pointer filled with the current sensor state.
|
|
|
|
* \param num_values the number of values to write to data.
|
2023-02-12 12:09:42 +03:00
|
|
|
* \returns 0 on success or a negative error code on failure; call
|
|
|
|
* SDL_GetError() for more information.
|
2021-10-27 04:36:05 +03:00
|
|
|
*
|
2022-11-23 01:40:14 +03:00
|
|
|
* \since This function is available since SDL 3.0.0.
|
2018-08-21 22:11:34 +03:00
|
|
|
*/
|
2024-05-18 02:52:36 +03:00
|
|
|
extern SDL_DECLSPEC int SDLCALL SDL_GetSensorData(SDL_Sensor *sensor, float *data, int num_values);
|
2022-09-27 19:56:02 +03:00
|
|
|
|
2018-08-21 22:11:34 +03:00
|
|
|
/**
|
2022-12-27 17:23:39 +03:00
|
|
|
* Close a sensor previously opened with SDL_OpenSensor().
|
2021-03-21 21:18:39 +03:00
|
|
|
*
|
2024-06-14 09:09:55 +03:00
|
|
|
* \param sensor the SDL_Sensor object to close.
|
2021-10-27 04:36:05 +03:00
|
|
|
*
|
2022-11-23 01:40:14 +03:00
|
|
|
* \since This function is available since SDL 3.0.0.
|
2018-08-21 22:11:34 +03:00
|
|
|
*/
|
2024-05-18 02:52:36 +03:00
|
|
|
extern SDL_DECLSPEC void SDLCALL SDL_CloseSensor(SDL_Sensor *sensor);
|
2018-08-21 22:11:34 +03:00
|
|
|
|
|
|
|
/**
|
2021-03-21 21:18:39 +03:00
|
|
|
* Update the current state of the open sensors.
|
2018-08-21 22:11:34 +03:00
|
|
|
*
|
2021-03-21 21:18:39 +03:00
|
|
|
* This is called automatically by the event loop if sensor events are
|
|
|
|
* enabled.
|
2018-08-21 22:11:34 +03:00
|
|
|
*
|
2021-03-21 21:18:39 +03:00
|
|
|
* This needs to be called from the thread that initialized the sensor
|
|
|
|
* subsystem.
|
2021-10-27 04:36:05 +03:00
|
|
|
*
|
2022-11-23 01:40:14 +03:00
|
|
|
* \since This function is available since SDL 3.0.0.
|
2018-08-21 22:11:34 +03:00
|
|
|
*/
|
2024-05-18 02:52:36 +03:00
|
|
|
extern SDL_DECLSPEC void SDLCALL SDL_UpdateSensors(void);
|
2018-08-21 22:11:34 +03:00
|
|
|
|
|
|
|
|
|
|
|
/* Ends C function definitions when using C++ */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
/* *INDENT-OFF* */
|
|
|
|
}
|
|
|
|
/* *INDENT-ON* */
|
|
|
|
#endif
|
2022-12-22 19:38:59 +03:00
|
|
|
#include <SDL3/SDL_close_code.h>
|
2018-08-21 22:11:34 +03:00
|
|
|
|
2018-12-10 15:32:24 +03:00
|
|
|
#endif /* SDL_sensor_h_ */
|