arsa  2.7
SDL_sensor.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any damages
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 
29 #ifndef SDL_sensor_h_
30 #define SDL_sensor_h_
31 
32 #include "SDL_stdinc.h"
33 #include "SDL_error.h"
34 
35 #include "begin_code.h"
36 /* Set up for C function definitions, even when using C++ */
37 #ifdef __cplusplus
38 /* *INDENT-OFF* */
39 extern "C" {
40 /* *INDENT-ON* */
41 #endif
42 
51 struct _SDL_Sensor;
52 typedef struct _SDL_Sensor SDL_Sensor;
53 
61 
62 /* The different sensors defined by SDL
63  *
64  * Additional sensors may be available, using platform dependent semantics.
65  *
66  * Hare are the additional Android sensors:
67  * https://developer.android.com/reference/android/hardware/SensorEvent.html#values
68  */
69 typedef enum
70 {
76 
97 #define SDL_STANDARD_GRAVITY 9.80665f
98 
122 /* Function prototypes */
123 
127 extern DECLSPEC int SDLCALL SDL_NumSensors(void);
128 
136 extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index);
137 
145 extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index);
146 
154 extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index);
155 
164 
172 extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index);
173 
178 
184 extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor);
185 
194 
203 
212 
224 extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values);
225 
229 extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor);
230 
238 extern DECLSPEC void SDLCALL SDL_SensorUpdate(void);
239 
240 
241 /* Ends C function definitions when using C++ */
242 #ifdef __cplusplus
243 /* *INDENT-OFF* */
244 }
245 /* *INDENT-ON* */
246 #endif
247 #include "close_code.h"
248 
249 #endif /* SDL_sensor_h_ */
250 
251 /* vi: set ts=4 sw=4 expandtab: */
DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index)
Get the instance ID of a sensor.
DECLSPEC int SDLCALL SDL_NumSensors(void)
Count the number of sensors attached to the system right now.
DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index)
Get the implementation dependent name of a sensor.
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
#define DECLSPEC
Definition: begin_code.h:74
DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor *sensor, float *data, int num_values)
#define SDLCALL
Definition: begin_code.h:89
DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor)
Get the instance ID of a sensor.
DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index)
Get the platform dependent type of a sensor.
Sint32 SDL_SensorID
Definition: SDL_sensor.h:60
DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id)
DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor)
Get the type of a sensor.
DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor *sensor)
int32_t Sint32
Definition: SDL_stdinc.h:197
DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index)
Open a sensor for use.
SDL_SensorType
Definition: SDL_sensor.h:69
struct _SDL_Sensor SDL_Sensor
Definition: SDL_sensor.h:52
DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor)
Get the implementation dependent name of a sensor.
DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor)
Get the platform dependent type of a sensor.
DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index)
Get the type of a sensor.
DECLSPEC void SDLCALL SDL_SensorUpdate(void)