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 691747dc155b774d
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
     1.1 --- a/include/SDL_events.h	Mon Feb 25 00:47:47 2013 -0500
     1.2 +++ b/include/SDL_events.h	Mon Feb 25 00:56:21 2013 -0500
     1.3 @@ -314,7 +314,7 @@
     1.4      Uint32 type;        /**< ::SDL_CONTROLLERAXISMOTION */
     1.5      Uint32 timestamp;
     1.6      Uint8 which;        /**< The joystick instance id */
     1.7 -    SDL_CONTROLLER_AXIS axis;         /**< The joystick axis index */
     1.8 +    SDL_GameControllerAxis axis;         /**< The joystick axis index */
     1.9      int value;          /**< The axis value (range: -32768 to 32767) */
    1.10  } SDL_ControllerAxisEvent;
    1.11  
    1.12 @@ -327,7 +327,7 @@
    1.13      Uint32 type;        /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
    1.14      Uint32 timestamp;
    1.15      Uint8 which;        /**< The joystick instance id */
    1.16 -    SDL_CONTROLLER_BUTTON button;       /**< The joystick button index */
    1.17 +    SDL_GameControllerButton button;       /**< The joystick button index */
    1.18      Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
    1.19  } SDL_ControllerButtonEvent;
    1.20  
     2.1 --- a/include/SDL_gamecontroller.h	Mon Feb 25 00:47:47 2013 -0500
     2.2 +++ b/include/SDL_gamecontroller.h	Mon Feb 25 00:56:21 2013 -0500
     2.3 @@ -59,7 +59,8 @@
     2.4  	SDL_CONTROLLER_BINDTYPE_BUTTON,
     2.5  	SDL_CONTROLLER_BINDTYPE_AXIS,
     2.6  	SDL_CONTROLLER_BINDTYPE_HAT
     2.7 -} SDL_CONTROLLER_BINDTYPE;
     2.8 +} SDL_GameControllerBindType;
     2.9 +
    2.10  /**
    2.11   *  get the sdl joystick layer binding for this controller button/axis mapping
    2.12   */
    2.13 @@ -71,7 +72,7 @@
    2.14  
    2.15  typedef struct _SDL_GameControllerButtonBind
    2.16  {
    2.17 -	SDL_CONTROLLER_BINDTYPE m_eBindType;
    2.18 +	SDL_GameControllerBindType m_eBindType;
    2.19  	union
    2.20  	{
    2.21  		int button;
    2.22 @@ -172,19 +173,19 @@
    2.23  	SDL_CONTROLLER_AXIS_TRIGGERLEFT,
    2.24  	SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
    2.25  	SDL_CONTROLLER_AXIS_MAX
    2.26 -} SDL_CONTROLLER_AXIS;
    2.27 +} SDL_GameControllerAxis;
    2.28  
    2.29  /**
    2.30   *  turn this string into a axis mapping
    2.31   */
    2.32 -extern DECLSPEC SDL_CONTROLLER_AXIS SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
    2.33 +extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString);
    2.34  
    2.35  /**
    2.36   *  get the sdl joystick layer binding for this controller button mapping
    2.37   */
    2.38  extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
    2.39  SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
    2.40 -                                 SDL_CONTROLLER_AXIS button);
    2.41 +                                 SDL_GameControllerAxis axis);
    2.42  
    2.43  /**
    2.44   *  Get the current state of an axis control on a game controller.
    2.45 @@ -195,7 +196,7 @@
    2.46   */
    2.47  extern DECLSPEC Sint16 SDLCALL
    2.48  SDL_GameControllerGetAxis(SDL_GameController *gamecontroller,
    2.49 -                          SDL_CONTROLLER_AXIS axis);
    2.50 +                          SDL_GameControllerAxis axis);
    2.51  
    2.52  /**
    2.53   *  The list of buttons available from a controller
    2.54 @@ -219,12 +220,12 @@
    2.55  	SDL_CONTROLLER_BUTTON_DPAD_LEFT,
    2.56  	SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
    2.57  	SDL_CONTROLLER_BUTTON_MAX
    2.58 -} SDL_CONTROLLER_BUTTON;
    2.59 +} SDL_GameControllerButton;
    2.60  
    2.61  /**
    2.62   *  turn this string into a button mapping
    2.63   */
    2.64 -extern DECLSPEC SDL_CONTROLLER_BUTTON SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
    2.65 +extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString);
    2.66  
    2.67  
    2.68  /**
    2.69 @@ -232,7 +233,7 @@
    2.70   */
    2.71  extern DECLSPEC SDL_GameControllerButtonBind SDLCALL
    2.72  SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
    2.73 -                                   SDL_CONTROLLER_BUTTON button);
    2.74 +                                   SDL_GameControllerButton button);
    2.75  
    2.76  
    2.77  /**
    2.78 @@ -241,7 +242,7 @@
    2.79   *  The button indices start at index 0.
    2.80   */
    2.81  extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller,
    2.82 -                                                          SDL_CONTROLLER_BUTTON button);
    2.83 +                                                          SDL_GameControllerButton button);
    2.84  
    2.85  /**
    2.86   *  Close a controller previously opened with SDL_GameControllerOpen().
     3.1 --- a/src/joystick/SDL_gamecontroller.c	Mon Feb 25 00:47:47 2013 -0500
     3.2 +++ b/src/joystick/SDL_gamecontroller.c	Mon Feb 25 00:56:21 2013 -0500
     3.3 @@ -64,12 +64,12 @@
     3.4  	struct _SDL_HatMapping hatasbutton[SDL_CONTROLLER_BUTTON_MAX];
     3.5  
     3.6  	// reverse mapping, joystick indices to buttons
     3.7 -	SDL_CONTROLLER_AXIS raxes[k_nMaxReverseEntries];
     3.8 -	SDL_CONTROLLER_AXIS rbuttonasaxis[k_nMaxReverseEntries];
     3.9 +	SDL_GameControllerAxis raxes[k_nMaxReverseEntries];
    3.10 +	SDL_GameControllerAxis rbuttonasaxis[k_nMaxReverseEntries];
    3.11  
    3.12 -	SDL_CONTROLLER_BUTTON rbuttons[k_nMaxReverseEntries];
    3.13 -	SDL_CONTROLLER_BUTTON raxesasbutton[k_nMaxReverseEntries];
    3.14 -	SDL_CONTROLLER_BUTTON rhatasbutton[k_nMaxHatEntries];
    3.15 +	SDL_GameControllerButton rbuttons[k_nMaxReverseEntries];
    3.16 +	SDL_GameControllerButton raxesasbutton[k_nMaxReverseEntries];
    3.17 +	SDL_GameControllerButton rhatasbutton[k_nMaxHatEntries];
    3.18  
    3.19  };
    3.20  
    3.21 @@ -118,8 +118,8 @@
    3.22  };
    3.23  
    3.24  
    3.25 -int SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_CONTROLLER_AXIS axis, Sint16 value);
    3.26 -int	SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_CONTROLLER_BUTTON button, Uint8 state);
    3.27 +int SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value);
    3.28 +int	SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state);
    3.29  
    3.30  /*
    3.31   * Event filter to fire controller events from joystick ones
    3.32 @@ -296,7 +296,7 @@
    3.33  /*
    3.34   * convert a string to its enum equivalent
    3.35   */
    3.36 -SDL_CONTROLLER_AXIS SDL_GameControllerGetAxisFromString( const char *pchString )
    3.37 +SDL_GameControllerAxis SDL_GameControllerGetAxisFromString( const char *pchString )
    3.38  {
    3.39  	if ( !pchString || !pchString[0] )
    3.40  		return SDL_CONTROLLER_AXIS_INVALID;
    3.41 @@ -321,7 +321,7 @@
    3.42  /*
    3.43   * convert a string to its enum equivalent
    3.44   */
    3.45 -SDL_CONTROLLER_BUTTON SDL_GameControllerGetButtonFromString( const char *pchString )
    3.46 +SDL_GameControllerButton SDL_GameControllerGetButtonFromString( const char *pchString )
    3.47  {
    3.48  	if ( !pchString || !pchString[0] )
    3.49  		return SDL_CONTROLLER_BUTTON_INVALID;
    3.50 @@ -367,8 +367,8 @@
    3.51  void SDL_PrivateGameControllerParseButton( const char *szGameButton, const char *szJoystickButton, struct _SDL_ControllerMapping *pMapping )
    3.52  {
    3.53  	int iSDLButton = 0;
    3.54 -	SDL_CONTROLLER_BUTTON button;
    3.55 -	SDL_CONTROLLER_AXIS axis;
    3.56 +	SDL_GameControllerButton button;
    3.57 +	SDL_GameControllerAxis axis;
    3.58  	button = SDL_GameControllerGetButtonFromString( szGameButton );
    3.59  	axis = SDL_GameControllerGetAxisFromString( szGameButton );
    3.60  	iSDLButton = SDL_atoi( &szJoystickButton[1] );
    3.61 @@ -829,7 +829,7 @@
    3.62   * Get the current state of an axis control on a controller
    3.63   */
    3.64  Sint16
    3.65 -SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_CONTROLLER_AXIS axis)
    3.66 +SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis)
    3.67  {
    3.68  	if ( !gamecontroller )
    3.69  		return 0;
    3.70 @@ -854,7 +854,7 @@
    3.71   * Get the current state of a button on a controller
    3.72   */
    3.73  Uint8
    3.74 -SDL_GameControllerGetButton(SDL_GameController * gamecontroller, SDL_CONTROLLER_BUTTON button)
    3.75 +SDL_GameControllerGetButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button)
    3.76  {
    3.77  	if ( !gamecontroller )
    3.78  		return 0;
    3.79 @@ -925,7 +925,7 @@
    3.80  /**
    3.81   *  get the sdl joystick layer binding for this controller axi mapping
    3.82   */
    3.83 -SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis( SDL_GameController * gamecontroller, SDL_CONTROLLER_AXIS axis )
    3.84 +SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis)
    3.85  {
    3.86  	SDL_GameControllerButtonBind bind;
    3.87  	SDL_memset( &bind, 0x0, sizeof(bind) );
    3.88 @@ -951,7 +951,7 @@
    3.89  /**
    3.90   *  get the sdl joystick layer binding for this controller button mapping
    3.91   */
    3.92 -SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton( SDL_GameController * gamecontroller, SDL_CONTROLLER_BUTTON button )
    3.93 +SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button)
    3.94  {
    3.95  	SDL_GameControllerButtonBind bind;
    3.96  	SDL_memset( &bind, 0x0, sizeof(bind) );
    3.97 @@ -1053,7 +1053,7 @@
    3.98   * Event filter to transform joystick events into appropriate game controller ones
    3.99   */
   3.100  int
   3.101 -SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_CONTROLLER_AXIS axis, Sint16 value)
   3.102 +SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value)
   3.103  {
   3.104  	int posted;
   3.105  
   3.106 @@ -1077,7 +1077,7 @@
   3.107   * Event filter to transform joystick events into appropriate game controller ones
   3.108   */
   3.109  int
   3.110 -SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_CONTROLLER_BUTTON button, Uint8 state)
   3.111 +SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state)
   3.112  {
   3.113      int posted;
   3.114  #if !SDL_EVENTS_DISABLED
     4.1 --- a/test/testgamecontroller.c	Mon Feb 25 00:47:47 2013 -0500
     4.2 +++ b/test/testgamecontroller.c	Mon Feb 25 00:56:21 2013 -0500
     4.3 @@ -41,7 +41,7 @@
     4.4  }
     4.5  
     4.6  static const char *
     4.7 -ControllerAxisName(const SDL_CONTROLLER_AXIS axis)
     4.8 +ControllerAxisName(const SDL_GameControllerAxis axis)
     4.9  {
    4.10      switch (axis)
    4.11      {
    4.12 @@ -59,7 +59,7 @@
    4.13  }
    4.14  
    4.15  static const char *
    4.16 -ControllerButtonName(const SDL_CONTROLLER_BUTTON button)
    4.17 +ControllerButtonName(const SDL_GameControllerButton button)
    4.18  {
    4.19      switch (button)
    4.20      {