src/events/SDL_touch_c.h
author Jim Grandpre <jim.tla@gmail.com>
Mon, 31 May 2010 00:24:37 -0400
changeset 4645 0375d020e7e3
parent 4642 057e8762d2a1
child 4646 eea1bf53effa
permissions -rw-r--r--
Auto-detects Wacom touch devices.
jim@4640
     1
/*
jim@4640
     2
    SDL - Simple DirectMedia Layer
jim@4640
     3
    Copyright (C) 1997-2010 Sam Lantinga
jim@4640
     4
jim@4640
     5
    This library is free software; you can redistribute it and/or
jim@4640
     6
    modify it under the terms of the GNU Lesser General Public
jim@4640
     7
    License as published by the Free Software Foundation; either
jim@4640
     8
    version 2.1 of the License, or (at your option) any later version.
jim@4640
     9
jim@4640
    10
    This library is distributed in the hope that it will be useful,
jim@4640
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
jim@4640
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
jim@4640
    13
    Lesser General Public License for more details.
jim@4640
    14
jim@4640
    15
    You should have received a copy of the GNU Lesser General Public
jim@4640
    16
    License along with this library; if not, write to the Free Software
jim@4640
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
jim@4640
    18
jim@4640
    19
    Sam Lantinga
jim@4640
    20
    slouken@libsdl.org
jim@4640
    21
*/
jim@4640
    22
#include "SDL_config.h"
jim@4640
    23
jim@4640
    24
#ifndef _SDL_touch_c_h
jim@4640
    25
#define _SDL_touch_c_h
jim@4640
    26
jim@4640
    27
typedef struct SDL_Touch SDL_Touch;
jim@4641
    28
typedef struct SDL_Finger SDL_Finger;
jim@4641
    29
jim@4641
    30
struct SDL_Finger {
jim@4641
    31
  int id;
jim@4641
    32
  int x;
jim@4641
    33
  int y;
jim@4641
    34
  int z;                      /* for future use */
jim@4641
    35
  int xdelta;
jim@4641
    36
  int ydelta;
jim@4641
    37
  int last_x, last_y;         /* the last reported x and y coordinates */
jim@4641
    38
  int pressure;
jim@4641
    39
};
jim@4640
    40
jim@4640
    41
jim@4640
    42
struct SDL_Touch
jim@4640
    43
{
jim@4641
    44
  
jim@4641
    45
  /* Free the touch when it's time */
jim@4641
    46
  void (*FreeTouch) (SDL_Touch * touch);
jim@4641
    47
  
jim@4641
    48
  /* data common for tablets */
jim@4641
    49
  int pressure_max;
jim@4641
    50
  int pressure_min;
jim@4641
    51
  int tilt;                   /* for future use */
jim@4641
    52
  int rotation;               /* for future use */
jim@4641
    53
  
jim@4641
    54
  /* Data common to all touch */
jim@4641
    55
  int id;
jim@4641
    56
  SDL_Window *focus;
jim@4641
    57
  
jim@4641
    58
  char *name;
jim@4641
    59
  Uint8 buttonstate;
jim@4641
    60
  SDL_bool relative_mode;
jim@4641
    61
  SDL_bool flush_motion;
jim@4640
    62
jim@4641
    63
  int num_fingers;
jim@4645
    64
  int max_fingers;
jim@4641
    65
  SDL_Finger** fingers;
jim@4641
    66
    
jim@4641
    67
  void *driverdata;
jim@4641
    68
};
jim@4640
    69
jim@4640
    70
jim@4640
    71
/* Initialize the touch subsystem */
jim@4640
    72
extern int SDL_TouchInit(void);
jim@4640
    73
jim@4642
    74
/*Get the touch at an index */
jim@4642
    75
extern SDL_Touch *SDL_GetTouchIndex(int index);
jim@4642
    76
jim@4642
    77
/* Get the touch with id = id */
jim@4642
    78
extern SDL_Touch *SDL_GetTouch(int id);
jim@4642
    79
jim@4642
    80
/*Get the finger at an index */
jim@4642
    81
extern SDL_Finger *SDL_GetFingerIndex(SDL_Touch *touch, int index);
jim@4642
    82
jim@4642
    83
/* Get the finger with id = id */
jim@4642
    84
extern SDL_Finger *SDL_GetFinger(SDL_Touch *touch,int id);
jim@4642
    85
jim@4640
    86
jim@4640
    87
/* Add a touch, possibly reattaching at a particular index (or -1),
jim@4642
    88
   returning the index of the touch, or -1 if there was an error. */
jim@4642
    89
extern int SDL_AddTouch(const SDL_Touch * touch, char *name);
jim@4642
    90
                     
jim@4640
    91
jim@4640
    92
/* Remove a touch at an index, clearing the slot for later */
jim@4640
    93
extern void SDL_DelTouch(int index);
jim@4640
    94
jim@4640
    95
/* Set the touch focus window */
jim@4640
    96
extern void SDL_SetTouchFocus(int id, SDL_Window * window);
jim@4640
    97
jim@4640
    98
/* Send a touch motion event for a touch */
jim@4641
    99
extern int SDL_SendTouchMotion(int id, int fingerid,
jim@4641
   100
			       int relative, int x, int y, int z);
jim@4640
   101
jim@4640
   102
/* Send a touch button event for a touch */
jim@4640
   103
extern int SDL_SendTouchButton(int id, Uint8 state, Uint8 button);
jim@4640
   104
jim@4640
   105
/* Shutdown the touch subsystem */
jim@4640
   106
extern void SDL_TouchQuit(void);
jim@4640
   107
jim@4640
   108
/* FIXME: Where do these functions go in this header? */
jim@4640
   109
extern void SDL_ChangeEnd(int id, int end);
jim@4640
   110
jim@4640
   111
#endif /* _SDL_touch_c_h */
jim@4640
   112
jim@4640
   113
/* vi: set ts=4 sw=4 expandtab: */