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_Windowmain
parent
973c8b3273
commit
4368f70ff9
|
@ -2735,3 +2735,13 @@ typedef SDL_cond, SDL_Condition;
|
|||
- SDL_WriteBE64
|
||||
+ SDL_WriteU64BE
|
||||
(...)
|
||||
@@
|
||||
expression e, n;
|
||||
@@
|
||||
- SDL_GetWindowData(e, n)
|
||||
+ SDL_GetProperty(SDL_GetWindowProperties(e), n)
|
||||
@@
|
||||
expression e, n, v;
|
||||
@@
|
||||
- SDL_SetWindowData(e, n, v)
|
||||
+ SDL_SetProperty(SDL_GetWindowProperties(e), n, v, NULL, NULL)
|
||||
|
|
|
@ -854,9 +854,11 @@ The following functions have been renamed:
|
|||
* SDL_RenderWindowToLogical() => SDL_RenderCoordinatesFromWindow()
|
||||
|
||||
The following functions have been removed:
|
||||
* SDL_GetTextureUserData() - use SDL_GetTextureProperties() instead
|
||||
* SDL_RenderGetIntegerScale()
|
||||
* SDL_RenderSetIntegerScale() - this is now explicit with SDL_LOGICAL_PRESENTATION_INTEGER_SCALE
|
||||
* SDL_RenderTargetSupported() - render targets are always supported
|
||||
* SDL_SetTextureUserData() - use SDL_GetTextureProperties() instead
|
||||
|
||||
The following symbols have been renamed:
|
||||
* SDL_ScaleModeBest => SDL_SCALEMODE_BEST
|
||||
|
@ -1068,6 +1070,8 @@ The following functions have been renamed:
|
|||
|
||||
## SDL_surface.h
|
||||
|
||||
The userdata member of SDL_Surface has been replaced with a more general properties interface, which can be queried with SDL_GetSurfaceProperties()
|
||||
|
||||
Removed unused 'flags' parameter from SDL_ConvertSurface and SDL_ConvertSurfaceFormat.
|
||||
|
||||
SDL_CreateRGBSurface() and SDL_CreateRGBSurfaceWithFormat() have been combined into a new function SDL_CreateSurface().
|
||||
|
@ -1274,6 +1278,8 @@ The following functions have been removed:
|
|||
* SDL_GetDisplayMode()
|
||||
* SDL_GetNumDisplayModes() - replaced with SDL_GetFullscreenDisplayModes()
|
||||
* SDL_GetNumVideoDisplays() - replaced with SDL_GetDisplays()
|
||||
* SDL_GetWindowData() - use SDL_GetWindowProperties() instead
|
||||
* SDL_SetWindowData() - use SDL_GetWindowProperties() instead
|
||||
|
||||
SDL_Window id type is named SDL_WindowID
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -265,6 +265,11 @@ void *SDL_GetProperty(SDL_PropertiesID props, const char *name)
|
|||
return value;
|
||||
}
|
||||
|
||||
int SDL_ClearProperty(SDL_PropertiesID props, const char *name)
|
||||
{
|
||||
return SDL_SetProperty(props, name, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void SDL_DestroyProperties(SDL_PropertiesID props)
|
||||
{
|
||||
if (!props) {
|
||||
|
|
|
@ -438,6 +438,18 @@ SDL_AudioStream *SDL_CreateAudioStream(const SDL_AudioSpec *src_spec, const SDL_
|
|||
return retval;
|
||||
}
|
||||
|
||||
SDL_PropertiesID SDL_GetAudioStreamProperties(SDL_AudioStream *stream)
|
||||
{
|
||||
if (!stream) {
|
||||
SDL_InvalidParamError("stream");
|
||||
return 0;
|
||||
}
|
||||
if (stream->props == 0) {
|
||||
stream->props = SDL_CreateProperties();
|
||||
}
|
||||
return stream->props;
|
||||
}
|
||||
|
||||
int SDL_SetAudioStreamGetCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata)
|
||||
{
|
||||
if (!stream) {
|
||||
|
@ -1161,6 +1173,8 @@ void SDL_DestroyAudioStream(SDL_AudioStream *stream)
|
|||
return;
|
||||
}
|
||||
|
||||
SDL_DestroyProperties(stream->props);
|
||||
|
||||
OnAudioStreamDestroy(stream);
|
||||
|
||||
const SDL_bool simplified = stream->simplified;
|
||||
|
|
|
@ -170,6 +170,8 @@ struct SDL_AudioStream
|
|||
{
|
||||
SDL_Mutex* lock;
|
||||
|
||||
SDL_PropertiesID props;
|
||||
|
||||
SDL_AudioStreamCallback get_callback;
|
||||
void *get_callback_userdata;
|
||||
SDL_AudioStreamCallback put_callback;
|
||||
|
|
|
@ -330,7 +330,6 @@ SDL3_0.0.0 {
|
|||
SDL_GetTextureBlendMode;
|
||||
SDL_GetTextureColorMod;
|
||||
SDL_GetTextureScaleMode;
|
||||
SDL_GetTextureUserData;
|
||||
SDL_GetThreadID;
|
||||
SDL_GetThreadName;
|
||||
SDL_GetTicks;
|
||||
|
@ -342,7 +341,6 @@ SDL3_0.0.0 {
|
|||
SDL_GetVersion;
|
||||
SDL_GetVideoDriver;
|
||||
SDL_GetWindowBordersSize;
|
||||
SDL_GetWindowData;
|
||||
SDL_GetWindowDisplayScale;
|
||||
SDL_GetWindowFlags;
|
||||
SDL_GetWindowFromID;
|
||||
|
@ -601,11 +599,9 @@ SDL3_0.0.0 {
|
|||
SDL_SetTextureBlendMode;
|
||||
SDL_SetTextureColorMod;
|
||||
SDL_SetTextureScaleMode;
|
||||
SDL_SetTextureUserData;
|
||||
SDL_SetThreadPriority;
|
||||
SDL_SetWindowAlwaysOnTop;
|
||||
SDL_SetWindowBordered;
|
||||
SDL_SetWindowData;
|
||||
SDL_SetWindowFullscreen;
|
||||
SDL_SetWindowFullscreenMode;
|
||||
SDL_SetWindowGrab;
|
||||
|
@ -914,6 +910,16 @@ SDL3_0.0.0 {
|
|||
SDL_SetProperty;
|
||||
SDL_GetProperty;
|
||||
SDL_DestroyProperties;
|
||||
SDL_GetAudioStreamProperties;
|
||||
SDL_GetGamepadProperties;
|
||||
SDL_GetJoystickProperties;
|
||||
SDL_GetRendererProperties;
|
||||
SDL_GetTextureProperties;
|
||||
SDL_GetRWProperties;
|
||||
SDL_GetSensorProperties;
|
||||
SDL_GetSurfaceProperties;
|
||||
SDL_GetWindowProperties;
|
||||
SDL_ClearProperty;
|
||||
# extra symbols go here (don't modify this line)
|
||||
local: *;
|
||||
};
|
||||
|
|
|
@ -354,7 +354,6 @@
|
|||
#define SDL_GetTextureBlendMode SDL_GetTextureBlendMode_REAL
|
||||
#define SDL_GetTextureColorMod SDL_GetTextureColorMod_REAL
|
||||
#define SDL_GetTextureScaleMode SDL_GetTextureScaleMode_REAL
|
||||
#define SDL_GetTextureUserData SDL_GetTextureUserData_REAL
|
||||
#define SDL_GetThreadID SDL_GetThreadID_REAL
|
||||
#define SDL_GetThreadName SDL_GetThreadName_REAL
|
||||
#define SDL_GetTicks SDL_GetTicks_REAL
|
||||
|
@ -366,7 +365,6 @@
|
|||
#define SDL_GetVersion SDL_GetVersion_REAL
|
||||
#define SDL_GetVideoDriver SDL_GetVideoDriver_REAL
|
||||
#define SDL_GetWindowBordersSize SDL_GetWindowBordersSize_REAL
|
||||
#define SDL_GetWindowData SDL_GetWindowData_REAL
|
||||
#define SDL_GetWindowDisplayScale SDL_GetWindowDisplayScale_REAL
|
||||
#define SDL_GetWindowFlags SDL_GetWindowFlags_REAL
|
||||
#define SDL_GetWindowFromID SDL_GetWindowFromID_REAL
|
||||
|
@ -624,11 +622,9 @@
|
|||
#define SDL_SetTextureBlendMode SDL_SetTextureBlendMode_REAL
|
||||
#define SDL_SetTextureColorMod SDL_SetTextureColorMod_REAL
|
||||
#define SDL_SetTextureScaleMode SDL_SetTextureScaleMode_REAL
|
||||
#define SDL_SetTextureUserData SDL_SetTextureUserData_REAL
|
||||
#define SDL_SetThreadPriority SDL_SetThreadPriority_REAL
|
||||
#define SDL_SetWindowAlwaysOnTop SDL_SetWindowAlwaysOnTop_REAL
|
||||
#define SDL_SetWindowBordered SDL_SetWindowBordered_REAL
|
||||
#define SDL_SetWindowData SDL_SetWindowData_REAL
|
||||
#define SDL_SetWindowFullscreen SDL_SetWindowFullscreen_REAL
|
||||
#define SDL_SetWindowFullscreenMode SDL_SetWindowFullscreenMode_REAL
|
||||
#define SDL_SetWindowGrab SDL_SetWindowGrab_REAL
|
||||
|
@ -939,3 +935,13 @@
|
|||
#define SDL_SetProperty SDL_SetProperty_REAL
|
||||
#define SDL_GetProperty SDL_GetProperty_REAL
|
||||
#define SDL_DestroyProperties SDL_DestroyProperties_REAL
|
||||
#define SDL_GetAudioStreamProperties SDL_GetAudioStreamProperties_REAL
|
||||
#define SDL_GetGamepadProperties SDL_GetGamepadProperties_REAL
|
||||
#define SDL_GetJoystickProperties SDL_GetJoystickProperties_REAL
|
||||
#define SDL_GetRendererProperties SDL_GetRendererProperties_REAL
|
||||
#define SDL_GetTextureProperties SDL_GetTextureProperties_REAL
|
||||
#define SDL_GetRWProperties SDL_GetRWProperties_REAL
|
||||
#define SDL_GetSensorProperties SDL_GetSensorProperties_REAL
|
||||
#define SDL_GetSurfaceProperties SDL_GetSurfaceProperties_REAL
|
||||
#define SDL_GetWindowProperties SDL_GetWindowProperties_REAL
|
||||
#define SDL_ClearProperty SDL_ClearProperty_REAL
|
||||
|
|
|
@ -427,7 +427,6 @@ SDL_DYNAPI_PROC(int,SDL_GetTextureAlphaMod,(SDL_Texture *a, Uint8 *b),(a,b),retu
|
|||
SDL_DYNAPI_PROC(int,SDL_GetTextureBlendMode,(SDL_Texture *a, SDL_BlendMode *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetTextureColorMod,(SDL_Texture *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetTextureScaleMode,(SDL_Texture *a, SDL_ScaleMode *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_GetTextureUserData,(SDL_Texture *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_threadID,SDL_GetThreadID,(SDL_Thread *a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetThreadName,(SDL_Thread *a),(a),return)
|
||||
SDL_DYNAPI_PROC(Uint64,SDL_GetTicks,(void),(),return)
|
||||
|
@ -439,7 +438,6 @@ SDL_DYNAPI_PROC(const char*,SDL_GetTouchName,(int a),(a),return)
|
|||
SDL_DYNAPI_PROC(int,SDL_GetVersion,(SDL_version *a),(a),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetVideoDriver,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetWindowBordersSize,(SDL_Window *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_GetWindowData,(SDL_Window *a, const char *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(float,SDL_GetWindowDisplayScale,(SDL_Window *a),(a),return)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_GetWindowFlags,(SDL_Window *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Window*,SDL_GetWindowFromID,(Uint32 a),(a),return)
|
||||
|
@ -680,11 +678,9 @@ SDL_DYNAPI_PROC(int,SDL_SetTextureAlphaMod,(SDL_Texture *a, Uint8 b),(a,b),retur
|
|||
SDL_DYNAPI_PROC(int,SDL_SetTextureBlendMode,(SDL_Texture *a, SDL_BlendMode b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetTextureColorMod,(SDL_Texture *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetTextureScaleMode,(SDL_Texture *a, SDL_ScaleMode b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetTextureUserData,(SDL_Texture *a, void *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetThreadPriority,(SDL_ThreadPriority a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetWindowAlwaysOnTop,(SDL_Window *a, SDL_bool b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetWindowBordered,(SDL_Window *a, SDL_bool b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_SetWindowData,(SDL_Window *a, const char *b, void *c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetWindowFullscreen,(SDL_Window *a, SDL_bool b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetWindowFullscreenMode,(SDL_Window *a, const SDL_DisplayMode *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetWindowGrab,(SDL_Window *a, SDL_bool b),(a,b),return)
|
||||
|
@ -985,3 +981,13 @@ SDL_DYNAPI_PROC(void,SDL_UnlockProperties,(SDL_PropertiesID a),(a),)
|
|||
SDL_DYNAPI_PROC(int,SDL_SetProperty,(SDL_PropertiesID a, const char *b, void *c, void (SDLCALL *d)(void *userdata, void *value), void *e),(a,b,c,d,e),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_GetProperty,(SDL_PropertiesID a, const char *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_DestroyProperties,(SDL_PropertiesID a),(a),)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetAudioStreamProperties,(SDL_AudioStream *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetGamepadProperties,(SDL_Gamepad *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetJoystickProperties,(SDL_Joystick *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetRendererProperties,(SDL_Renderer *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetTextureProperties,(SDL_Texture *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetRWProperties,(SDL_RWops *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetSensorProperties,(SDL_Sensor *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetSurfaceProperties,(SDL_Surface *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetWindowProperties,(SDL_Window *a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_ClearProperty,(SDL_PropertiesID a, const char *b),(a,b),return)
|
||||
|
|
|
@ -619,6 +619,7 @@ SDL_RWops *SDL_CreateRW(void)
|
|||
|
||||
void SDL_DestroyRW(SDL_RWops *context)
|
||||
{
|
||||
SDL_DestroyProperties(context->props);
|
||||
SDL_free(context);
|
||||
}
|
||||
|
||||
|
@ -698,6 +699,19 @@ void *SDL_LoadFile(const char *file, size_t *datasize)
|
|||
return SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, SDL_TRUE);
|
||||
}
|
||||
|
||||
SDL_PropertiesID SDL_GetRWProperties(SDL_RWops *context)
|
||||
{
|
||||
if (!context) {
|
||||
SDL_InvalidParamError("context");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (context->props == 0) {
|
||||
context->props = SDL_CreateProperties();
|
||||
}
|
||||
return context->props;
|
||||
}
|
||||
|
||||
Sint64 SDL_RWsize(SDL_RWops *context)
|
||||
{
|
||||
if (!context) {
|
||||
|
|
|
@ -2925,6 +2925,21 @@ SDL_JoystickID SDL_GetGamepadInstanceID(SDL_Gamepad *gamepad)
|
|||
return SDL_GetJoystickInstanceID(joystick);
|
||||
}
|
||||
|
||||
SDL_PropertiesID SDL_GetGamepadProperties(SDL_Gamepad *gamepad)
|
||||
{
|
||||
SDL_PropertiesID retval = 0;
|
||||
|
||||
SDL_LockJoysticks();
|
||||
{
|
||||
CHECK_GAMEPAD_MAGIC(gamepad, 0);
|
||||
|
||||
retval = SDL_GetJoystickProperties(gamepad->joystick);
|
||||
}
|
||||
SDL_UnlockJoysticks();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
const char *SDL_GetGamepadName(SDL_Gamepad *gamepad)
|
||||
{
|
||||
const char *retval = NULL;
|
||||
|
|
|
@ -1213,6 +1213,27 @@ SDL_Joystick *SDL_GetJoystickFromPlayerIndex(int player_index)
|
|||
return joystick;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the properties associated with a joystick
|
||||
*/
|
||||
SDL_PropertiesID SDL_GetJoystickProperties(SDL_Joystick *joystick)
|
||||
{
|
||||
SDL_PropertiesID retval;
|
||||
|
||||
SDL_LockJoysticks();
|
||||
{
|
||||
CHECK_JOYSTICK_MAGIC(joystick, 0);
|
||||
|
||||
if (joystick->props == 0) {
|
||||
joystick->props = SDL_CreateProperties();
|
||||
}
|
||||
retval = joystick->props;
|
||||
}
|
||||
SDL_UnlockJoysticks();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the friendly name of this joystick
|
||||
*/
|
||||
|
@ -1465,6 +1486,8 @@ void SDL_CloseJoystick(SDL_Joystick *joystick)
|
|||
return;
|
||||
}
|
||||
|
||||
SDL_DestroyProperties(joystick->props);
|
||||
|
||||
if (joystick->rumble_expiration) {
|
||||
SDL_RumbleJoystick(joystick, 0, 0, 0);
|
||||
}
|
||||
|
|
|
@ -125,6 +125,8 @@ struct SDL_Joystick
|
|||
|
||||
struct joystick_hwdata *hwdata _guarded; /* Driver dependent information */
|
||||
|
||||
SDL_PropertiesID props _guarded;
|
||||
|
||||
int ref_count _guarded; /* Reference count for multiple opens */
|
||||
|
||||
struct SDL_Joystick *next _guarded; /* pointer to next joystick we have allocated */
|
||||
|
|
|
@ -929,7 +929,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 fl
|
|||
renderer->hidden = SDL_FALSE;
|
||||
}
|
||||
|
||||
SDL_SetWindowData(window, SDL_WINDOWRENDERDATA, renderer);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), SDL_WINDOWRENDERDATA, renderer, NULL, NULL);
|
||||
|
||||
SDL_SetRenderViewport(renderer, NULL);
|
||||
|
||||
|
@ -994,7 +994,7 @@ SDL_Renderer *SDL_CreateSoftwareRenderer(SDL_Surface *surface)
|
|||
|
||||
SDL_Renderer *SDL_GetRenderer(SDL_Window *window)
|
||||
{
|
||||
return (SDL_Renderer *)SDL_GetWindowData(window, SDL_WINDOWRENDERDATA);
|
||||
return (SDL_Renderer *)SDL_GetProperty(SDL_GetWindowProperties(window), SDL_WINDOWRENDERDATA);
|
||||
}
|
||||
|
||||
SDL_Window *SDL_GetRenderWindow(SDL_Renderer *renderer)
|
||||
|
@ -1007,10 +1007,20 @@ int SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info)
|
|||
{
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
*info = renderer->info;
|
||||
SDL_copyp(info, &renderer->info);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_PropertiesID SDL_GetRendererProperties(SDL_Renderer *renderer)
|
||||
{
|
||||
CHECK_RENDERER_MAGIC(renderer, 0);
|
||||
|
||||
if (renderer->props == 0) {
|
||||
renderer->props = SDL_CreateProperties();
|
||||
}
|
||||
return renderer->props;
|
||||
}
|
||||
|
||||
int SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h)
|
||||
{
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
@ -1365,6 +1375,16 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
|
|||
return texture;
|
||||
}
|
||||
|
||||
SDL_PropertiesID SDL_GetTextureProperties(SDL_Texture *texture)
|
||||
{
|
||||
CHECK_TEXTURE_MAGIC(texture, 0);
|
||||
|
||||
if (texture->props == 0) {
|
||||
texture->props = SDL_CreateProperties();
|
||||
}
|
||||
return texture->props;
|
||||
}
|
||||
|
||||
int SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h)
|
||||
{
|
||||
CHECK_TEXTURE_MAGIC(texture, -1);
|
||||
|
@ -1497,21 +1517,6 @@ int SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int SDL_SetTextureUserData(SDL_Texture *texture, void *userdata)
|
||||
{
|
||||
CHECK_TEXTURE_MAGIC(texture, -1);
|
||||
|
||||
texture->userdata = userdata;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *SDL_GetTextureUserData(SDL_Texture *texture)
|
||||
{
|
||||
CHECK_TEXTURE_MAGIC(texture, NULL);
|
||||
|
||||
return texture->userdata;
|
||||
}
|
||||
|
||||
#if SDL_HAVE_YUV
|
||||
static int SDL_UpdateTextureYUV(SDL_Texture *texture, const SDL_Rect *rect,
|
||||
const void *pixels, int pitch)
|
||||
|
@ -4021,6 +4026,8 @@ static int SDL_DestroyTextureInternal(SDL_Texture *texture, SDL_bool is_destroyi
|
|||
|
||||
CHECK_TEXTURE_MAGIC(texture, -1);
|
||||
|
||||
SDL_DestroyProperties(texture->props);
|
||||
|
||||
renderer = texture->renderer;
|
||||
if (is_destroying) {
|
||||
/* Renderer get destroyed, avoid to queue more commands */
|
||||
|
@ -4103,6 +4110,8 @@ void SDL_DestroyRenderer(SDL_Renderer *renderer)
|
|||
{
|
||||
CHECK_RENDERER_MAGIC(renderer,);
|
||||
|
||||
SDL_DestroyProperties(renderer->props);
|
||||
|
||||
SDL_DelEventWatch(SDL_RendererEventWatch, renderer);
|
||||
|
||||
SDL_DiscardAllCommands(renderer);
|
||||
|
@ -4118,7 +4127,7 @@ void SDL_DestroyRenderer(SDL_Renderer *renderer)
|
|||
SDL_free(renderer->vertex_data);
|
||||
|
||||
if (renderer->window) {
|
||||
SDL_SetWindowData(renderer->window, SDL_WINDOWRENDERDATA, NULL);
|
||||
SDL_ClearProperty(SDL_GetWindowProperties(renderer->window), SDL_WINDOWRENDERDATA);
|
||||
}
|
||||
|
||||
/* It's no longer magical... */
|
||||
|
|
|
@ -83,8 +83,9 @@ struct SDL_Texture
|
|||
|
||||
Uint32 last_command_generation; /* last command queue generation this texture was in. */
|
||||
|
||||
SDL_PropertiesID props;
|
||||
|
||||
void *driverdata; /**< Driver specific texture representation */
|
||||
void *userdata;
|
||||
|
||||
SDL_Texture *prev;
|
||||
SDL_Texture *next;
|
||||
|
@ -272,6 +273,8 @@ struct SDL_Renderer
|
|||
size_t vertex_data_used;
|
||||
size_t vertex_data_allocation;
|
||||
|
||||
SDL_PropertiesID props;
|
||||
|
||||
void *driverdata;
|
||||
};
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -211,9 +211,7 @@ SDL_Surface *SDL_CreateSurface(int width, int height, Uint32 format)
|
|||
* Create an RGB surface from an existing memory buffer using the given given
|
||||
* enum SDL_PIXELFORMAT_* format
|
||||
*/
|
||||
SDL_Surface *SDL_CreateSurfaceFrom(void *pixels,
|
||||
int width, int height, int pitch,
|
||||
Uint32 format)
|
||||
SDL_Surface *SDL_CreateSurfaceFrom(void *pixels, int width, int height, int pitch, Uint32 format)
|
||||
{
|
||||
SDL_Surface *surface;
|
||||
|
||||
|
@ -256,10 +254,23 @@ SDL_Surface *SDL_CreateSurfaceFrom(void *pixels,
|
|||
return surface;
|
||||
}
|
||||
|
||||
SDL_PropertiesID SDL_GetSurfaceProperties(SDL_Surface *surface)
|
||||
{
|
||||
if (surface == NULL) {
|
||||
SDL_InvalidParamError("surface");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (surface->props == 0) {
|
||||
surface->props = SDL_CreateProperties();
|
||||
}
|
||||
return surface->props;
|
||||
}
|
||||
|
||||
int SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette)
|
||||
{
|
||||
if (surface == NULL) {
|
||||
return SDL_InvalidParamError("SDL_SetSurfacePalette(): surface");
|
||||
return SDL_InvalidParamError("surface");
|
||||
}
|
||||
if (SDL_SetPixelFormatPalette(surface->format, palette) < 0) {
|
||||
return -1;
|
||||
|
@ -1550,13 +1561,14 @@ void SDL_DestroySurface(SDL_Surface *surface)
|
|||
if (surface->flags & SDL_DONTFREE) {
|
||||
return;
|
||||
}
|
||||
SDL_InvalidateMap(surface->map);
|
||||
|
||||
SDL_InvalidateAllBlitMap(surface);
|
||||
|
||||
if (--surface->refcount > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_DestroyProperties(surface->props);
|
||||
SDL_InvalidateMap(surface->map);
|
||||
SDL_InvalidateAllBlitMap(surface);
|
||||
|
||||
while (surface->locked > 0) {
|
||||
SDL_UnlockSurface(surface);
|
||||
}
|
||||
|
|
|
@ -58,13 +58,6 @@ struct SDL_ShapeDriver
|
|||
int (*SetWindowShape)(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode);
|
||||
};
|
||||
|
||||
typedef struct SDL_WindowUserData
|
||||
{
|
||||
char *name;
|
||||
void *data;
|
||||
struct SDL_WindowUserData *next;
|
||||
} SDL_WindowUserData;
|
||||
|
||||
/* Define the SDL window structure, corresponding to toplevel windows */
|
||||
struct SDL_Window
|
||||
{
|
||||
|
@ -111,7 +104,7 @@ struct SDL_Window
|
|||
SDL_HitTest hit_test;
|
||||
void *hit_test_data;
|
||||
|
||||
SDL_WindowUserData *data;
|
||||
SDL_PropertiesID props;
|
||||
|
||||
SDL_WindowData *driverdata;
|
||||
|
||||
|
|
|
@ -209,10 +209,25 @@ static Uint32 SDL_DefaultGraphicsBackends(SDL_VideoDevice *_this)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void SDL_CleanupWindowTextureData(void *userdata, void *value)
|
||||
{
|
||||
SDL_WindowTextureData *data = (SDL_WindowTextureData *)value;
|
||||
|
||||
if (data->texture) {
|
||||
SDL_DestroyTexture(data->texture);
|
||||
}
|
||||
if (data->renderer) {
|
||||
SDL_DestroyRenderer(data->renderer);
|
||||
}
|
||||
SDL_free(data->pixels);
|
||||
SDL_free(data);
|
||||
}
|
||||
|
||||
static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
|
||||
{
|
||||
SDL_RendererInfo info;
|
||||
SDL_WindowTextureData *data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA);
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
||||
SDL_WindowTextureData *data = (SDL_WindowTextureData *)SDL_GetProperty(props, SDL_WINDOWTEXTUREDATA);
|
||||
const int transparent = (window->flags & SDL_WINDOW_TRANSPARENT) ? SDL_TRUE : SDL_FALSE;
|
||||
int i;
|
||||
int w, h;
|
||||
|
@ -265,7 +280,7 @@ static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, U
|
|||
SDL_DestroyRenderer(renderer);
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_SetWindowData(window, SDL_WINDOWTEXTUREDATA, data);
|
||||
SDL_SetProperty(props, SDL_WINDOWTEXTUREDATA, data, SDL_CleanupWindowTextureData, NULL);
|
||||
|
||||
data->renderer = renderer;
|
||||
} else {
|
||||
|
@ -335,7 +350,7 @@ static int SDL_UpdateWindowTexture(SDL_VideoDevice *unused, SDL_Window *window,
|
|||
|
||||
SDL_GetWindowSizeInPixels(window, &w, &h);
|
||||
|
||||
data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA);
|
||||
data = SDL_GetProperty(SDL_GetWindowProperties(window), SDL_WINDOWTEXTUREDATA);
|
||||
if (data == NULL || !data->texture) {
|
||||
return SDL_SetError("No window texture data");
|
||||
}
|
||||
|
@ -360,27 +375,14 @@ static int SDL_UpdateWindowTexture(SDL_VideoDevice *unused, SDL_Window *window,
|
|||
|
||||
static void SDL_DestroyWindowTexture(SDL_VideoDevice *unused, SDL_Window *window)
|
||||
{
|
||||
SDL_WindowTextureData *data;
|
||||
|
||||
data = SDL_SetWindowData(window, SDL_WINDOWTEXTUREDATA, NULL);
|
||||
if (data == NULL) {
|
||||
return;
|
||||
}
|
||||
if (data->texture) {
|
||||
SDL_DestroyTexture(data->texture);
|
||||
}
|
||||
if (data->renderer) {
|
||||
SDL_DestroyRenderer(data->renderer);
|
||||
}
|
||||
SDL_free(data->pixels);
|
||||
SDL_free(data);
|
||||
SDL_ClearProperty(SDL_GetWindowProperties(window), SDL_WINDOWTEXTUREDATA);
|
||||
}
|
||||
|
||||
int SDL_SetWindowTextureVSync(SDL_Window *window, int vsync)
|
||||
{
|
||||
SDL_WindowTextureData *data;
|
||||
|
||||
data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA);
|
||||
data = SDL_GetProperty(SDL_GetWindowProperties(window), SDL_WINDOWTEXTUREDATA);
|
||||
if (data == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -2305,6 +2307,16 @@ SDL_Window *SDL_GetWindowParent(SDL_Window *window)
|
|||
return window->parent;
|
||||
}
|
||||
|
||||
SDL_PropertiesID SDL_GetWindowProperties(SDL_Window *window)
|
||||
{
|
||||
CHECK_WINDOW_MAGIC(window, 0);
|
||||
|
||||
if (window->props == 0) {
|
||||
window->props = SDL_CreateProperties();
|
||||
}
|
||||
return window->props;
|
||||
}
|
||||
|
||||
Uint32 SDL_GetWindowFlags(SDL_Window *window)
|
||||
{
|
||||
CHECK_WINDOW_MAGIC(window, 0);
|
||||
|
@ -2360,72 +2372,6 @@ int SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon)
|
|||
return _this->SetWindowIcon(_this, window, window->icon);
|
||||
}
|
||||
|
||||
void *SDL_SetWindowData(SDL_Window *window, const char *name, void *userdata)
|
||||
{
|
||||
SDL_WindowUserData *prev, *data;
|
||||
|
||||
CHECK_WINDOW_MAGIC(window, NULL);
|
||||
|
||||
/* Input validation */
|
||||
if (name == NULL || name[0] == '\0') {
|
||||
SDL_InvalidParamError("name");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* See if the named data already exists */
|
||||
prev = NULL;
|
||||
for (data = window->data; data; prev = data, data = data->next) {
|
||||
if (data->name && SDL_strcmp(data->name, name) == 0) {
|
||||
void *last_value = data->data;
|
||||
|
||||
if (userdata) {
|
||||
/* Set the new value */
|
||||
data->data = userdata;
|
||||
} else {
|
||||
/* Delete this value */
|
||||
if (prev) {
|
||||
prev->next = data->next;
|
||||
} else {
|
||||
window->data = data->next;
|
||||
}
|
||||
SDL_free(data->name);
|
||||
SDL_free(data);
|
||||
}
|
||||
return last_value;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add new data to the window */
|
||||
if (userdata) {
|
||||
data = (SDL_WindowUserData *)SDL_malloc(sizeof(*data));
|
||||
data->name = SDL_strdup(name);
|
||||
data->data = userdata;
|
||||
data->next = window->data;
|
||||
window->data = data;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *SDL_GetWindowData(SDL_Window *window, const char *name)
|
||||
{
|
||||
SDL_WindowUserData *data;
|
||||
|
||||
CHECK_WINDOW_MAGIC(window, NULL);
|
||||
|
||||
/* Input validation */
|
||||
if (name == NULL || name[0] == '\0') {
|
||||
SDL_InvalidParamError("name");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (data = window->data; data; data = data->next) {
|
||||
if (data->name && SDL_strcmp(data->name, name) == 0) {
|
||||
return data->data;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int SDL_SetWindowPosition(SDL_Window *window, int x, int y)
|
||||
{
|
||||
SDL_DisplayID original_displayID;
|
||||
|
@ -3657,13 +3603,6 @@ void SDL_DestroyWindow(SDL_Window *window)
|
|||
/* Free memory associated with the window */
|
||||
SDL_free(window->title);
|
||||
SDL_DestroySurface(window->icon);
|
||||
while (window->data) {
|
||||
SDL_WindowUserData *data = window->data;
|
||||
|
||||
window->data = data->next;
|
||||
SDL_free(data->name);
|
||||
SDL_free(data);
|
||||
}
|
||||
|
||||
/* Unlink the window from the list */
|
||||
if (window->next) {
|
||||
|
|
|
@ -27,16 +27,20 @@
|
|||
|
||||
#define DUMMY_SURFACE "_SDL_DummySurface"
|
||||
|
||||
static void CleanupSurface(void *userdata, void *value)
|
||||
{
|
||||
SDL_Surface *surface = (SDL_Surface *)value;
|
||||
|
||||
SDL_DestroySurface(surface);
|
||||
}
|
||||
|
||||
int SDL_DUMMY_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
|
||||
{
|
||||
SDL_Surface *surface;
|
||||
const Uint32 surface_format = SDL_PIXELFORMAT_XRGB8888;
|
||||
int w, h;
|
||||
|
||||
/* Free the old framebuffer surface */
|
||||
SDL_DUMMY_DestroyWindowFramebuffer(_this, window);
|
||||
|
||||
/* Create a new one */
|
||||
/* Create a new framebuffer */
|
||||
SDL_GetWindowSizeInPixels(window, &w, &h);
|
||||
surface = SDL_CreateSurface(w, h, surface_format);
|
||||
if (surface == NULL) {
|
||||
|
@ -44,7 +48,7 @@ int SDL_DUMMY_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window
|
|||
}
|
||||
|
||||
/* Save the info and return! */
|
||||
SDL_SetWindowData(window, DUMMY_SURFACE, surface);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), DUMMY_SURFACE, surface, CleanupSurface, NULL);
|
||||
*format = surface_format;
|
||||
*pixels = surface->pixels;
|
||||
*pitch = surface->pitch;
|
||||
|
@ -56,7 +60,7 @@ int SDL_DUMMY_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window
|
|||
static int frame_number;
|
||||
SDL_Surface *surface;
|
||||
|
||||
surface = (SDL_Surface *)SDL_GetWindowData(window, DUMMY_SURFACE);
|
||||
surface = (SDL_Surface *)SDL_GetProperty(SDL_GetWindowProperties(window), DUMMY_SURFACE);
|
||||
if (surface == NULL) {
|
||||
return SDL_SetError("Couldn't find dummy surface for window");
|
||||
}
|
||||
|
@ -73,10 +77,7 @@ int SDL_DUMMY_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window
|
|||
|
||||
void SDL_DUMMY_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
{
|
||||
SDL_Surface *surface;
|
||||
|
||||
surface = (SDL_Surface *)SDL_SetWindowData(window, DUMMY_SURFACE, NULL);
|
||||
SDL_DestroySurface(surface);
|
||||
SDL_ClearProperty(SDL_GetWindowProperties(window), DUMMY_SURFACE);
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_DUMMY */
|
||||
|
|
|
@ -33,44 +33,37 @@ typedef struct
|
|||
int width, height;
|
||||
} Dimensions;
|
||||
|
||||
static void FreePreviousWindowFramebuffer(SDL_Window *window);
|
||||
static SDL_Surface *CreateNewWindowFramebuffer(SDL_Window *window);
|
||||
static void CopyFramebuffertoN3DS(u32 *dest, const Dimensions dest_dim, const u32 *source, const Dimensions source_dim);
|
||||
static int GetDestOffset(int x, int y, int dest_width);
|
||||
static int GetSourceOffset(int x, int y, int source_width);
|
||||
static void FlushN3DSBuffer(const void *buffer, u32 bufsize, gfxScreen_t screen);
|
||||
|
||||
static void CleanupSurface(void *userdata, void *value)
|
||||
{
|
||||
SDL_Surface *surface = (SDL_Surface *)value;
|
||||
|
||||
SDL_DestroySurface(surface);
|
||||
}
|
||||
|
||||
int SDL_N3DS_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
|
||||
{
|
||||
SDL_Surface *framebuffer;
|
||||
int w, h;
|
||||
|
||||
FreePreviousWindowFramebuffer(window);
|
||||
framebuffer = CreateNewWindowFramebuffer(window);
|
||||
SDL_GetWindowSizeInPixels(window, &w, &h);
|
||||
framebuffer = SDL_CreateSurface(w, h, FRAMEBUFFER_FORMAT);
|
||||
|
||||
if (framebuffer == NULL) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
SDL_SetWindowData(window, N3DS_SURFACE, framebuffer);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), N3DS_SURFACE, framebuffer, CleanupSurface, NULL);
|
||||
*format = FRAMEBUFFER_FORMAT;
|
||||
*pixels = framebuffer->pixels;
|
||||
*pitch = framebuffer->pitch;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void FreePreviousWindowFramebuffer(SDL_Window *window)
|
||||
{
|
||||
SDL_Surface *surface = (SDL_Surface *)SDL_GetWindowData(window, N3DS_SURFACE);
|
||||
SDL_DestroySurface(surface);
|
||||
}
|
||||
|
||||
static SDL_Surface *CreateNewWindowFramebuffer(SDL_Window *window)
|
||||
{
|
||||
int w, h;
|
||||
SDL_GetWindowSizeInPixels(window, &w, &h);
|
||||
return SDL_CreateSurface(w, h, FRAMEBUFFER_FORMAT);
|
||||
}
|
||||
|
||||
int SDL_N3DS_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects)
|
||||
{
|
||||
SDL_WindowData *drv_data = window->driverdata;
|
||||
|
@ -79,7 +72,7 @@ int SDL_N3DS_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window,
|
|||
u32 *framebuffer;
|
||||
u32 bufsize;
|
||||
|
||||
surface = (SDL_Surface *)SDL_GetWindowData(window, N3DS_SURFACE);
|
||||
surface = (SDL_Surface *)SDL_GetProperty(SDL_GetWindowProperties(window), N3DS_SURFACE);
|
||||
if (surface == NULL) {
|
||||
return SDL_SetError("%s: Unable to get the window surface.", __func__);
|
||||
}
|
||||
|
@ -127,9 +120,7 @@ static void FlushN3DSBuffer(const void *buffer, u32 bufsize, gfxScreen_t screen)
|
|||
|
||||
void SDL_N3DS_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
{
|
||||
SDL_Surface *surface;
|
||||
surface = (SDL_Surface *)SDL_SetWindowData(window, N3DS_SURFACE, NULL);
|
||||
SDL_DestroySurface(surface);
|
||||
SDL_ClearProperty(SDL_GetWindowProperties(window), N3DS_SURFACE);
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_N3DS */
|
||||
|
|
|
@ -27,16 +27,20 @@
|
|||
|
||||
#define OFFSCREEN_SURFACE "_SDL_DummySurface"
|
||||
|
||||
static void CleanupSurface(void *userdata, void *value)
|
||||
{
|
||||
SDL_Surface *surface = (SDL_Surface *)value;
|
||||
|
||||
SDL_DestroySurface(surface);
|
||||
}
|
||||
|
||||
int SDL_OFFSCREEN_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
|
||||
{
|
||||
SDL_Surface *surface;
|
||||
const Uint32 surface_format = SDL_PIXELFORMAT_XRGB8888;
|
||||
int w, h;
|
||||
|
||||
/* Free the old framebuffer surface */
|
||||
SDL_OFFSCREEN_DestroyWindowFramebuffer(_this, window);
|
||||
|
||||
/* Create a new one */
|
||||
/* Create a new framebuffer */
|
||||
SDL_GetWindowSizeInPixels(window, &w, &h);
|
||||
surface = SDL_CreateSurface(w, h, surface_format);
|
||||
if (surface == NULL) {
|
||||
|
@ -44,7 +48,7 @@ int SDL_OFFSCREEN_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *wi
|
|||
}
|
||||
|
||||
/* Save the info and return! */
|
||||
SDL_SetWindowData(window, OFFSCREEN_SURFACE, surface);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), OFFSCREEN_SURFACE, surface, CleanupSurface, NULL);
|
||||
*format = surface_format;
|
||||
*pixels = surface->pixels;
|
||||
*pitch = surface->pitch;
|
||||
|
@ -57,7 +61,7 @@ int SDL_OFFSCREEN_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *wi
|
|||
static int frame_number;
|
||||
SDL_Surface *surface;
|
||||
|
||||
surface = (SDL_Surface *)SDL_GetWindowData(window, OFFSCREEN_SURFACE);
|
||||
surface = (SDL_Surface *)SDL_GetProperty(SDL_GetWindowProperties(window), OFFSCREEN_SURFACE);
|
||||
if (surface == NULL) {
|
||||
return SDL_SetError("Couldn't find offscreen surface for window");
|
||||
}
|
||||
|
@ -74,10 +78,7 @@ int SDL_OFFSCREEN_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *wi
|
|||
|
||||
void SDL_OFFSCREEN_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
{
|
||||
SDL_Surface *surface;
|
||||
|
||||
surface = (SDL_Surface *)SDL_SetWindowData(window, OFFSCREEN_SURFACE, NULL);
|
||||
SDL_DestroySurface(surface);
|
||||
SDL_ClearProperty(SDL_GetWindowProperties(window), OFFSCREEN_SURFACE);
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_OFFSCREEN */
|
||||
|
|
|
@ -1492,21 +1492,21 @@ static int video_getSetWindowData(void *arg)
|
|||
}
|
||||
|
||||
/* Get non-existent data */
|
||||
result = (char *)SDL_GetWindowData(window, name);
|
||||
result = (char *)SDL_GetProperty(SDL_GetWindowProperties(window), name);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s)", name);
|
||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||
|
||||
/* Set data */
|
||||
result = (char *)SDL_SetWindowData(window, name, userdata);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), name, userdata, NULL, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s)", name, userdata);
|
||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
|
||||
|
||||
/* Get data (twice) */
|
||||
for (iteration = 1; iteration <= 2; iteration++) {
|
||||
result = (char *)SDL_GetWindowData(window, name);
|
||||
result = (char *)SDL_GetProperty(SDL_GetWindowProperties(window),
|
||||
name);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s) [iteration %d]", name, iteration);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||
|
@ -1514,130 +1514,104 @@ static int video_getSetWindowData(void *arg)
|
|||
|
||||
/* Set data again twice */
|
||||
for (iteration = 1; iteration <= 2; iteration++) {
|
||||
result = (char *)SDL_SetWindowData(window, name, userdata);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), name, userdata, NULL, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [iteration %d]", name, userdata, iteration);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
|
||||
}
|
||||
|
||||
/* Get data again */
|
||||
result = (char *)SDL_GetWindowData(window, name);
|
||||
result = (char *)SDL_GetProperty(SDL_GetWindowProperties(window), name);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s) [again]", name);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||
|
||||
/* Set data with new data */
|
||||
result = (char *)SDL_SetWindowData(window, name, userdata2);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), name, userdata2, NULL, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [new userdata]", name, userdata2);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
|
||||
|
||||
/* Set data with new data again */
|
||||
result = (char *)SDL_SetWindowData(window, name, userdata2);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), name, userdata2, NULL, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [new userdata again]", name, userdata2);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata2, result);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
|
||||
|
||||
/* Get new data */
|
||||
result = (char *)SDL_GetWindowData(window, name);
|
||||
result = (char *)SDL_GetProperty(SDL_GetWindowProperties(window), name);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s)", name);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata2, result);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||
|
||||
/* Set data with NULL to clear */
|
||||
result = (char *)SDL_SetWindowData(window, name, NULL);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), name, NULL, NULL, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,NULL)", name);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata2, result);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
|
||||
|
||||
/* Set data with NULL to clear again */
|
||||
result = (char *)SDL_SetWindowData(window, name, NULL);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), name, NULL, NULL, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,NULL) [again]", name);
|
||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata2, userdata2) == 0, "Validate that userdata2 was not changed, expected: %s, got: %s", referenceUserdata2, userdata2);
|
||||
|
||||
/* Get non-existent data */
|
||||
result = (char *)SDL_GetWindowData(window, name);
|
||||
result = (char *)SDL_GetProperty(SDL_GetWindowProperties(window), name);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s)", name);
|
||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||
|
||||
/* Get non-existent data new name */
|
||||
result = (char *)SDL_GetWindowData(window, name2);
|
||||
result = (char *)SDL_GetProperty(SDL_GetWindowProperties(window), name2);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s)", name2);
|
||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceName2, name2) == 0, "Validate that name2 was not changed, expected: %s, got: %s", referenceName2, name2);
|
||||
|
||||
/* Set data (again) */
|
||||
result = (char *)SDL_SetWindowData(window, name, userdata);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), name, userdata, NULL, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowData(...%s,%s) [again, after clear]", name, userdata);
|
||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, userdata) == 0, "Validate that userdata was not changed, expected: %s, got: %s", referenceUserdata, userdata);
|
||||
|
||||
/* Get data (again) */
|
||||
result = (char *)SDL_GetWindowData(window, name);
|
||||
result = (char *)SDL_GetProperty(SDL_GetWindowProperties(window), name);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowData(..,%s) [again, after clear]", name);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceUserdata, result) == 0, "Validate that correct result was returned; expected: %s, got: %s", referenceUserdata, result);
|
||||
SDLTest_AssertCheck(SDL_strcmp(referenceName, name) == 0, "Validate that name was not changed, expected: %s, got: %s", referenceName, name);
|
||||
|
||||
/* Negative test */
|
||||
SDL_ClearError();
|
||||
SDLTest_AssertPass("Call to SDL_ClearError()");
|
||||
|
||||
/* Set with invalid window */
|
||||
result = (char *)SDL_SetWindowData(NULL, name, userdata);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowData(window=NULL)");
|
||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||
checkInvalidWindowError();
|
||||
|
||||
/* Set data with NULL name, valid userdata */
|
||||
result = (char *)SDL_SetWindowData(window, NULL, userdata);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), NULL, userdata, NULL, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowData(name=NULL)");
|
||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||
checkInvalidParameterError();
|
||||
|
||||
/* Set data with empty name, valid userdata */
|
||||
result = (char *)SDL_SetWindowData(window, "", userdata);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), "", userdata, NULL, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowData(name='')");
|
||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||
checkInvalidParameterError();
|
||||
|
||||
/* Set data with NULL name, NULL userdata */
|
||||
result = (char *)SDL_SetWindowData(window, NULL, NULL);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), NULL, NULL, NULL, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowData(name=NULL,userdata=NULL)");
|
||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||
checkInvalidParameterError();
|
||||
|
||||
/* Set data with empty name, NULL userdata */
|
||||
result = (char *)SDL_SetWindowData(window, "", NULL);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), "", NULL, NULL, NULL);
|
||||
SDLTest_AssertPass("Call to SDL_SetWindowData(name='',userdata=NULL)");
|
||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||
checkInvalidParameterError();
|
||||
|
||||
/* Get with invalid window */
|
||||
result = (char *)SDL_GetWindowData(NULL, name);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowData(window=NULL)");
|
||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||
checkInvalidWindowError();
|
||||
|
||||
/* Get data with NULL name */
|
||||
result = (char *)SDL_GetWindowData(window, NULL);
|
||||
result = (char *)SDL_GetProperty(SDL_GetWindowProperties(window), NULL);
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowData(name=NULL)");
|
||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||
checkInvalidParameterError();
|
||||
|
||||
/* Get data with empty name */
|
||||
result = (char *)SDL_GetWindowData(window, "");
|
||||
result = (char *)SDL_GetProperty(SDL_GetWindowProperties(window), "");
|
||||
SDLTest_AssertPass("Call to SDL_GetWindowData(name='')");
|
||||
SDLTest_AssertCheck(result == NULL, "Validate that result is NULL");
|
||||
checkInvalidParameterError();
|
||||
|
|
Loading…
Reference in New Issue