Renamed SDL_AttachVirtualJoystickEx() to SDL_AttachVirtualJoystick()

The shorthand version of this function didn't allow specifying a controller name, which seems pretty important. It seems like anyone actually implementing a virtual joystick is going to want to use some of the extended functionality.
This commit is contained in:
Sam Lantinga
2024-05-09 13:51:33 -07:00
parent 598b4e0a1f
commit bcbf09acde
10 changed files with 18 additions and 62 deletions

View File

@@ -390,26 +390,6 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_GetJoystickFromInstanceID(SDL_Joystick
*/
extern DECLSPEC SDL_Joystick *SDLCALL SDL_GetJoystickFromPlayerIndex(int player_index);
/**
* Attach a new virtual joystick.
*
* \param type type of joystick
* \param naxes number of axes
* \param nbuttons number of buttons
* \param nhats number of hats
* \returns the joystick instance ID, or 0 if an error occurred; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_AttachVirtualJoystickEx
* \sa SDL_DetachVirtualJoystick
*/
extern DECLSPEC SDL_JoystickID SDLCALL SDL_AttachVirtualJoystick(SDL_JoystickType type,
int naxes,
int nbuttons,
int nhats);
/**
* The structure that defines an extended virtual joystick description
*
@@ -417,7 +397,7 @@ extern DECLSPEC SDL_JoystickID SDLCALL SDL_AttachVirtualJoystick(SDL_JoystickTyp
*
* \since This struct is available since SDL 3.0.0.
*
* \sa SDL_AttachVirtualJoystickEx
* \sa SDL_AttachVirtualJoystick
*/
typedef struct SDL_VirtualJoystickDesc
{
@@ -444,7 +424,7 @@ typedef struct SDL_VirtualJoystickDesc
} SDL_VirtualJoystickDesc;
/**
* Attach a new virtual joystick with extended properties.
* Attach a new virtual joystick.
*
* \param desc Joystick description
* \returns the joystick instance ID, or 0 if an error occurred; call
@@ -452,10 +432,9 @@ typedef struct SDL_VirtualJoystickDesc
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_AttachVirtualJoystick
* \sa SDL_DetachVirtualJoystick
*/
extern DECLSPEC SDL_JoystickID SDLCALL SDL_AttachVirtualJoystickEx(const SDL_VirtualJoystickDesc *desc);
extern DECLSPEC SDL_JoystickID SDLCALL SDL_AttachVirtualJoystick(const SDL_VirtualJoystickDesc *desc);
/**
* Detach a virtual joystick.
@@ -468,7 +447,6 @@ extern DECLSPEC SDL_JoystickID SDLCALL SDL_AttachVirtualJoystickEx(const SDL_Vir
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_AttachVirtualJoystick
* \sa SDL_AttachVirtualJoystickEx
*/
extern DECLSPEC int SDLCALL SDL_DetachVirtualJoystick(SDL_JoystickID instance_id);

View File

@@ -295,8 +295,7 @@
/* ##SDL_joystick.h */
#define SDL_JOYSTICK_TYPE_GAMECONTROLLER SDL_JOYSTICK_TYPE_GAMEPAD
#define SDL_JoystickAttachVirtual SDL_AttachVirtualJoystick
#define SDL_JoystickAttachVirtualEx SDL_AttachVirtualJoystickEx
#define SDL_JoystickAttachVirtualEx SDL_AttachVirtualJoystick
#define SDL_JoystickClose SDL_CloseJoystick
#define SDL_JoystickDetachVirtual SDL_DetachVirtualJoystick
#define SDL_JoystickFromInstanceID SDL_GetJoystickFromInstanceID
@@ -803,8 +802,7 @@
/* ##SDL_joystick.h */
#define SDL_JOYSTICK_TYPE_GAMECONTROLLER SDL_JOYSTICK_TYPE_GAMECONTROLLER_renamed_SDL_JOYSTICK_TYPE_GAMEPAD
#define SDL_JoystickAttachVirtual SDL_JoystickAttachVirtual_renamed_SDL_AttachVirtualJoystick
#define SDL_JoystickAttachVirtualEx SDL_JoystickAttachVirtualEx_renamed_SDL_AttachVirtualJoystickEx
#define SDL_JoystickAttachVirtualEx SDL_JoystickAttachVirtualEx_renamed_SDL_AttachVirtualJoystick
#define SDL_JoystickClose SDL_JoystickClose_renamed_SDL_CloseJoystick
#define SDL_JoystickDetachVirtual SDL_JoystickDetachVirtual_renamed_SDL_DetachVirtualJoystick
#define SDL_JoystickFromInstanceID SDL_JoystickFromInstanceID_renamed_SDL_GetJoystickFromInstanceID