mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-30 15:08:31 +00:00
Added properties to various SDL objects
The following objects now have properties that can be user modified: * SDL_AudioStream * SDL_Gamepad * SDL_Joystick * SDL_RWops * SDL_Renderer * SDL_Sensor * SDL_Surface * SDL_Texture * SDL_Window
This commit is contained in:
@@ -393,6 +393,27 @@ SDL_Sensor *SDL_GetSensorFromInstanceID(SDL_SensorID instance_id)
|
||||
return sensor;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the properties associated with a sensor.
|
||||
*/
|
||||
SDL_PropertiesID SDL_GetSensorProperties(SDL_Sensor *sensor)
|
||||
{
|
||||
SDL_PropertiesID retval;
|
||||
|
||||
SDL_LockSensors();
|
||||
{
|
||||
CHECK_SENSOR_MAGIC(sensor, 0);
|
||||
|
||||
if (sensor->props == 0) {
|
||||
sensor->props = SDL_CreateProperties();
|
||||
}
|
||||
retval = sensor->props;
|
||||
}
|
||||
SDL_UnlockSensors();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the friendly name of this sensor
|
||||
*/
|
||||
@@ -500,6 +521,8 @@ void SDL_CloseSensor(SDL_Sensor *sensor)
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_DestroyProperties(sensor->props);
|
||||
|
||||
sensor->driver->Close(sensor);
|
||||
sensor->hwdata = NULL;
|
||||
|
||||
|
@@ -45,6 +45,8 @@ struct SDL_Sensor
|
||||
|
||||
struct sensor_hwdata *hwdata _guarded; /* Driver dependent information */
|
||||
|
||||
SDL_PropertiesID props _guarded;
|
||||
|
||||
int ref_count _guarded; /* Reference count for multiple opens */
|
||||
|
||||
struct SDL_Sensor *next _guarded; /* pointer to next sensor we have allocated */
|
||||
|
Reference in New Issue
Block a user