Changed the game controller enum types to match SDL naming conventions.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 25 Feb 2013 00:56:21 -0500
changeset 6917 47dc155b774d
parent 6916 92e978d6dafa
child 6918 6f4bf9b784f2
Changed the game controller enum types to match SDL naming conventions.
include/SDL_events.h
include/SDL_gamecontroller.h
src/joystick/SDL_gamecontroller.c
test/testgamecontroller.c
--- a/include/SDL_events.h	Mon Feb 25 00:47:47 2013 -0500
+++ b/include/SDL_events.h	Mon Feb 25 00:56:21 2013 -0500
@@ -314,7 +314,7 @@
     Uint32 type;        /**< ::SDL_CONTROLLERAXISMOTION */
     Uint32 timestamp;
     Uint8 which;        /**< The joystick instance id */
-    SDL_CONTROLLER_AXIS axis;         /**< The joystick axis index */
+    SDL_GameControllerAxis axis;         /**< The joystick axis index */
     int value;          /**< The axis value (range: -32768 to 32767) */
 } SDL_ControllerAxisEvent;
 
@@ -327,7 +327,7 @@
     Uint32 type;        /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
     Uint32 timestamp;
     Uint8 which;        /**< The joystick instance id */
-    SDL_CONTROLLER_BUTTON button;       /**< The joystick button index */
+    SDL_GameControllerButton button;       /**< The joystick button index */
     Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
 } SDL_ControllerButtonEvent;
 
--- a/include/SDL_gamecontroller.h	Mon Feb 25 00:47:47 2013 -0500
+++ b/include/SDL_gamecontroller.h	Mon Feb 25 00:56:21 2013 -0500
@@ -59,7 +59,8 @@
 	SDL_CONTROLLER_BINDTYPE_BUTTON,
 	SDL_CONTROLLER_BINDTYPE_AXIS,
 	SDL_CONTROLLER_BINDTYPE_HAT
-} SDL_CONTROLLER_BINDTYPE;
+} SDL_GameControllerBindType;
+
 /**
  *  get the sdl joystick layer binding for this controller button/axis mapping
  */
@@ -71,7 +72,7 @@
 
 typedef struct _SDL_GameControllerButtonBind
 {
-	SDL_CONTROLLER_BINDTYPE m_eBindType;
+	SDL_GameControllerBindType m_eBindType;
 	union
 	{
 		int button;
@@ -172,19 +173,19 @@
 	SDL_CONTROLLER_AXIS_TRIGGERLEFT,
 	SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
 	SDL_CONTROLLER_AXIS_MAX
-} SDL_CONTROLLER_AXIS;
+} SDL_GameControllerAxis;
 
 /**
  *  turn this string into a axis mapping
  */
-extern DECLSPEC SDL_CONTROLLER_AXIS SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
+extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
 
 /**
  *  get the sdl joystick layer binding for this controller button mapping
  */
 extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
 SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
-                                 SDL_CONTROLLER_AXIS button);
+                                 SDL_GameControllerAxis axis);
 
 /**
  *  Get the current state of an axis control on a game controller.
@@ -195,7 +196,7 @@
  */
 extern DECLSPEC Sint16 SDLCALL
 SDL_GameControllerGetAxis(SDL_GameController *gamecontroller,
-                          SDL_CONTROLLER_AXIS axis);
+                          SDL_GameControllerAxis axis);
 
 /**
  *  The list of buttons available from a controller
@@ -219,12 +220,12 @@
 	SDL_CONTROLLER_BUTTON_DPAD_LEFT,
 	SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
 	SDL_CONTROLLER_BUTTON_MAX
-} SDL_CONTROLLER_BUTTON;
+} SDL_GameControllerButton;
 
 /**
  *  turn this string into a button mapping
  */
-extern DECLSPEC SDL_CONTROLLER_BUTTON SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
+extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
 
 
 /**
@@ -232,7 +233,7 @@
  */
 extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
 SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
-                                   SDL_CONTROLLER_BUTTON button);
+                                   SDL_GameControllerButton button);
 
 
 /**
@@ -241,7 +242,7 @@
  *  The button indices start at index 0.
  */
 extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
-                                                          SDL_CONTROLLER_BUTTON button);
+                                                          SDL_GameControllerButton button);
 
 /**
  *  Close a controller previously opened with SDL_GameControllerOpen().
--- a/src/joystick/SDL_gamecontroller.c	Mon Feb 25 00:47:47 2013 -0500
+++ b/src/joystick/SDL_gamecontroller.c	Mon Feb 25 00:56:21 2013 -0500
@@ -64,12 +64,12 @@
 	struct _SDL_HatMapping hatasbutton[SDL_CONTROLLER_BUTTON_MAX];
 
 	// reverse mapping, joystick indices to buttons
-	SDL_CONTROLLER_AXIS raxes[k_nMaxReverseEntries];
-	SDL_CONTROLLER_AXIS rbuttonasaxis[k_nMaxReverseEntries];
+	SDL_GameControllerAxis raxes[k_nMaxReverseEntries];
+	SDL_GameControllerAxis rbuttonasaxis[k_nMaxReverseEntries];
 
-	SDL_CONTROLLER_BUTTON rbuttons[k_nMaxReverseEntries];
-	SDL_CONTROLLER_BUTTON raxesasbutton[k_nMaxReverseEntries];
-	SDL_CONTROLLER_BUTTON rhatasbutton[k_nMaxHatEntries];
+	SDL_GameControllerButton rbuttons[k_nMaxReverseEntries];
+	SDL_GameControllerButton raxesasbutton[k_nMaxReverseEntries];
+	SDL_GameControllerButton rhatasbutton[k_nMaxHatEntries];
 
 };
 
@@ -118,8 +118,8 @@
 };
 
 
-int SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_CONTROLLER_AXIS axis, Sint16 value);
-int	SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_CONTROLLER_BUTTON button, Uint8 state);
+int SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value);
+int	SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state);
 
 /*
  * Event filter to fire controller events from joystick ones
@@ -296,7 +296,7 @@
 /*
  * convert a string to its enum equivalent
  */
-SDL_CONTROLLER_AXIS SDL_GameControllerGetAxisFromString( const char *pchString )
+SDL_GameControllerAxis SDL_GameControllerGetAxisFromString( const char *pchString )
 {
 	if ( !pchString || !pchString[0] )
 		return SDL_CONTROLLER_AXIS_INVALID;
@@ -321,7 +321,7 @@
 /*
  * convert a string to its enum equivalent
  */
-SDL_CONTROLLER_BUTTON SDL_GameControllerGetButtonFromString( const char *pchString )
+SDL_GameControllerButton SDL_GameControllerGetButtonFromString( const char *pchString )
 {
 	if ( !pchString || !pchString[0] )
 		return SDL_CONTROLLER_BUTTON_INVALID;
@@ -367,8 +367,8 @@
 void SDL_PrivateGameControllerParseButton( const char *szGameButton, const char *szJoystickButton, struct _SDL_ControllerMapping *pMapping )
 {
 	int iSDLButton = 0;
-	SDL_CONTROLLER_BUTTON button;
-	SDL_CONTROLLER_AXIS axis;
+	SDL_GameControllerButton button;
+	SDL_GameControllerAxis axis;
 	button = SDL_GameControllerGetButtonFromString( szGameButton );
 	axis = SDL_GameControllerGetAxisFromString( szGameButton );
 	iSDLButton = SDL_atoi( &szJoystickButton[1] );
@@ -829,7 +829,7 @@
  * Get the current state of an axis control on a controller
  */
 Sint16
-SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_CONTROLLER_AXIS axis)
+SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis)
 {
 	if ( !gamecontroller )
 		return 0;
@@ -854,7 +854,7 @@
  * Get the current state of a button on a controller
  */
 Uint8
-SDL_GameControllerGetButton(SDL_GameController * gamecontroller, SDL_CONTROLLER_BUTTON button)
+SDL_GameControllerGetButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button)
 {
 	if ( !gamecontroller )
 		return 0;
@@ -925,7 +925,7 @@
 /**
  *  get the sdl joystick layer binding for this controller axi mapping
  */
-SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis( SDL_GameController * gamecontroller, SDL_CONTROLLER_AXIS axis )
+SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis)
 {
 	SDL_GameControllerButtonBind bind;
 	SDL_memset( &bind, 0x0, sizeof(bind) );
@@ -951,7 +951,7 @@
 /**
  *  get the sdl joystick layer binding for this controller button mapping
  */
-SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton( SDL_GameController * gamecontroller, SDL_CONTROLLER_BUTTON button )
+SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button)
 {
 	SDL_GameControllerButtonBind bind;
 	SDL_memset( &bind, 0x0, sizeof(bind) );
@@ -1053,7 +1053,7 @@
  * Event filter to transform joystick events into appropriate game controller ones
  */
 int
-SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_CONTROLLER_AXIS axis, Sint16 value)
+SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value)
 {
 	int posted;
 
@@ -1077,7 +1077,7 @@
  * Event filter to transform joystick events into appropriate game controller ones
  */
 int
-SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_CONTROLLER_BUTTON button, Uint8 state)
+SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state)
 {
     int posted;
 #if !SDL_EVENTS_DISABLED
--- a/test/testgamecontroller.c	Mon Feb 25 00:47:47 2013 -0500
+++ b/test/testgamecontroller.c	Mon Feb 25 00:56:21 2013 -0500
@@ -41,7 +41,7 @@
 }
 
 static const char *
-ControllerAxisName(const SDL_CONTROLLER_AXIS axis)
+ControllerAxisName(const SDL_GameControllerAxis axis)
 {
     switch (axis)
     {
@@ -59,7 +59,7 @@
 }
 
 static const char *
-ControllerButtonName(const SDL_CONTROLLER_BUTTON button)
+ControllerButtonName(const SDL_GameControllerButton button)
 {
     switch (button)
     {