mirror of https://github.com/libsdl-org/SDL
SDL API renaming: SDL_sensor.h
Fixes https://github.com/libsdl-org/SDL/issues/6888
This commit is contained in:
parent
0d54115235
commit
2db699f48e
14
WhatsNew.txt
14
WhatsNew.txt
|
@ -79,6 +79,7 @@ General:
|
|||
* SDL_MasksToPixelFormatEnum => SDL_GetPixelFormatEnumForMasks
|
||||
* SDL_NewAudioStream => SDL_CreateAudioStream
|
||||
* SDL_NumJoysticks => SDL_GetNumJoysticks
|
||||
* SDL_NumSensors => SDL_GetNumSensors
|
||||
* SDL_PixelFormatEnumToMasks => SDL_GetMasksForPixelFormatEnum
|
||||
* SDL_RenderCopy => SDL_RenderTexture
|
||||
* SDL_RenderCopyEx => SDL_RenderTextureRotated
|
||||
|
@ -112,6 +113,19 @@ General:
|
|||
* SDL_RenderSetVSync => SDL_SetRenderVSync
|
||||
* SDL_RenderSetViewport => SDL_SetRenderViewport
|
||||
* SDL_RenderTargetSupported => SDL_IsRenderTargetSupported
|
||||
* SDL_SensorClose => SDL_CloseSensor
|
||||
* SDL_SensorFromInstanceID => SDL_GetSensorFromInstanceID
|
||||
* SDL_SensorGetData => SDL_GetSensorData
|
||||
* SDL_SensorGetDeviceInstanceID => SDL_GetSensorDeviceInstanceID
|
||||
* SDL_SensorGetDeviceName => SDL_GetSensorDeviceName
|
||||
* SDL_SensorGetDeviceNonPortableType => SDL_GetSensorDeviceNonPortableType
|
||||
* SDL_SensorGetDeviceType => SDL_GetSensorDeviceType
|
||||
* SDL_SensorGetInstanceID => SDL_GetSensorInstanceID
|
||||
* SDL_SensorGetName => SDL_GetSensorName
|
||||
* SDL_SensorGetNonPortableType => SDL_GetSensorNonPortableType
|
||||
* SDL_SensorGetType => SDL_GetSensorType
|
||||
* SDL_SensorOpen => SDL_OpenSensor
|
||||
* SDL_SensorUpdate => SDL_UpdateSensors
|
||||
* Removed the following functions from the API, see docs/README-migration.md for details:
|
||||
* SDL_AudioInit()
|
||||
* SDL_AudioQuit()
|
||||
|
|
|
@ -443,6 +443,22 @@ SDL_RWFromFP(void *fp, SDL_bool autoclose)
|
|||
Removed SDL_SensorGetDataWithTimestamp(), if you want timestamps for the sensor data, you should use the sensor_timestamp member of SDL_SENSORUPDATE events.
|
||||
|
||||
|
||||
The following functions have been renamed:
|
||||
* SDL_NumSensors => SDL_GetNumSensors
|
||||
* SDL_SensorClose => SDL_CloseSensor
|
||||
* SDL_SensorFromInstanceID => SDL_GetSensorFromInstanceID
|
||||
* SDL_SensorGetData => SDL_GetSensorData
|
||||
* SDL_SensorGetDeviceInstanceID => SDL_GetSensorDeviceInstanceID
|
||||
* SDL_SensorGetDeviceName => SDL_GetSensorDeviceName
|
||||
* SDL_SensorGetDeviceNonPortableType => SDL_GetSensorDeviceNonPortableType
|
||||
* SDL_SensorGetDeviceType => SDL_GetSensorDeviceType
|
||||
* SDL_SensorGetInstanceID => SDL_GetSensorInstanceID
|
||||
* SDL_SensorGetName => SDL_GetSensorName
|
||||
* SDL_SensorGetNonPortableType => SDL_GetSensorNonPortableType
|
||||
* SDL_SensorGetType => SDL_GetSensorType
|
||||
* SDL_SensorOpen => SDL_OpenSensor
|
||||
* SDL_SensorUpdate => SDL_UpdateSensors
|
||||
|
||||
## SDL_stdinc.h
|
||||
|
||||
The standard C headers like stdio.h and stdlib.h are no longer included, you should include them directly in your project if you use non-SDL C runtime functions.
|
||||
|
|
|
@ -536,7 +536,7 @@ typedef struct SDL_SensorEvent
|
|||
Uint32 type; /**< ::SDL_SENSORUPDATE */
|
||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||
SDL_SensorID which; /**< The instance ID of the sensor */
|
||||
float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */
|
||||
float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_GetSensorData() */
|
||||
Uint64 sensor_timestamp; /**< The timestamp of the sensor reading in nanoseconds, not necessarily synchronized with the system clock */
|
||||
} SDL_SensorEvent;
|
||||
|
||||
|
|
|
@ -308,8 +308,8 @@ extern "C" {
|
|||
*
|
||||
* This variable can be set to the following values:
|
||||
*
|
||||
* "0" - You'll call SDL_SensorUpdate() manually
|
||||
* "1" - SDL will automatically call SDL_SensorUpdate() (default)
|
||||
* "0" - You'll call SDL_UpdateSensors() manually
|
||||
* "1" - SDL will automatically call SDL_UpdateSensors() (default)
|
||||
*
|
||||
* This hint can be toggled on and off at runtime.
|
||||
*/
|
||||
|
|
|
@ -176,6 +176,22 @@
|
|||
#define RW_SEEK_END SDL_RW_SEEK_END
|
||||
#define RW_SEEK_SET SDL_RW_SEEK_SET
|
||||
|
||||
/* ##SDL_sensor.h */
|
||||
#define SDL_NumSensors SDL_GetNumSensors
|
||||
#define SDL_SensorClose SDL_CloseSensor
|
||||
#define SDL_SensorFromInstanceID SDL_GetSensorFromInstanceID
|
||||
#define SDL_SensorGetData SDL_GetSensorData
|
||||
#define SDL_SensorGetDeviceInstanceID SDL_GetSensorDeviceInstanceID
|
||||
#define SDL_SensorGetDeviceName SDL_GetSensorDeviceName
|
||||
#define SDL_SensorGetDeviceNonPortableType SDL_GetSensorDeviceNonPortableType
|
||||
#define SDL_SensorGetDeviceType SDL_GetSensorDeviceType
|
||||
#define SDL_SensorGetInstanceID SDL_GetSensorInstanceID
|
||||
#define SDL_SensorGetName SDL_GetSensorName
|
||||
#define SDL_SensorGetNonPortableType SDL_GetSensorNonPortableType
|
||||
#define SDL_SensorGetType SDL_GetSensorType
|
||||
#define SDL_SensorOpen SDL_OpenSensor
|
||||
#define SDL_SensorUpdate SDL_UpdateSensors
|
||||
|
||||
#else /* !SDL_ENABLE_OLD_NAMES */
|
||||
|
||||
/* ##SDL_audio.h */
|
||||
|
@ -315,6 +331,22 @@
|
|||
#define RW_SEEK_END RW_SEEK_END_renamed_SDL_RW_SEEK_END
|
||||
#define RW_SEEK_SET RW_SEEK_SET_renamed_SDL_RW_SEEK_SET
|
||||
|
||||
/* ##SDL_sensor.h */
|
||||
#define SDL_NumSensors SDL_NumSensors_renamed_SDL_GetNumSensors
|
||||
#define SDL_SensorClose SDL_SensorClose_renamed_SDL_CloseSensor
|
||||
#define SDL_SensorFromInstanceID SDL_SensorFromInstanceID_renamed_SDL_GetSensorFromInstanceID
|
||||
#define SDL_SensorGetData SDL_SensorGetData_renamed_SDL_GetSensorData
|
||||
#define SDL_SensorGetDeviceInstanceID SDL_SensorGetDeviceInstanceID_renamed_SDL_GetSensorDeviceInstanceID
|
||||
#define SDL_SensorGetDeviceName SDL_SensorGetDeviceName_renamed_SDL_GetSensorDeviceName
|
||||
#define SDL_SensorGetDeviceNonPortableType SDL_SensorGetDeviceNonPortableType_renamed_SDL_GetSensorDeviceNonPortableType
|
||||
#define SDL_SensorGetDeviceType SDL_SensorGetDeviceType_renamed_SDL_GetSensorDeviceType
|
||||
#define SDL_SensorGetInstanceID SDL_SensorGetInstanceID_renamed_SDL_GetSensorInstanceID
|
||||
#define SDL_SensorGetName SDL_SensorGetName_renamed_SDL_GetSensorName
|
||||
#define SDL_SensorGetNonPortableType SDL_SensorGetNonPortableType_renamed_SDL_GetSensorNonPortableType
|
||||
#define SDL_SensorGetType SDL_SensorGetType_renamed_SDL_GetSensorType
|
||||
#define SDL_SensorOpen SDL_SensorOpen_renamed_SDL_OpenSensor
|
||||
#define SDL_SensorUpdate SDL_SensorUpdate_renamed_SDL_UpdateSensors
|
||||
|
||||
#endif /* SDL_ENABLE_OLD_NAMES */
|
||||
|
||||
#endif /* SDL_oldnames_h_ */
|
||||
|
|
|
@ -150,7 +150,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockSensors(void);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_NumSensors(void);
|
||||
extern DECLSPEC int SDLCALL SDL_GetNumSensors(void);
|
||||
|
||||
/**
|
||||
* Get the implementation dependent name of a sensor.
|
||||
|
@ -160,7 +160,7 @@ extern DECLSPEC int SDLCALL SDL_NumSensors(void);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index);
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetSensorDeviceName(int device_index);
|
||||
|
||||
/**
|
||||
* Get the type of a sensor.
|
||||
|
@ -171,7 +171,7 @@ extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index);
|
||||
extern DECLSPEC SDL_SensorType SDLCALL SDL_GetSensorDeviceType(int device_index);
|
||||
|
||||
/**
|
||||
* Get the platform dependent type of a sensor.
|
||||
|
@ -182,7 +182,7 @@ extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index)
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index);
|
||||
extern DECLSPEC int SDLCALL SDL_GetSensorDeviceNonPortableType(int device_index);
|
||||
|
||||
/**
|
||||
* Get the instance ID of a sensor.
|
||||
|
@ -192,7 +192,7 @@ extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index)
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index);
|
||||
extern DECLSPEC SDL_SensorID SDLCALL SDL_GetSensorDeviceInstanceID(int device_index);
|
||||
|
||||
/**
|
||||
* Open a sensor for use.
|
||||
|
@ -202,7 +202,7 @@ extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_in
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index);
|
||||
extern DECLSPEC SDL_Sensor *SDLCALL SDL_OpenSensor(int device_index);
|
||||
|
||||
/**
|
||||
* Return the SDL_Sensor associated with an instance id.
|
||||
|
@ -212,7 +212,7 @@ extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id);
|
||||
extern DECLSPEC SDL_Sensor *SDLCALL SDL_GetSensorFromInstanceID(SDL_SensorID instance_id);
|
||||
|
||||
/**
|
||||
* Get the implementation dependent name of a sensor
|
||||
|
@ -222,7 +222,7 @@ extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instan
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor);
|
||||
extern DECLSPEC const char *SDLCALL SDL_GetSensorName(SDL_Sensor *sensor);
|
||||
|
||||
/**
|
||||
* Get the type of a sensor.
|
||||
|
@ -233,7 +233,7 @@ extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor);
|
||||
extern DECLSPEC SDL_SensorType SDLCALL SDL_GetSensorType(SDL_Sensor *sensor);
|
||||
|
||||
/**
|
||||
* Get the platform dependent type of a sensor.
|
||||
|
@ -243,7 +243,7 @@ extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor);
|
||||
extern DECLSPEC int SDLCALL SDL_GetSensorNonPortableType(SDL_Sensor *sensor);
|
||||
|
||||
/**
|
||||
* Get the instance ID of a sensor.
|
||||
|
@ -253,7 +253,7 @@ extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor);
|
||||
extern DECLSPEC SDL_SensorID SDLCALL SDL_GetSensorInstanceID(SDL_Sensor *sensor);
|
||||
|
||||
/**
|
||||
* Get the current state of an opened sensor.
|
||||
|
@ -267,16 +267,16 @@ extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor)
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor *sensor, float *data, int num_values);
|
||||
extern DECLSPEC int SDLCALL SDL_GetSensorData(SDL_Sensor *sensor, float *data, int num_values);
|
||||
|
||||
/**
|
||||
* Close a sensor previously opened with SDL_SensorOpen().
|
||||
* Close a sensor previously opened with SDL_OpenSensor().
|
||||
*
|
||||
* \param sensor The SDL_Sensor object to close
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor *sensor);
|
||||
extern DECLSPEC void SDLCALL SDL_CloseSensor(SDL_Sensor *sensor);
|
||||
|
||||
/**
|
||||
* Update the current state of the open sensors.
|
||||
|
@ -289,7 +289,7 @@ extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor *sensor);
|
|||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SensorUpdate(void);
|
||||
extern DECLSPEC void SDLCALL SDL_UpdateSensors(void);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
|
|
|
@ -651,20 +651,20 @@ SDL3_0.0.0 {
|
|||
SDL_Error;
|
||||
SDL_LockSensors;
|
||||
SDL_UnlockSensors;
|
||||
SDL_NumSensors;
|
||||
SDL_SensorGetDeviceName;
|
||||
SDL_SensorGetDeviceType;
|
||||
SDL_SensorGetDeviceNonPortableType;
|
||||
SDL_SensorGetDeviceInstanceID;
|
||||
SDL_SensorOpen;
|
||||
SDL_SensorFromInstanceID;
|
||||
SDL_SensorGetName;
|
||||
SDL_SensorGetType;
|
||||
SDL_SensorGetNonPortableType;
|
||||
SDL_SensorGetInstanceID;
|
||||
SDL_SensorGetData;
|
||||
SDL_SensorClose;
|
||||
SDL_SensorUpdate;
|
||||
SDL_GetNumSensors;
|
||||
SDL_GetSensorDeviceName;
|
||||
SDL_GetSensorDeviceType;
|
||||
SDL_GetSensorDeviceNonPortableType;
|
||||
SDL_GetSensorDeviceInstanceID;
|
||||
SDL_OpenSensor;
|
||||
SDL_GetSensorFromInstanceID;
|
||||
SDL_GetSensorName;
|
||||
SDL_GetSensorType;
|
||||
SDL_GetSensorNonPortableType;
|
||||
SDL_GetSensorInstanceID;
|
||||
SDL_GetSensorData;
|
||||
SDL_CloseSensor;
|
||||
SDL_UpdateSensors;
|
||||
SDL_SetHintWithPriority;
|
||||
SDL_SetHint;
|
||||
SDL_ResetHint;
|
||||
|
|
|
@ -652,20 +652,20 @@
|
|||
#define SDL_wcsdup SDL_wcsdup_REAL
|
||||
#define SDL_GameControllerRumble SDL_GameControllerRumble_REAL
|
||||
#define SDL_RumbleJoystick SDL_RumbleJoystick_REAL
|
||||
#define SDL_NumSensors SDL_NumSensors_REAL
|
||||
#define SDL_SensorGetDeviceName SDL_SensorGetDeviceName_REAL
|
||||
#define SDL_SensorGetDeviceType SDL_SensorGetDeviceType_REAL
|
||||
#define SDL_SensorGetDeviceNonPortableType SDL_SensorGetDeviceNonPortableType_REAL
|
||||
#define SDL_SensorGetDeviceInstanceID SDL_SensorGetDeviceInstanceID_REAL
|
||||
#define SDL_SensorOpen SDL_SensorOpen_REAL
|
||||
#define SDL_SensorFromInstanceID SDL_SensorFromInstanceID_REAL
|
||||
#define SDL_SensorGetName SDL_SensorGetName_REAL
|
||||
#define SDL_SensorGetType SDL_SensorGetType_REAL
|
||||
#define SDL_SensorGetNonPortableType SDL_SensorGetNonPortableType_REAL
|
||||
#define SDL_SensorGetInstanceID SDL_SensorGetInstanceID_REAL
|
||||
#define SDL_SensorGetData SDL_SensorGetData_REAL
|
||||
#define SDL_SensorClose SDL_SensorClose_REAL
|
||||
#define SDL_SensorUpdate SDL_SensorUpdate_REAL
|
||||
#define SDL_GetNumSensors SDL_GetNumSensors_REAL
|
||||
#define SDL_GetSensorDeviceName SDL_GetSensorDeviceName_REAL
|
||||
#define SDL_GetSensorDeviceType SDL_GetSensorDeviceType_REAL
|
||||
#define SDL_GetSensorDeviceNonPortableType SDL_GetSensorDeviceNonPortableType_REAL
|
||||
#define SDL_GetSensorDeviceInstanceID SDL_GetSensorDeviceInstanceID_REAL
|
||||
#define SDL_OpenSensor SDL_OpenSensor_REAL
|
||||
#define SDL_GetSensorFromInstanceID SDL_GetSensorFromInstanceID_REAL
|
||||
#define SDL_GetSensorName SDL_GetSensorName_REAL
|
||||
#define SDL_GetSensorType SDL_GetSensorType_REAL
|
||||
#define SDL_GetSensorNonPortableType SDL_GetSensorNonPortableType_REAL
|
||||
#define SDL_GetSensorInstanceID SDL_GetSensorInstanceID_REAL
|
||||
#define SDL_GetSensorData SDL_GetSensorData_REAL
|
||||
#define SDL_CloseSensor SDL_CloseSensor_REAL
|
||||
#define SDL_UpdateSensors SDL_UpdateSensors_REAL
|
||||
#define SDL_IsTablet SDL_IsTablet_REAL
|
||||
#define SDL_GetDisplayOrientation SDL_GetDisplayOrientation_REAL
|
||||
#define SDL_HasColorKey SDL_HasColorKey_REAL
|
||||
|
|
|
@ -693,20 +693,20 @@ SDL_DYNAPI_PROC(float,SDL_expf,(float a),(a),return)
|
|||
SDL_DYNAPI_PROC(wchar_t*,SDL_wcsdup,(const wchar_t *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GameControllerRumble,(SDL_GameController *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_RumbleJoystick,(SDL_Joystick *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_NumSensors,(void),(),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_SensorGetDeviceName,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_SensorType,SDL_SensorGetDeviceType,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SensorGetDeviceNonPortableType,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_SensorID,SDL_SensorGetDeviceInstanceID,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Sensor*,SDL_SensorOpen,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Sensor*,SDL_SensorFromInstanceID,(SDL_SensorID a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_SensorGetName,(SDL_Sensor *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_SensorType,SDL_SensorGetType,(SDL_Sensor *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SensorGetNonPortableType,(SDL_Sensor *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_SensorID,SDL_SensorGetInstanceID,(SDL_Sensor *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SensorGetData,(SDL_Sensor *a, float *b, int c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_SensorClose,(SDL_Sensor *a),(a),)
|
||||
SDL_DYNAPI_PROC(void,SDL_SensorUpdate,(void),(),)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetNumSensors,(void),(),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetSensorDeviceName,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_SensorType,SDL_GetSensorDeviceType,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetSensorDeviceNonPortableType,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_SensorID,SDL_GetSensorDeviceInstanceID,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Sensor*,SDL_OpenSensor,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Sensor*,SDL_GetSensorFromInstanceID,(SDL_SensorID a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetSensorName,(SDL_Sensor *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_SensorType,SDL_GetSensorType,(SDL_Sensor *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetSensorNonPortableType,(SDL_Sensor *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_SensorID,SDL_GetSensorInstanceID,(SDL_Sensor *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetSensorData,(SDL_Sensor *a, float *b, int c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_CloseSensor,(SDL_Sensor *a),(a),)
|
||||
SDL_DYNAPI_PROC(void,SDL_UpdateSensors,(void),(),)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_IsTablet,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_DisplayOrientation,SDL_GetDisplayOrientation,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_HasColorKey,(SDL_Surface *a),(a),return)
|
||||
|
|
|
@ -877,7 +877,7 @@ static void SDL_PumpEventsInternal(SDL_bool push_sentinel)
|
|||
#if !SDL_SENSOR_DISABLED
|
||||
/* Check for sensor state change */
|
||||
if (SDL_update_sensors) {
|
||||
SDL_SensorUpdate();
|
||||
SDL_UpdateSensors();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ static SDL_bool SDL_events_need_polling()
|
|||
|
||||
#if !SDL_SENSOR_DISABLED
|
||||
need_polling = need_polling ||
|
||||
(SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors && (SDL_NumSensors() > 0));
|
||||
(SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors && (SDL_GetNumSensors() > 0));
|
||||
#endif
|
||||
|
||||
return need_polling;
|
||||
|
|
|
@ -90,7 +90,7 @@ int SDL_SensorInit(void)
|
|||
/*
|
||||
* Count the number of sensors attached to the system
|
||||
*/
|
||||
int SDL_NumSensors(void)
|
||||
int SDL_GetNumSensors(void)
|
||||
{
|
||||
int i, total_sensors = 0;
|
||||
SDL_LockSensors();
|
||||
|
@ -138,7 +138,7 @@ static SDL_bool SDL_GetDriverAndSensorIndex(int device_index, SDL_SensorDriver *
|
|||
/*
|
||||
* Get the implementation dependent name of a sensor
|
||||
*/
|
||||
const char *SDL_SensorGetDeviceName(int device_index)
|
||||
const char *SDL_GetSensorDeviceName(int device_index)
|
||||
{
|
||||
SDL_SensorDriver *driver;
|
||||
const char *name = NULL;
|
||||
|
@ -153,7 +153,7 @@ const char *SDL_SensorGetDeviceName(int device_index)
|
|||
return name;
|
||||
}
|
||||
|
||||
SDL_SensorType SDL_SensorGetDeviceType(int device_index)
|
||||
SDL_SensorType SDL_GetSensorDeviceType(int device_index)
|
||||
{
|
||||
SDL_SensorDriver *driver;
|
||||
SDL_SensorType type = SDL_SENSOR_INVALID;
|
||||
|
@ -167,7 +167,7 @@ SDL_SensorType SDL_SensorGetDeviceType(int device_index)
|
|||
return type;
|
||||
}
|
||||
|
||||
int SDL_SensorGetDeviceNonPortableType(int device_index)
|
||||
int SDL_GetSensorDeviceNonPortableType(int device_index)
|
||||
{
|
||||
SDL_SensorDriver *driver;
|
||||
int type = -1;
|
||||
|
@ -181,7 +181,7 @@ int SDL_SensorGetDeviceNonPortableType(int device_index)
|
|||
return type;
|
||||
}
|
||||
|
||||
SDL_SensorID SDL_SensorGetDeviceInstanceID(int device_index)
|
||||
SDL_SensorID SDL_GetSensorDeviceInstanceID(int device_index)
|
||||
{
|
||||
SDL_SensorDriver *driver;
|
||||
SDL_SensorID instance_id = -1;
|
||||
|
@ -202,7 +202,7 @@ SDL_SensorID SDL_SensorGetDeviceInstanceID(int device_index)
|
|||
*
|
||||
* This function returns a sensor identifier, or NULL if an error occurred.
|
||||
*/
|
||||
SDL_Sensor *SDL_SensorOpen(int device_index)
|
||||
SDL_Sensor *SDL_OpenSensor(int device_index)
|
||||
{
|
||||
SDL_SensorDriver *driver;
|
||||
SDL_SensorID instance_id;
|
||||
|
@ -273,7 +273,7 @@ SDL_Sensor *SDL_SensorOpen(int device_index)
|
|||
/*
|
||||
* Find the SDL_Sensor that owns this instance id
|
||||
*/
|
||||
SDL_Sensor *SDL_SensorFromInstanceID(SDL_SensorID instance_id)
|
||||
SDL_Sensor *SDL_GetSensorFromInstanceID(SDL_SensorID instance_id)
|
||||
{
|
||||
SDL_Sensor *sensor;
|
||||
|
||||
|
@ -307,7 +307,7 @@ static int SDL_PrivateSensorValid(SDL_Sensor *sensor)
|
|||
/*
|
||||
* Get the friendly name of this sensor
|
||||
*/
|
||||
const char *SDL_SensorGetName(SDL_Sensor *sensor)
|
||||
const char *SDL_GetSensorName(SDL_Sensor *sensor)
|
||||
{
|
||||
if (!SDL_PrivateSensorValid(sensor)) {
|
||||
return NULL;
|
||||
|
@ -319,7 +319,7 @@ const char *SDL_SensorGetName(SDL_Sensor *sensor)
|
|||
/*
|
||||
* Get the type of this sensor
|
||||
*/
|
||||
SDL_SensorType SDL_SensorGetType(SDL_Sensor *sensor)
|
||||
SDL_SensorType SDL_GetSensorType(SDL_Sensor *sensor)
|
||||
{
|
||||
if (!SDL_PrivateSensorValid(sensor)) {
|
||||
return SDL_SENSOR_INVALID;
|
||||
|
@ -331,7 +331,7 @@ SDL_SensorType SDL_SensorGetType(SDL_Sensor *sensor)
|
|||
/*
|
||||
* Get the platform dependent type of this sensor
|
||||
*/
|
||||
int SDL_SensorGetNonPortableType(SDL_Sensor *sensor)
|
||||
int SDL_GetSensorNonPortableType(SDL_Sensor *sensor)
|
||||
{
|
||||
if (!SDL_PrivateSensorValid(sensor)) {
|
||||
return -1;
|
||||
|
@ -343,7 +343,7 @@ int SDL_SensorGetNonPortableType(SDL_Sensor *sensor)
|
|||
/*
|
||||
* Get the instance id for this opened sensor
|
||||
*/
|
||||
SDL_SensorID SDL_SensorGetInstanceID(SDL_Sensor *sensor)
|
||||
SDL_SensorID SDL_GetSensorInstanceID(SDL_Sensor *sensor)
|
||||
{
|
||||
if (!SDL_PrivateSensorValid(sensor)) {
|
||||
return -1;
|
||||
|
@ -355,7 +355,7 @@ SDL_SensorID SDL_SensorGetInstanceID(SDL_Sensor *sensor)
|
|||
/*
|
||||
* Get the current state of this sensor
|
||||
*/
|
||||
int SDL_SensorGetData(SDL_Sensor *sensor, float *data, int num_values)
|
||||
int SDL_GetSensorData(SDL_Sensor *sensor, float *data, int num_values)
|
||||
{
|
||||
if (!SDL_PrivateSensorValid(sensor)) {
|
||||
return -1;
|
||||
|
@ -367,9 +367,9 @@ int SDL_SensorGetData(SDL_Sensor *sensor, float *data, int num_values)
|
|||
}
|
||||
|
||||
/*
|
||||
* Close a sensor previously opened with SDL_SensorOpen()
|
||||
* Close a sensor previously opened with SDL_OpenSensor()
|
||||
*/
|
||||
void SDL_SensorClose(SDL_Sensor *sensor)
|
||||
void SDL_CloseSensor(SDL_Sensor *sensor)
|
||||
{
|
||||
SDL_Sensor *sensorlist;
|
||||
SDL_Sensor *sensorlistprev;
|
||||
|
@ -430,7 +430,7 @@ void SDL_SensorQuit(void)
|
|||
/* Stop the event polling */
|
||||
while (SDL_sensors) {
|
||||
SDL_sensors->ref_count = 1;
|
||||
SDL_SensorClose(SDL_sensors);
|
||||
SDL_CloseSensor(SDL_sensors);
|
||||
}
|
||||
|
||||
/* Quit the sensor setup */
|
||||
|
@ -480,7 +480,7 @@ int SDL_PrivateSensorUpdate(Uint64 timestamp, SDL_Sensor *sensor, Uint64 sensor_
|
|||
return posted;
|
||||
}
|
||||
|
||||
void SDL_SensorUpdate(void)
|
||||
void SDL_UpdateSensors(void)
|
||||
{
|
||||
int i;
|
||||
SDL_Sensor *sensor, *next;
|
||||
|
@ -509,7 +509,7 @@ void SDL_SensorUpdate(void)
|
|||
for (sensor = SDL_sensors; sensor; sensor = next) {
|
||||
next = sensor->next;
|
||||
if (sensor->ref_count <= 0) {
|
||||
SDL_SensorClose(sensor);
|
||||
SDL_CloseSensor(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,13 +36,13 @@ static const char *GetSensorTypeString(SDL_SensorType type)
|
|||
|
||||
static void HandleSensorEvent(SDL_SensorEvent *event)
|
||||
{
|
||||
SDL_Sensor *sensor = SDL_SensorFromInstanceID(event->which);
|
||||
SDL_Sensor *sensor = SDL_GetSensorFromInstanceID(event->which);
|
||||
if (sensor == NULL) {
|
||||
SDL_Log("Couldn't get sensor for sensor event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (SDL_SensorGetType(sensor)) {
|
||||
switch (SDL_GetSensorType(sensor)) {
|
||||
case SDL_SENSOR_ACCEL:
|
||||
SDL_Log("Accelerometer update: %.2f, %.2f, %.2f\n", event->data[0], event->data[1], event->data[2]);
|
||||
break;
|
||||
|
@ -50,7 +50,7 @@ static void HandleSensorEvent(SDL_SensorEvent *event)
|
|||
SDL_Log("Gyro update: %.2f, %.2f, %.2f\n", event->data[0], event->data[1], event->data[2]);
|
||||
break;
|
||||
default:
|
||||
SDL_Log("Sensor update for sensor type %s\n", GetSensorTypeString(SDL_SensorGetType(sensor)));
|
||||
SDL_Log("Sensor update for sensor type %s\n", GetSensorTypeString(SDL_GetSensorType(sensor)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -66,21 +66,21 @@ int main(int argc, char **argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
num_sensors = SDL_NumSensors();
|
||||
num_sensors = SDL_GetNumSensors();
|
||||
num_opened = 0;
|
||||
|
||||
SDL_Log("There are %d sensors available\n", num_sensors);
|
||||
for (i = 0; i < num_sensors; ++i) {
|
||||
SDL_Log("Sensor %" SDL_PRIs32 ": %s, type %s, platform type %d\n",
|
||||
SDL_SensorGetDeviceInstanceID(i),
|
||||
SDL_SensorGetDeviceName(i),
|
||||
GetSensorTypeString(SDL_SensorGetDeviceType(i)),
|
||||
SDL_SensorGetDeviceNonPortableType(i));
|
||||
SDL_GetSensorDeviceInstanceID(i),
|
||||
SDL_GetSensorDeviceName(i),
|
||||
GetSensorTypeString(SDL_GetSensorDeviceType(i)),
|
||||
SDL_GetSensorDeviceNonPortableType(i));
|
||||
|
||||
if (SDL_SensorGetDeviceType(i) != SDL_SENSOR_UNKNOWN) {
|
||||
SDL_Sensor *sensor = SDL_SensorOpen(i);
|
||||
if (SDL_GetSensorDeviceType(i) != SDL_SENSOR_UNKNOWN) {
|
||||
SDL_Sensor *sensor = SDL_OpenSensor(i);
|
||||
if (sensor == NULL) {
|
||||
SDL_Log("Couldn't open sensor %" SDL_PRIs32 ": %s\n", SDL_SensorGetDeviceInstanceID(i), SDL_GetError());
|
||||
SDL_Log("Couldn't open sensor %" SDL_PRIs32 ": %s\n", SDL_GetSensorDeviceInstanceID(i), SDL_GetError());
|
||||
} else {
|
||||
++num_opened;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue