include/SDL_gamecontroller.h
changeset 7191 75360622e65f
parent 7174 3dfec8235a71
child 7341 675c85d46f30
     1.1 --- a/include/SDL_gamecontroller.h	Sat May 18 12:48:50 2013 -0700
     1.2 +++ b/include/SDL_gamecontroller.h	Sat May 18 14:17:52 2013 -0700
     1.3 @@ -35,9 +35,7 @@
     1.4  #include "begin_code.h"
     1.5  /* Set up for C function definitions, even when using C++ */
     1.6  #ifdef __cplusplus
     1.7 -/* *INDENT-OFF* */
     1.8  extern "C" {
     1.9 -/* *INDENT-ON* */
    1.10  #endif
    1.11  
    1.12  /**
    1.13 @@ -55,10 +53,10 @@
    1.14  
    1.15  typedef enum
    1.16  {
    1.17 -	SDL_CONTROLLER_BINDTYPE_NONE = 0,
    1.18 -	SDL_CONTROLLER_BINDTYPE_BUTTON,
    1.19 -	SDL_CONTROLLER_BINDTYPE_AXIS,
    1.20 -	SDL_CONTROLLER_BINDTYPE_HAT
    1.21 +    SDL_CONTROLLER_BINDTYPE_NONE = 0,
    1.22 +    SDL_CONTROLLER_BINDTYPE_BUTTON,
    1.23 +    SDL_CONTROLLER_BINDTYPE_AXIS,
    1.24 +    SDL_CONTROLLER_BINDTYPE_HAT
    1.25  } SDL_GameControllerBindType;
    1.26  
    1.27  /**
    1.28 @@ -66,43 +64,43 @@
    1.29   */
    1.30  typedef struct SDL_GameControllerButtonBind
    1.31  {
    1.32 -	SDL_GameControllerBindType bindType;
    1.33 -	union
    1.34 -	{
    1.35 -		int button;
    1.36 -		int axis;
    1.37 -		struct {
    1.38 +    SDL_GameControllerBindType bindType;
    1.39 +    union
    1.40 +    {
    1.41 +        int button;
    1.42 +        int axis;
    1.43 +        struct {
    1.44              int hat;
    1.45              int hat_mask;
    1.46          } hat;
    1.47 -	} value;
    1.48 +    } value;
    1.49  
    1.50  } SDL_GameControllerButtonBind;
    1.51  
    1.52  
    1.53  /**
    1.54   *  To count the number of game controllers in the system for the following:
    1.55 - *	int nJoysticks = SDL_NumJoysticks();
    1.56 - *	int nGameControllers = 0;
    1.57 - *	for ( int i = 0; i < nJoysticks; i++ ) {
    1.58 - *		if ( SDL_IsGameController(i) ) {
    1.59 - *			nGameControllers++;
    1.60 - *		}
    1.61 + *  int nJoysticks = SDL_NumJoysticks();
    1.62 + *  int nGameControllers = 0;
    1.63 + *  for ( int i = 0; i < nJoysticks; i++ ) {
    1.64 + *      if ( SDL_IsGameController(i) ) {
    1.65 + *          nGameControllers++;
    1.66 + *      }
    1.67   *  }
    1.68   *
    1.69   *  Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is:
    1.70 - *	guid,name,mappings
    1.71 + *  guid,name,mappings
    1.72   *
    1.73   *  Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones.
    1.74   *  Under Windows there is a reserved GUID of "xinput" that covers any XInput devices.
    1.75 - *	The mapping format for joystick is:
    1.76 - *		bX - a joystick button, index X
    1.77 - *		hX.Y - hat X with value Y
    1.78 - *		aX - axis X of the joystick
    1.79 + *  The mapping format for joystick is:
    1.80 + *      bX - a joystick button, index X
    1.81 + *      hX.Y - hat X with value Y
    1.82 + *      aX - axis X of the joystick
    1.83   *  Buttons can be used as a controller axis and vice versa.
    1.84   *
    1.85   *  This string shows an example of a valid mapping for a controller
    1.86 - * 	"341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
    1.87 + *  "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7",
    1.88   *
    1.89   */
    1.90  
    1.91 @@ -179,7 +177,7 @@
    1.92  
    1.93  /**
    1.94   *  Update the current state of the open game controllers.
    1.95 - *  
    1.96 + *
    1.97   *  This is called automatically by the event loop if any game controller
    1.98   *  events are enabled.
    1.99   */
   1.100 @@ -191,14 +189,14 @@
   1.101   */
   1.102  typedef enum
   1.103  {
   1.104 -	SDL_CONTROLLER_AXIS_INVALID = -1,
   1.105 -	SDL_CONTROLLER_AXIS_LEFTX,
   1.106 -	SDL_CONTROLLER_AXIS_LEFTY,
   1.107 -	SDL_CONTROLLER_AXIS_RIGHTX,
   1.108 -	SDL_CONTROLLER_AXIS_RIGHTY,
   1.109 -	SDL_CONTROLLER_AXIS_TRIGGERLEFT,
   1.110 -	SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
   1.111 -	SDL_CONTROLLER_AXIS_MAX
   1.112 +    SDL_CONTROLLER_AXIS_INVALID = -1,
   1.113 +    SDL_CONTROLLER_AXIS_LEFTX,
   1.114 +    SDL_CONTROLLER_AXIS_LEFTY,
   1.115 +    SDL_CONTROLLER_AXIS_RIGHTX,
   1.116 +    SDL_CONTROLLER_AXIS_RIGHTY,
   1.117 +    SDL_CONTROLLER_AXIS_TRIGGERLEFT,
   1.118 +    SDL_CONTROLLER_AXIS_TRIGGERRIGHT,
   1.119 +    SDL_CONTROLLER_AXIS_MAX
   1.120  } SDL_GameControllerAxis;
   1.121  
   1.122  /**
   1.123 @@ -234,23 +232,23 @@
   1.124   */
   1.125  typedef enum
   1.126  {
   1.127 -	SDL_CONTROLLER_BUTTON_INVALID = -1,
   1.128 -	SDL_CONTROLLER_BUTTON_A,
   1.129 -	SDL_CONTROLLER_BUTTON_B,
   1.130 -	SDL_CONTROLLER_BUTTON_X,
   1.131 -	SDL_CONTROLLER_BUTTON_Y,
   1.132 -	SDL_CONTROLLER_BUTTON_BACK,
   1.133 -	SDL_CONTROLLER_BUTTON_GUIDE,
   1.134 -	SDL_CONTROLLER_BUTTON_START,
   1.135 -	SDL_CONTROLLER_BUTTON_LEFTSTICK,
   1.136 -	SDL_CONTROLLER_BUTTON_RIGHTSTICK,
   1.137 -	SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
   1.138 -	SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
   1.139 -	SDL_CONTROLLER_BUTTON_DPAD_UP,
   1.140 -	SDL_CONTROLLER_BUTTON_DPAD_DOWN,
   1.141 -	SDL_CONTROLLER_BUTTON_DPAD_LEFT,
   1.142 -	SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
   1.143 -	SDL_CONTROLLER_BUTTON_MAX
   1.144 +    SDL_CONTROLLER_BUTTON_INVALID = -1,
   1.145 +    SDL_CONTROLLER_BUTTON_A,
   1.146 +    SDL_CONTROLLER_BUTTON_B,
   1.147 +    SDL_CONTROLLER_BUTTON_X,
   1.148 +    SDL_CONTROLLER_BUTTON_Y,
   1.149 +    SDL_CONTROLLER_BUTTON_BACK,
   1.150 +    SDL_CONTROLLER_BUTTON_GUIDE,
   1.151 +    SDL_CONTROLLER_BUTTON_START,
   1.152 +    SDL_CONTROLLER_BUTTON_LEFTSTICK,
   1.153 +    SDL_CONTROLLER_BUTTON_RIGHTSTICK,
   1.154 +    SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
   1.155 +    SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
   1.156 +    SDL_CONTROLLER_BUTTON_DPAD_UP,
   1.157 +    SDL_CONTROLLER_BUTTON_DPAD_DOWN,
   1.158 +    SDL_CONTROLLER_BUTTON_DPAD_LEFT,
   1.159 +    SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
   1.160 +    SDL_CONTROLLER_BUTTON_MAX
   1.161  } SDL_GameControllerButton;
   1.162  
   1.163  /**
   1.164 @@ -287,9 +285,7 @@
   1.165  
   1.166  /* Ends C function definitions when using C++ */
   1.167  #ifdef __cplusplus
   1.168 -/* *INDENT-OFF* */
   1.169  }
   1.170 -/* *INDENT-ON* */
   1.171  #endif
   1.172  #include "close_code.h"
   1.173