World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
SDL_sensor.h
См. документацию.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2020 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 
163 extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index);
164 
172 extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index);
173 
177 extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id);
178 
184 extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor);
185 
193 extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor);
194 
202 extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor);
203 
211 extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor);
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: */
Sint32
int32_t Sint32
Definition: SDL_stdinc.h:197
SDL_SensorUpdate
DECLSPEC void SDLCALL SDL_SensorUpdate(void)
SDL_SensorGetDeviceType
DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index)
Get the type of a sensor.
SDL_SENSOR_UNKNOWN
@ SDL_SENSOR_UNKNOWN
Definition: SDL_sensor.h:72
SDL_error.h
SDL_SensorGetInstanceID
DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor)
Get the instance ID of a sensor.
SDL_SensorGetDeviceInstanceID
DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index)
Get the instance ID of a sensor.
close_code.h
SDL_SensorGetNonPortableType
DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor)
Get the platform dependent type of a sensor.
begin_code.h
SDL_SensorFromInstanceID
DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id)
SDL_SENSOR_GYRO
@ SDL_SENSOR_GYRO
Definition: SDL_sensor.h:74
SDL_SensorType
SDL_SensorType
Definition: SDL_sensor.h:69
SDL_SensorGetName
const DECLSPEC char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor)
Get the implementation dependent name of a sensor.
SDL_SensorClose
DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor *sensor)
SDL_SENSOR_INVALID
@ SDL_SENSOR_INVALID
Definition: SDL_sensor.h:71
SDL_SensorGetDeviceNonPortableType
DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index)
Get the platform dependent type of a sensor.
SDL_NumSensors
DECLSPEC int SDLCALL SDL_NumSensors(void)
Count the number of sensors attached to the system right now.
SDL_SensorGetType
DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor)
Get the type of a sensor.
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
SDL_stdinc.h
SDL_SensorOpen
DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index)
Open a sensor for use.
SDL_SensorGetDeviceName
const DECLSPEC char *SDLCALL SDL_SensorGetDeviceName(int device_index)
Get the implementation dependent name of a sensor.
SDL_SENSOR_ACCEL
@ SDL_SENSOR_ACCEL
Definition: SDL_sensor.h:73
SDL_Sensor
struct _SDL_Sensor SDL_Sensor
Definition: SDL_sensor.h:52
SDL_SensorGetData
DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor *sensor, float *data, int num_values)
SDL_SensorID
Sint32 SDL_SensorID
Definition: SDL_sensor.h:60