mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-21 15:59:43 +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:
@@ -29,11 +29,12 @@
|
||||
#define SDL_audio_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_endian.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_mutex.h>
|
||||
#include <SDL3/SDL_thread.h>
|
||||
#include <SDL3/SDL_properties.h>
|
||||
#include <SDL3/SDL_rwops.h>
|
||||
#include <SDL3/SDL_thread.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
@@ -675,6 +676,18 @@ extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_GetAudioStreamDevice(SDL_AudioStre
|
||||
*/
|
||||
extern DECLSPEC SDL_AudioStream *SDLCALL SDL_CreateAudioStream(const SDL_AudioSpec *src_spec, const SDL_AudioSpec *dst_spec);
|
||||
|
||||
/**
|
||||
* Get the properties associated with an audio stream.
|
||||
*
|
||||
* \param stream the SDL_AudioStream to query
|
||||
* \returns a valid property ID on success or 0 on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetProperty
|
||||
* \sa SDL_SetProperty
|
||||
*/
|
||||
extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetAudioStreamProperties(SDL_AudioStream *stream);
|
||||
|
||||
/**
|
||||
* Query the current format of an audio stream.
|
||||
|
||||
@@ -30,9 +30,10 @@
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_joystick.h>
|
||||
#include <SDL3/SDL_properties.h>
|
||||
#include <SDL3/SDL_rwops.h>
|
||||
#include <SDL3/SDL_sensor.h>
|
||||
#include <SDL3/SDL_joystick.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
@@ -554,6 +555,22 @@ extern DECLSPEC SDL_Gamepad *SDLCALL SDL_GetGamepadFromInstanceID(SDL_JoystickID
|
||||
*/
|
||||
extern DECLSPEC SDL_Gamepad *SDLCALL SDL_GetGamepadFromPlayerIndex(int player_index);
|
||||
|
||||
/**
|
||||
* Get the properties associated with an opened gamepad.
|
||||
*
|
||||
* These properties are shared with the underlying joystick object.
|
||||
*
|
||||
* \param gamepad a gamepad identifier previously returned by
|
||||
* SDL_OpenGamepad()
|
||||
* \returns a valid property ID on success or 0 on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetProperty
|
||||
* \sa SDL_SetProperty
|
||||
*/
|
||||
extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetGamepadProperties(SDL_Gamepad *gamepad);
|
||||
|
||||
/**
|
||||
* Get the instance ID of an opened gamepad.
|
||||
*
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_guid.h>
|
||||
#include <SDL3/SDL_mutex.h>
|
||||
#include <SDL3/SDL_properties.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
@@ -456,6 +457,19 @@ extern DECLSPEC int SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick *joystick,
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetJoystickVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value);
|
||||
|
||||
/**
|
||||
* Get the properties associated with a joystick.
|
||||
*
|
||||
* \param joystick the SDL_Joystick obtained from SDL_OpenJoystick()
|
||||
* \returns a valid property ID on success or 0 on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetProperty
|
||||
* \sa SDL_SetProperty
|
||||
*/
|
||||
extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetJoystickProperties(SDL_Joystick *joystick);
|
||||
|
||||
/**
|
||||
* Get the implementation dependent name of a joystick.
|
||||
*
|
||||
|
||||
@@ -111,6 +111,21 @@ extern DECLSPEC int SDLCALL SDL_SetProperty(SDL_PropertiesID props, const char *
|
||||
*/
|
||||
extern DECLSPEC void *SDLCALL SDL_GetProperty(SDL_PropertiesID props, const char *name);
|
||||
|
||||
/**
|
||||
* Clear a property on a set of properties
|
||||
*
|
||||
* \param props the properties to modify
|
||||
* \param name the name of the property to clear
|
||||
*
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetProperty
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_ClearProperty(SDL_PropertiesID props, const char *name);
|
||||
|
||||
/**
|
||||
* Destroy a set of properties
|
||||
*
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_events.h>
|
||||
#include <SDL3/SDL_properties.h>
|
||||
#include <SDL3/SDL_rect.h>
|
||||
#include <SDL3/SDL_video.h>
|
||||
|
||||
@@ -315,6 +316,19 @@ extern DECLSPEC SDL_Window *SDLCALL SDL_GetRenderWindow(SDL_Renderer *renderer);
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info);
|
||||
|
||||
/**
|
||||
* Get the properties associated with a renderer.
|
||||
*
|
||||
* \param renderer the rendering context
|
||||
* \returns a valid property ID on success or 0 on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetProperty
|
||||
* \sa SDL_SetProperty
|
||||
*/
|
||||
extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRendererProperties(SDL_Renderer *renderer);
|
||||
|
||||
/**
|
||||
* Get the output size in pixels of a rendering context.
|
||||
*
|
||||
@@ -422,6 +436,19 @@ typedef struct IDXGIResource IDXGIResource;
|
||||
*/
|
||||
extern DECLSPEC IDXGIResource* SDLCALL SDL_GetTextureDXGIResource(SDL_Texture *texture);
|
||||
|
||||
/**
|
||||
* Get the properties associated with a texture.
|
||||
*
|
||||
* \param texture the texture to query
|
||||
* \returns a valid property ID on success or 0 on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetProperty
|
||||
* \sa SDL_SetProperty
|
||||
*/
|
||||
extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetTextureProperties(SDL_Texture *texture);
|
||||
|
||||
/**
|
||||
* Query the attributes of a texture.
|
||||
*
|
||||
@@ -590,33 +617,6 @@ extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_Sc
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode);
|
||||
|
||||
/**
|
||||
* Associate a user-specified pointer with a texture.
|
||||
*
|
||||
* \param texture the texture to update.
|
||||
* \param userdata the pointer to associate with the texture.
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetTextureUserData
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetTextureUserData(SDL_Texture *texture, void *userdata);
|
||||
|
||||
/**
|
||||
* Get the user-specified pointer associated with a texture
|
||||
*
|
||||
* \param texture the texture to query.
|
||||
* \returns the pointer associated with the texture, or NULL if the texture is
|
||||
* not valid.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_SetTextureUserData
|
||||
*/
|
||||
extern DECLSPEC void *SDLCALL SDL_GetTextureUserData(SDL_Texture *texture);
|
||||
|
||||
/**
|
||||
* Update the given texture rectangle with new pixel data.
|
||||
*
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_properties.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
@@ -99,6 +100,7 @@ typedef struct SDL_RWops
|
||||
|
||||
Uint32 type;
|
||||
Uint32 status;
|
||||
SDL_PropertiesID props;
|
||||
union
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
@@ -331,6 +333,19 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_CreateRW(void);
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_DestroyRW(SDL_RWops *context);
|
||||
|
||||
/**
|
||||
* Get the properties associated with an SDL_RWops.
|
||||
*
|
||||
* \param context a pointer to an SDL_RWops structure
|
||||
* \returns a valid property ID on success or 0 on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetProperty
|
||||
* \sa SDL_SetProperty
|
||||
*/
|
||||
extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRWProperties(SDL_RWops *context);
|
||||
|
||||
#define SDL_RW_SEEK_SET 0 /**< Seek from the beginning of data */
|
||||
#define SDL_RW_SEEK_CUR 1 /**< Seek relative to current read point */
|
||||
#define SDL_RW_SEEK_END 2 /**< Seek relative to the end of data */
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_error.h>
|
||||
#include <SDL3/SDL_properties.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
@@ -189,6 +190,19 @@ extern DECLSPEC SDL_Sensor *SDLCALL SDL_OpenSensor(SDL_SensorID instance_id);
|
||||
*/
|
||||
extern DECLSPEC SDL_Sensor *SDLCALL SDL_GetSensorFromInstanceID(SDL_SensorID instance_id);
|
||||
|
||||
/**
|
||||
* Get the properties associated with a sensor.
|
||||
*
|
||||
* \param sensor The SDL_Sensor object
|
||||
* \returns a valid property ID on success or 0 on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetProperty
|
||||
* \sa SDL_SetProperty
|
||||
*/
|
||||
extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSensorProperties(SDL_Sensor *sensor);
|
||||
|
||||
/**
|
||||
* Get the implementation dependent name of a sensor
|
||||
*
|
||||
|
||||
@@ -29,9 +29,10 @@
|
||||
#define SDL_surface_h_
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_pixels.h>
|
||||
#include <SDL3/SDL_rect.h>
|
||||
#include <SDL3/SDL_blendmode.h>
|
||||
#include <SDL3/SDL_pixels.h>
|
||||
#include <SDL3/SDL_properties.h>
|
||||
#include <SDL3/SDL_rect.h>
|
||||
#include <SDL3/SDL_rwops.h>
|
||||
|
||||
#include <SDL3/SDL_begin_code.h>
|
||||
@@ -92,7 +93,7 @@ typedef struct SDL_Surface
|
||||
void *pixels; /**< Read-write */
|
||||
|
||||
/** Application data associated with the surface */
|
||||
void *userdata; /**< Read-write */
|
||||
SDL_PropertiesID props; /**< Read-write */
|
||||
|
||||
/** information needed for surfaces requiring locks */
|
||||
int locked; /**< Read-only */
|
||||
@@ -189,6 +190,19 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateSurfaceFrom
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_DestroySurface(SDL_Surface *surface);
|
||||
|
||||
/**
|
||||
* Get the properties associated with a surface.
|
||||
*
|
||||
* \param surface the SDL_Surface structure to query
|
||||
* \returns a valid property ID on success or 0 on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetProperty
|
||||
* \sa SDL_SetProperty
|
||||
*/
|
||||
extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSurfaceProperties(SDL_Surface *surface);
|
||||
|
||||
/**
|
||||
* Set the palette used by a surface.
|
||||
*
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_pixels.h>
|
||||
#include <SDL3/SDL_properties.h>
|
||||
#include <SDL3/SDL_rect.h>
|
||||
#include <SDL3/SDL_surface.h>
|
||||
|
||||
@@ -93,7 +94,6 @@ typedef enum
|
||||
* \sa SDL_CreateWindowWithPosition()
|
||||
* \sa SDL_DestroyWindow()
|
||||
* \sa SDL_FlashWindow()
|
||||
* \sa SDL_GetWindowData()
|
||||
* \sa SDL_GetWindowFlags()
|
||||
* \sa SDL_GetWindowGrab()
|
||||
* \sa SDL_GetWindowKeyboardGrab()
|
||||
@@ -106,7 +106,6 @@ typedef enum
|
||||
* \sa SDL_MinimizeWindow()
|
||||
* \sa SDL_RaiseWindow()
|
||||
* \sa SDL_RestoreWindow()
|
||||
* \sa SDL_SetWindowData()
|
||||
* \sa SDL_SetWindowFullscreen()
|
||||
* \sa SDL_SetWindowGrab()
|
||||
* \sa SDL_SetWindowKeyboardGrab()
|
||||
@@ -918,6 +917,19 @@ extern DECLSPEC SDL_Window *SDLCALL SDL_GetWindowFromID(SDL_WindowID id);
|
||||
*/
|
||||
extern DECLSPEC SDL_Window *SDLCALL SDL_GetWindowParent(SDL_Window *window);
|
||||
|
||||
/**
|
||||
* Get the properties associated with a window.
|
||||
*
|
||||
* \param window the window to query
|
||||
* \returns a valid property ID on success or 0 on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetProperty
|
||||
* \sa SDL_SetProperty
|
||||
*/
|
||||
extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetWindowProperties(SDL_Window *window);
|
||||
|
||||
/**
|
||||
* Get the window flags.
|
||||
*
|
||||
@@ -977,35 +989,6 @@ extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window *window);
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon);
|
||||
|
||||
/**
|
||||
* Associate an arbitrary named pointer with a window.
|
||||
*
|
||||
* `name` is case-sensitive.
|
||||
*
|
||||
* \param window the window to associate with the pointer
|
||||
* \param name the name of the pointer
|
||||
* \param userdata the associated pointer
|
||||
* \returns the previous value associated with `name`.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetWindowData
|
||||
*/
|
||||
extern DECLSPEC void *SDLCALL SDL_SetWindowData(SDL_Window *window, const char *name, void *userdata);
|
||||
|
||||
/**
|
||||
* Retrieve the data pointer associated with a window.
|
||||
*
|
||||
* \param window the window to query
|
||||
* \param name the name of the pointer
|
||||
* \returns the value associated with `name`.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_SetWindowData
|
||||
*/
|
||||
extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window *window, const char *name);
|
||||
|
||||
/**
|
||||
* Set the position of a window.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user