include/SDL_events.h
changeset 6949 4de584a3a027
parent 6917 47dc155b774d
child 6950 1ddb72193079
     1.1 --- a/include/SDL_events.h	Fri Mar 01 11:27:01 2013 -0800
     1.2 +++ b/include/SDL_events.h	Sat Mar 02 17:51:32 2013 -0800
     1.3 @@ -131,6 +131,15 @@
     1.4  } SDL_EventType;
     1.5  
     1.6  /**
     1.7 + *  \brief Fields shared by every event
     1.8 + */
     1.9 +typedef struct SDL_GenericEvent
    1.10 +{
    1.11 +    Uint32 type;
    1.12 +    Uint32 timestamp;
    1.13 +} SDL_GenericEvent;
    1.14 +    
    1.15 +/**
    1.16   *  \brief Window state change event data (event.window.*)
    1.17   */
    1.18  typedef struct SDL_WindowEvent
    1.19 @@ -241,11 +250,13 @@
    1.20  {
    1.21      Uint32 type;        /**< ::SDL_JOYAXISMOTION */
    1.22      Uint32 timestamp;
    1.23 -    Uint8 which;        /**< The joystick instance id */
    1.24 +    Uint32 which;       /**< The joystick instance id */
    1.25      Uint8 axis;         /**< The joystick axis index */
    1.26      Uint8 padding1;
    1.27      Uint8 padding2;
    1.28 -    int value;          /**< The axis value (range: -32768 to 32767) */
    1.29 +    Uint8 padding3;
    1.30 +    Sint16 value;       /**< The axis value (range: -32768 to 32767) */
    1.31 +    Uint16 padding4;
    1.32  } SDL_JoyAxisEvent;
    1.33  
    1.34  /**
    1.35 @@ -255,12 +266,13 @@
    1.36  {
    1.37      Uint32 type;        /**< ::SDL_JOYBALLMOTION */
    1.38      Uint32 timestamp;
    1.39 -    Uint8 which;        /**< The joystick instance id */
    1.40 +    Uint32 which;       /**< The joystick instance id */
    1.41      Uint8 ball;         /**< The joystick trackball index */
    1.42      Uint8 padding1;
    1.43      Uint8 padding2;
    1.44 -    int xrel;           /**< The relative motion in the X direction */
    1.45 -    int yrel;           /**< The relative motion in the Y direction */
    1.46 +    Uint8 padding3;
    1.47 +    Sint16 xrel;        /**< The relative motion in the X direction */
    1.48 +    Sint16 yrel;        /**< The relative motion in the Y direction */
    1.49  } SDL_JoyBallEvent;
    1.50  
    1.51  /**
    1.52 @@ -270,7 +282,7 @@
    1.53  {
    1.54      Uint32 type;        /**< ::SDL_JOYHATMOTION */
    1.55      Uint32 timestamp;
    1.56 -    Uint8 which;        /**< The joystick instance id */
    1.57 +    Uint32 which;       /**< The joystick instance id */
    1.58      Uint8 hat;          /**< The joystick hat index */
    1.59      Uint8 value;        /**< The hat position value.
    1.60                           *   \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
    1.61 @@ -280,6 +292,7 @@
    1.62                           *   Note that zero means the POV is centered.
    1.63                           */
    1.64      Uint8 padding1;
    1.65 +    Uint8 padding2;
    1.66  } SDL_JoyHatEvent;
    1.67  
    1.68  /**
    1.69 @@ -289,10 +302,11 @@
    1.70  {
    1.71      Uint32 type;        /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
    1.72      Uint32 timestamp;
    1.73 -    Uint8 which;        /**< The joystick instance id */
    1.74 +    Uint32 which;       /**< The joystick instance id */
    1.75      Uint8 button;       /**< The joystick button index */
    1.76      Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
    1.77      Uint8 padding1;
    1.78 +    Uint8 padding2;
    1.79  } SDL_JoyButtonEvent;
    1.80  
    1.81  /**
    1.82 @@ -302,7 +316,7 @@
    1.83  {
    1.84  	Uint32 type;        /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
    1.85  	Uint32 timestamp;
    1.86 -	Uint32 which;        /**< The joystick device index for ADD, instance_id for REMOVE*/
    1.87 +	Uint32 which;       /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
    1.88  } SDL_JoyDeviceEvent;
    1.89  
    1.90  
    1.91 @@ -313,9 +327,13 @@
    1.92  {
    1.93      Uint32 type;        /**< ::SDL_CONTROLLERAXISMOTION */
    1.94      Uint32 timestamp;
    1.95 -    Uint8 which;        /**< The joystick instance id */
    1.96 -    SDL_GameControllerAxis axis;         /**< The joystick axis index */
    1.97 -    int value;          /**< The axis value (range: -32768 to 32767) */
    1.98 +    Uint32 which;       /**< The joystick instance id */
    1.99 +    Uint8 axis;         /**< The controller axis (SDL_GameControllerAxis) */
   1.100 +    Uint8 padding1;
   1.101 +    Uint8 padding2;
   1.102 +    Uint8 padding3;
   1.103 +    Sint16 value;       /**< The axis value (range: -32768 to 32767) */
   1.104 +    Uint16 padding4;
   1.105  } SDL_ControllerAxisEvent;
   1.106  
   1.107  
   1.108 @@ -326,9 +344,11 @@
   1.109  {
   1.110      Uint32 type;        /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
   1.111      Uint32 timestamp;
   1.112 -    Uint8 which;        /**< The joystick instance id */
   1.113 -    SDL_GameControllerButton button;       /**< The joystick button index */
   1.114 +    Uint32 which;       /**< The joystick instance id */
   1.115 +    Uint8 button;       /**< The controller button (SDL_GameControllerButton) */
   1.116      Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
   1.117 +    Uint8 padding1;
   1.118 +    Uint8 padding2;
   1.119  } SDL_ControllerButtonEvent;
   1.120  
   1.121  
   1.122 @@ -339,7 +359,7 @@
   1.123  {
   1.124  	Uint32 type;        /**< ::SDL_CONTROLLERDEVICEADDED or ::SDL_CONTROLLERDEVICEREMOVED */
   1.125  	Uint32 timestamp;
   1.126 -	Uint32 which;        /**< The joystick device index for ADD, instance_id for REMOVE*/
   1.127 +	Uint32 which;       /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
   1.128  } SDL_ControllerDeviceEvent;
   1.129  
   1.130  
   1.131 @@ -348,11 +368,10 @@
   1.132   */
   1.133  typedef struct SDL_TouchFingerEvent
   1.134  {
   1.135 -    Uint32 type;        /**< ::SDL_FINGERMOTION OR 
   1.136 -			   SDL_FINGERDOWN OR SDL_FINGERUP*/
   1.137 +    Uint32 type;        /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
   1.138      Uint32 timestamp;
   1.139      Uint32 windowID;    /**< The window with mouse focus, if any */
   1.140 -    SDL_TouchID touchId;        /**< The touch device id */
   1.141 +    SDL_TouchID touchId; /**< The touch device id */
   1.142      SDL_FingerID fingerId;
   1.143      Uint8 state;        /**< The current button state */
   1.144      Uint8 padding1;
   1.145 @@ -476,6 +495,7 @@
   1.146  typedef union SDL_Event
   1.147  {
   1.148      Uint32 type;                    /**< Event type, shared with all events */
   1.149 +    SDL_GenericEvent generic;       /**< Generic event data */
   1.150      SDL_WindowEvent window;         /**< Window event data */
   1.151      SDL_KeyboardEvent key;          /**< Keyboard event data */
   1.152      SDL_TextEditingEvent edit;      /**< Text editing event data */