include/SDL_touch.h
author Sam Lantinga <slouken@libsdl.org>
Sat, 31 Dec 2011 09:28:07 -0500
changeset 6138 4c64952a58fb
parent 5535 96594ac5fd1a
child 6342 ac83b73f0edd
permissions -rw-r--r--
Happy New Year!
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 
    22 /**
    23  *  \file SDL_touch.h
    24  *  
    25  *  Include file for SDL touch event handling.
    26  */
    27 
    28 #ifndef _SDL_touch_h
    29 #define _SDL_touch_h
    30 
    31 #include "SDL_stdinc.h"
    32 #include "SDL_error.h"
    33 #include "SDL_video.h"
    34 
    35 #include "begin_code.h"
    36 /* Set up for C function definitions, even when using C++ */
    37 #ifdef __cplusplus
    38 /* *INDENT-OFF* */
    39 extern "C" {
    40 /* *INDENT-ON* */
    41 #endif
    42 
    43 
    44 typedef Sint64 SDL_TouchID;
    45 typedef Sint64 SDL_FingerID;
    46 
    47 
    48 struct SDL_Finger {
    49   SDL_FingerID id;
    50   Uint16 x;
    51   Uint16 y;
    52   Uint16 pressure;
    53   Uint16 xdelta;
    54   Uint16 ydelta;
    55   Uint16 last_x, last_y,last_pressure;  /* the last reported coordinates */
    56   SDL_bool down;
    57 };
    58 
    59 typedef struct SDL_Touch SDL_Touch;
    60 typedef struct SDL_Finger SDL_Finger;
    61 
    62 
    63 struct SDL_Touch {
    64   
    65   /* Free the touch when it's time */
    66   void (*FreeTouch) (SDL_Touch * touch);
    67   
    68   /* data common for tablets */
    69   float pressure_max, pressure_min;
    70   float x_max,x_min;
    71   float y_max,y_min;
    72   Uint16 xres,yres,pressureres;
    73   float native_xres,native_yres,native_pressureres;
    74   float tilt;                   /* for future use */
    75   float rotation;               /* for future use */
    76   
    77   /* Data common to all touch */
    78   SDL_TouchID id;
    79   SDL_Window *focus;
    80   
    81   char *name;
    82   Uint8 buttonstate;
    83   SDL_bool relative_mode;
    84   SDL_bool flush_motion;
    85 
    86   int num_fingers;
    87   int max_fingers;
    88   SDL_Finger** fingers;
    89     
    90   void *driverdata;
    91 };
    92 
    93 
    94 
    95 /* Function prototypes */
    96 
    97 /**
    98  *  \brief Get the touch object at the given id.
    99  *
   100  *
   101  */
   102   extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id);
   103 
   104 
   105 
   106 /**
   107  *  \brief Get the finger object of the given touch, at the given id.
   108  *
   109  *
   110  */
   111   extern 
   112   DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
   113 
   114 /* Ends C function definitions when using C++ */
   115 #ifdef __cplusplus
   116 /* *INDENT-OFF* */
   117 }
   118 /* *INDENT-ON* */
   119 #endif
   120 #include "close_code.h"
   121 
   122 #endif /* _SDL_mouse_h */
   123 
   124 /* vi: set ts=4 sw=4 expandtab: */