include/SDL_events.h
changeset 6690 9548c8a58103
parent 6596 b00cf2e4835c
child 6885 700f1b25f77f
     1.1 --- a/include/SDL_events.h	Mon Nov 26 14:59:07 2012 -0800
     1.2 +++ b/include/SDL_events.h	Mon Nov 26 16:37:54 2012 -0800
     1.3 @@ -34,6 +34,7 @@
     1.4  #include "SDL_keyboard.h"
     1.5  #include "SDL_mouse.h"
     1.6  #include "SDL_joystick.h"
     1.7 +#include "SDL_gamecontroller.h"
     1.8  #include "SDL_quit.h"
     1.9  #include "SDL_gesture.h"
    1.10  #include "SDL_touch.h"
    1.11 @@ -90,6 +91,15 @@
    1.12      SDL_JOYHATMOTION,           /**< Joystick hat position change */
    1.13      SDL_JOYBUTTONDOWN,          /**< Joystick button pressed */
    1.14      SDL_JOYBUTTONUP,            /**< Joystick button released */
    1.15 +    SDL_JOYDEVICEADDED,         /**< A new joystick has been inserted into the system */
    1.16 +    SDL_JOYDEVICEREMOVED,       /**< An opened joystick has been removed */
    1.17 +
    1.18 +	/* Game controller events */
    1.19 +	SDL_CONTROLLERAXISMOTION  = 0x650, /**< Game controller axis motion */
    1.20 +	SDL_CONTROLLERBUTTONDOWN,          /**< Game controller button pressed */
    1.21 +	SDL_CONTROLLERBUTTONUP,            /**< Game controller button released */
    1.22 +	SDL_CONTROLLERDEVICEADDED,         /**< A new Game controller has been inserted into the system */
    1.23 +	SDL_CONTROLLERDEVICEREMOVED,       /**< An opened Game controller has been removed */
    1.24  
    1.25      /* Touch events */
    1.26      SDL_FINGERDOWN      = 0x700,
    1.27 @@ -231,7 +241,7 @@
    1.28  {
    1.29      Uint32 type;        /**< ::SDL_JOYAXISMOTION */
    1.30      Uint32 timestamp;
    1.31 -    Uint8 which;        /**< The joystick device index */
    1.32 +    Uint8 which;        /**< The joystick instance id */
    1.33      Uint8 axis;         /**< The joystick axis index */
    1.34      Uint8 padding1;
    1.35      Uint8 padding2;
    1.36 @@ -245,7 +255,7 @@
    1.37  {
    1.38      Uint32 type;        /**< ::SDL_JOYBALLMOTION */
    1.39      Uint32 timestamp;
    1.40 -    Uint8 which;        /**< The joystick device index */
    1.41 +    Uint8 which;        /**< The joystick instance id */
    1.42      Uint8 ball;         /**< The joystick trackball index */
    1.43      Uint8 padding1;
    1.44      Uint8 padding2;
    1.45 @@ -260,7 +270,7 @@
    1.46  {
    1.47      Uint32 type;        /**< ::SDL_JOYHATMOTION */
    1.48      Uint32 timestamp;
    1.49 -    Uint8 which;        /**< The joystick device index */
    1.50 +    Uint8 which;        /**< The joystick instance id */
    1.51      Uint8 hat;          /**< The joystick hat index */
    1.52      Uint8 value;        /**< The hat position value.
    1.53                           *   \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
    1.54 @@ -279,12 +289,59 @@
    1.55  {
    1.56      Uint32 type;        /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
    1.57      Uint32 timestamp;
    1.58 -    Uint8 which;        /**< The joystick device index */
    1.59 +    Uint8 which;        /**< The joystick instance id */
    1.60      Uint8 button;       /**< The joystick button index */
    1.61      Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
    1.62      Uint8 padding1;
    1.63  } SDL_JoyButtonEvent;
    1.64  
    1.65 +/**
    1.66 + *  \brief Joystick device event structure (event.jdevice.*)
    1.67 + */
    1.68 +typedef struct SDL_JoyDeviceEvent
    1.69 +{
    1.70 +	Uint32 type;        /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
    1.71 +	Uint32 timestamp;
    1.72 +	Uint32 which;        /**< The joystick device index for ADD, instance_id for REMOVE*/
    1.73 +} SDL_JoyDeviceEvent;
    1.74 +
    1.75 +
    1.76 +/**
    1.77 + *  \brief Game controller axis motion event structure (event.caxis.*)
    1.78 + */
    1.79 +typedef struct SDL_ControllerAxisEvent
    1.80 +{
    1.81 +    Uint32 type;        /**< ::SDL_CONTROLLERAXISMOTION */
    1.82 +    Uint32 timestamp;
    1.83 +    Uint8 which;        /**< The joystick instance id */
    1.84 +    SDL_CONTROLLER_AXIS axis;         /**< The joystick axis index */
    1.85 +    int value;          /**< The axis value (range: -32768 to 32767) */
    1.86 +} SDL_ControllerAxisEvent;
    1.87 +
    1.88 +
    1.89 +/**
    1.90 + *  \brief Game controller button event structure (event.cbutton.*)
    1.91 + */
    1.92 +typedef struct SDL_ControllerButtonEvent
    1.93 +{
    1.94 +    Uint32 type;        /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
    1.95 +    Uint32 timestamp;
    1.96 +    Uint8 which;        /**< The joystick instance id */
    1.97 +    SDL_CONTROLLER_BUTTON button;       /**< The joystick button index */
    1.98 +    Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
    1.99 +} SDL_ControllerButtonEvent;
   1.100 +
   1.101 +
   1.102 +/**
   1.103 + *  \brief Controller device event structure (event.cdevice.*)
   1.104 + */
   1.105 +typedef struct SDL_ControllerDeviceEvent
   1.106 +{
   1.107 +	Uint32 type;        /**< ::SDL_CONTROLLERDEVICEADDED or ::SDL_CONTROLLERDEVICEREMOVED */
   1.108 +	Uint32 timestamp;
   1.109 +	Uint32 which;        /**< The joystick device index for ADD, instance_id for REMOVE*/
   1.110 +} SDL_ControllerDeviceEvent;
   1.111 +
   1.112  
   1.113  /**
   1.114   *  \brief Touch finger motion/finger event structure (event.tfinger.*)
   1.115 @@ -430,6 +487,10 @@
   1.116      SDL_JoyBallEvent jball;         /**< Joystick ball event data */
   1.117      SDL_JoyHatEvent jhat;           /**< Joystick hat event data */
   1.118      SDL_JoyButtonEvent jbutton;     /**< Joystick button event data */
   1.119 +    SDL_JoyDeviceEvent jdevice;     /**< Joystick device change event data */
   1.120 +	SDL_ControllerAxisEvent caxis;		/**< Game Controller button event data */
   1.121 +	SDL_ControllerButtonEvent cbutton;  /**< Game Controller button event data */
   1.122 +	SDL_ControllerDeviceEvent cdevice;  /**< Game Controller device event data */
   1.123      SDL_QuitEvent quit;             /**< Quit request event data */
   1.124      SDL_UserEvent user;             /**< Custom event data */
   1.125      SDL_SysWMEvent syswm;           /**< System dependent window event data */