mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-19 09:48:14 +00:00
SDL API renaming: internal functions
This commit is contained in:
@@ -63,7 +63,7 @@ void SDL_UnlockSensors(void) SDL_RELEASE(SDL_sensor_lock)
|
||||
SDL_UnlockMutex(SDL_sensor_lock);
|
||||
}
|
||||
|
||||
int SDL_SensorInit(void)
|
||||
int SDL_InitSensors(void)
|
||||
{
|
||||
int i, status;
|
||||
|
||||
@@ -290,7 +290,7 @@ SDL_Sensor *SDL_GetSensorFromInstanceID(SDL_SensorID instance_id)
|
||||
/*
|
||||
* Checks to make sure the sensor is valid.
|
||||
*/
|
||||
static int SDL_PrivateSensorValid(SDL_Sensor *sensor)
|
||||
static int SDL_IsSensorValid(SDL_Sensor *sensor)
|
||||
{
|
||||
int valid;
|
||||
|
||||
@@ -309,7 +309,7 @@ static int SDL_PrivateSensorValid(SDL_Sensor *sensor)
|
||||
*/
|
||||
const char *SDL_GetSensorName(SDL_Sensor *sensor)
|
||||
{
|
||||
if (!SDL_PrivateSensorValid(sensor)) {
|
||||
if (!SDL_IsSensorValid(sensor)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -321,7 +321,7 @@ const char *SDL_GetSensorName(SDL_Sensor *sensor)
|
||||
*/
|
||||
SDL_SensorType SDL_GetSensorType(SDL_Sensor *sensor)
|
||||
{
|
||||
if (!SDL_PrivateSensorValid(sensor)) {
|
||||
if (!SDL_IsSensorValid(sensor)) {
|
||||
return SDL_SENSOR_INVALID;
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ SDL_SensorType SDL_GetSensorType(SDL_Sensor *sensor)
|
||||
*/
|
||||
int SDL_GetSensorNonPortableType(SDL_Sensor *sensor)
|
||||
{
|
||||
if (!SDL_PrivateSensorValid(sensor)) {
|
||||
if (!SDL_IsSensorValid(sensor)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ int SDL_GetSensorNonPortableType(SDL_Sensor *sensor)
|
||||
*/
|
||||
SDL_SensorID SDL_GetSensorInstanceID(SDL_Sensor *sensor)
|
||||
{
|
||||
if (!SDL_PrivateSensorValid(sensor)) {
|
||||
if (!SDL_IsSensorValid(sensor)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ SDL_SensorID SDL_GetSensorInstanceID(SDL_Sensor *sensor)
|
||||
*/
|
||||
int SDL_GetSensorData(SDL_Sensor *sensor, float *data, int num_values)
|
||||
{
|
||||
if (!SDL_PrivateSensorValid(sensor)) {
|
||||
if (!SDL_IsSensorValid(sensor)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ void SDL_CloseSensor(SDL_Sensor *sensor)
|
||||
SDL_Sensor *sensorlist;
|
||||
SDL_Sensor *sensorlistprev;
|
||||
|
||||
if (!SDL_PrivateSensorValid(sensor)) {
|
||||
if (!SDL_IsSensorValid(sensor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ void SDL_CloseSensor(SDL_Sensor *sensor)
|
||||
SDL_UnlockSensors();
|
||||
}
|
||||
|
||||
void SDL_SensorQuit(void)
|
||||
void SDL_QuitSensors(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -452,7 +452,7 @@ void SDL_SensorQuit(void)
|
||||
|
||||
/* These are global for SDL_syssensor.c and SDL_events.c */
|
||||
|
||||
int SDL_PrivateSensorUpdate(Uint64 timestamp, SDL_Sensor *sensor, Uint64 sensor_timestamp, float *data, int num_values)
|
||||
int SDL_SendSensorUpdate(Uint64 timestamp, SDL_Sensor *sensor, Uint64 sensor_timestamp, float *data, int num_values)
|
||||
{
|
||||
int posted;
|
||||
|
||||
|
@@ -31,10 +31,10 @@ struct _SDL_SensorDriver;
|
||||
extern SDL_SensorID SDL_GetNextSensorInstanceID(void);
|
||||
|
||||
/* Initialization and shutdown functions */
|
||||
extern int SDL_SensorInit(void);
|
||||
extern void SDL_SensorQuit(void);
|
||||
extern int SDL_InitSensors(void);
|
||||
extern void SDL_QuitSensors(void);
|
||||
|
||||
/* Internal event queueing functions */
|
||||
extern int SDL_PrivateSensorUpdate(Uint64 timestamp, SDL_Sensor *sensor, Uint64 sensor_timestamp, float *data, int num_values);
|
||||
extern int SDL_SendSensorUpdate(Uint64 timestamp, SDL_Sensor *sensor, Uint64 sensor_timestamp, float *data, int num_values);
|
||||
|
||||
#endif /* SDL_sensor_c_h_ */
|
||||
|
@@ -80,7 +80,7 @@ typedef struct _SDL_SensorDriver
|
||||
|
||||
/* Function to update the state of a sensor - called as a device poll.
|
||||
* This function shouldn't update the sensor structure directly,
|
||||
* but instead should call SDL_PrivateSensorUpdate() to deliver events
|
||||
* but instead should call SDL_SendSensorUpdate() to deliver events
|
||||
* and update sensor device state.
|
||||
*/
|
||||
void (*Update)(SDL_Sensor *sensor);
|
||||
|
@@ -161,7 +161,7 @@ static void SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor)
|
||||
if (ALooper_pollAll(0, NULL, &events, (void **)&source) == LOOPER_ID_USER) {
|
||||
SDL_zero(event);
|
||||
while (ASensorEventQueue_getEvents(sensor->hwdata->eventqueue, &event, 1) > 0) {
|
||||
SDL_PrivateSensorUpdate(timestamp, sensor, timestamp, event.data, SDL_arraysize(event.data));
|
||||
SDL_SendSensorUpdate(timestamp, sensor, timestamp, event.data, SDL_arraysize(event.data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -150,7 +150,7 @@ static void SDL_COREMOTION_SensorUpdate(SDL_Sensor *sensor)
|
||||
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(timestamp, sensor, timestamp, data, SDL_arraysize(data));
|
||||
SDL_SendSensorUpdate(timestamp, sensor, timestamp, data, SDL_arraysize(data));
|
||||
SDL_memcpy(sensor->hwdata->data, data, sizeof(data));
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ static void SDL_COREMOTION_SensorUpdate(SDL_Sensor *sensor)
|
||||
data[1] = rotationRate.y;
|
||||
data[2] = rotationRate.z;
|
||||
if (SDL_memcmp(data, sensor->hwdata->data, sizeof(data)) != 0) {
|
||||
SDL_PrivateSensorUpdate(timestamp, sensor, timestamp, data, SDL_arraysize(data));
|
||||
SDL_SendSensorUpdate(timestamp, sensor, timestamp, data, SDL_arraysize(data));
|
||||
SDL_memcpy(sensor->hwdata->data, data, sizeof(data));
|
||||
}
|
||||
}
|
||||
|
@@ -157,7 +157,7 @@ UpdateN3DSAccelerometer(SDL_Sensor *sensor)
|
||||
data[0] = (float)current_state.x * SDL_STANDARD_GRAVITY;
|
||||
data[1] = (float)current_state.y * SDL_STANDARD_GRAVITY;
|
||||
data[2] = (float)current_state.z * SDL_STANDARD_GRAVITY;
|
||||
SDL_PrivateSensorUpdate(timestamp, sensor, timestamp, data, sizeof data);
|
||||
SDL_SendSensorUpdate(timestamp, sensor, timestamp, data, sizeof data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ UpdateN3DSGyroscope(SDL_Sensor *sensor)
|
||||
data[0] = (float)current_state.x;
|
||||
data[1] = (float)current_state.y;
|
||||
data[2] = (float)current_state.z;
|
||||
SDL_PrivateSensorUpdate(timestamp, sensor, timestamp, data, sizeof data);
|
||||
SDL_SendSensorUpdate(timestamp, sensor, timestamp, data, sizeof data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -161,7 +161,7 @@ static void SDL_VITA_SensorUpdate(SDL_Sensor *sensor)
|
||||
data[0] = motionState[i].accelerometer.x * SDL_STANDARD_GRAVITY;
|
||||
data[1] = motionState[i].accelerometer.y * SDL_STANDARD_GRAVITY;
|
||||
data[2] = motionState[i].accelerometer.z * SDL_STANDARD_GRAVITY;
|
||||
SDL_PrivateSensorUpdate(timestamp, sensor, sensor->hwdata->sensor_timestamp, data, SDL_arraysize(data));
|
||||
SDL_SendSensorUpdate(timestamp, sensor, sensor->hwdata->sensor_timestamp, data, SDL_arraysize(data));
|
||||
} break;
|
||||
case SDL_SENSOR_GYRO:
|
||||
{
|
||||
@@ -169,7 +169,7 @@ static void SDL_VITA_SensorUpdate(SDL_Sensor *sensor)
|
||||
data[0] = motionState[i].gyro.x;
|
||||
data[1] = motionState[i].gyro.y;
|
||||
data[2] = motionState[i].gyro.z;
|
||||
SDL_PrivateSensorUpdate(timestamp, sensor, sensor->hwdata->sensor_timestamp, data, SDL_arraysize(data));
|
||||
SDL_SendSensorUpdate(timestamp, sensor, sensor->hwdata->sensor_timestamp, data, SDL_arraysize(data));
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
|
@@ -180,7 +180,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnDataUpdated(ISensorEvents *
|
||||
values[0] = (float)valueX.dblVal * SDL_STANDARD_GRAVITY;
|
||||
values[1] = (float)valueY.dblVal * SDL_STANDARD_GRAVITY;
|
||||
values[2] = (float)valueZ.dblVal * SDL_STANDARD_GRAVITY;
|
||||
SDL_PrivateSensorUpdate(timestamp, SDL_sensors[i].sensor_opened, sensor_timestamp, values, 3);
|
||||
SDL_SendSensorUpdate(timestamp, SDL_sensors[i].sensor_opened, sensor_timestamp, values, 3);
|
||||
}
|
||||
break;
|
||||
case SDL_SENSOR_GYRO:
|
||||
@@ -195,7 +195,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnDataUpdated(ISensorEvents *
|
||||
values[0] = (float)valueX.dblVal * DEGREES_TO_RADIANS;
|
||||
values[1] = (float)valueY.dblVal * DEGREES_TO_RADIANS;
|
||||
values[2] = (float)valueZ.dblVal * DEGREES_TO_RADIANS;
|
||||
SDL_PrivateSensorUpdate(timestamp, SDL_sensors[i].sensor_opened, sensor_timestamp, values, 3);
|
||||
SDL_SendSensorUpdate(timestamp, SDL_sensors[i].sensor_opened, sensor_timestamp, values, 3);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
Reference in New Issue
Block a user