diff include/SDL_events.h @ 2674:f1d07ba2e275 gsoc2008_nds

Started adding framework for Touchscreen API, based on and (consistent with) the existing Joystick API.
author Darren Alton <dalton@stevens.edu>
date Mon, 23 Jun 2008 11:55:26 +0000
parents c97ad1abe05b
children 3895761db26a
line wrap: on
line diff
--- a/include/SDL_events.h	Thu Jun 19 07:11:35 2008 +0000
+++ b/include/SDL_events.h	Mon Jun 23 11:55:26 2008 +0000
@@ -35,6 +35,7 @@
 #include "SDL_keyboard.h"
 #include "SDL_mouse.h"
 #include "SDL_joystick.h"
+#include "SDL_touchscreen.h"
 #include "SDL_quit.h"
 
 #include "begin_code.h"
@@ -70,6 +71,9 @@
     SDL_JOYHATMOTION,           /**< Joystick hat position change */
     SDL_JOYBUTTONDOWN,          /**< Joystick button pressed */
     SDL_JOYBUTTONUP,            /**< Joystick button released */
+    SDL_TOUCHPRESSED,           /**< Touchscreen pressed */
+    SDL_TOUCHRELEASED,          /**< Touchscreen no longer pressed */
+    SDL_TOUCHMOTION,            /**< Touchscreen point motion */
     SDL_QUIT,                   /**< User-requested quit */
     SDL_SYSWMEVENT,             /**< System specific event */
     SDL_EVENT_RESERVED1,        /**< Reserved for future use... */
@@ -111,6 +115,11 @@
         SDL_EVENTMASK(SDL_JOYBALLMOTION) |
         SDL_EVENTMASK(SDL_JOYHATMOTION) |
         SDL_EVENTMASK(SDL_JOYBUTTONDOWN) | SDL_EVENTMASK(SDL_JOYBUTTONUP),
+    SDL_TOUCHPRESSEDMASK = SDL_EVENTMASK(SDL_TOUCHPRESSED),
+    SDL_TOUCHRELEASEDMASK = SDL_EVENTMASK(SDL_TOUCHRELEASED),
+    SDL_TOUCHMOTIONMASK = SDL_EVENTMASK(SDL_TOUCHMOTION),
+    SDL_TOUCHEVENTMASK = SDL_EVENTMASK(SDL_TOUCHPRESSED) |
+        SDL_EVENTMASK(SDL_TOUCHRELEASED) | SDL_EVENTMASK(SDL_TOUCHMOTION),
     SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
     SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
 } SDL_EventMask;
@@ -264,6 +273,21 @@
 } SDL_JoyButtonEvent;
 
 /**
+ * \struct SDL_TouchEvent
+ *
+ * \brief Touchscreen motion event structure (event.touch.*)
+ */
+typedef struct SDL_TouchEvent
+{
+    Uint8 type;         /**< SDL_TOUCHMOTION, SDL_TOUCHPRESS, SDL_TOUCHRELEASED */
+    Uint8 which;        /**< The touchscreen device index */
+    int point;          /**< The touch point index, relevant for multitouch. */
+    int xpos;           /**< The X coordinate of the touch point. */
+    int ypos;           /**< The Y coordinate of the touch point. */
+    int pressure;       /**< The pressure of the touch */
+} SDL_TouchEvent;
+
+/**
  * \struct SDL_QuitEvent
  *
  * \brief The "quit requested" event
@@ -334,6 +358,7 @@
     SDL_JoyBallEvent jball;         /**< Joystick ball event data */
     SDL_JoyHatEvent jhat;           /**< Joystick hat event data */
     SDL_JoyButtonEvent jbutton;     /**< Joystick button event data */
+    SDL_TouchEvent touch;           /**< Touchscreen event data */
     SDL_QuitEvent quit;             /**< Quit request event data */
     SDL_UserEvent user;             /**< Custom event data */
     SDL_SysWMEvent syswm;           /**< System dependent window event data */