src/events/SDL_touch_c.h
author Jim Grandpre <jim.tla@gmail.com>
Tue, 25 May 2010 23:23:23 -0400
changeset 4640 f068a6dfc858
child 4641 49a97daea6ec
permissions -rw-r--r--
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
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@4640
    28
jim@4640
    29
jim@4640
    30
struct SDL_Touch
jim@4640
    31
{
jim@4640
    32
    /* Warp the touch to (x,y) */
jim@4640
    33
    void (*WarpTouch) (SDL_Touch * touch, SDL_Window * window, int x,
jim@4640
    34
                       int y);
jim@4640
    35
jim@4640
    36
    /* Free the touch when it's time */
jim@4640
    37
    void (*FreeTouch) (SDL_Touch * touch);
jim@4640
    38
jim@4640
    39
    /* data common for tablets */
jim@4640
    40
    int pressure;
jim@4640
    41
    int pressure_max;
jim@4640
    42
    int pressure_min;
jim@4640
    43
    int tilt;                   /* for future use */
jim@4640
    44
    int rotation;               /* for future use */
jim@4640
    45
    int total_ends;
jim@4640
    46
    int current_end;
jim@4640
    47
jim@4640
    48
    /* Data common to all touch */
jim@4640
    49
    int id;
jim@4640
    50
    SDL_Window *focus;
jim@4640
    51
    int which;
jim@4640
    52
    int x;
jim@4640
    53
    int y;
jim@4640
    54
    int z;                      /* for future use */
jim@4640
    55
    int xdelta;
jim@4640
    56
    int ydelta;
jim@4640
    57
    int last_x, last_y;         /* the last reported x and y coordinates */
jim@4640
    58
    char *name;
jim@4640
    59
    Uint8 buttonstate;
jim@4640
    60
    SDL_bool relative_mode;
jim@4640
    61
    SDL_bool proximity;
jim@4640
    62
    SDL_bool flush_motion;
jim@4640
    63
jim@4640
    64
    SDL_Cursor *cursors;
jim@4640
    65
    SDL_Cursor *def_cursor;
jim@4640
    66
    SDL_Cursor *cur_cursor;
jim@4640
    67
    SDL_bool cursor_shown;
jim@4640
    68
jim@4640
    69
    void *driverdata;
jim@4640
    70
};
jim@4640
    71
jim@4640
    72
/* Initialize the touch subsystem */
jim@4640
    73
extern int SDL_TouchInit(void);
jim@4640
    74
jim@4640
    75
/* Get the touch at an index */
jim@4640
    76
extern SDL_Touch *SDL_GetTouch(int index);
jim@4640
    77
jim@4640
    78
/* Add a touch, possibly reattaching at a particular index (or -1),
jim@4640
    79
   returning the index of the touch, or -1 if there was an error.
jim@4640
    80
 */
jim@4640
    81
extern int SDL_AddTouch(const SDL_Touch * touch, char *name,
jim@4640
    82
                        int pressure_max, int pressure_min, int ends);
jim@4640
    83
jim@4640
    84
/* Remove a touch at an index, clearing the slot for later */
jim@4640
    85
extern void SDL_DelTouch(int index);
jim@4640
    86
jim@4640
    87
/* Clear the button state of a touch at an index */
jim@4640
    88
extern void SDL_ResetTouch(int index);
jim@4640
    89
jim@4640
    90
/* Set the touch focus window */
jim@4640
    91
extern void SDL_SetTouchFocus(int id, SDL_Window * window);
jim@4640
    92
jim@4640
    93
/* Send a touch motion event for a touch */
jim@4640
    94
extern int SDL_SendTouchMotion(int id, int relative, int x, int y, int z);
jim@4640
    95
jim@4640
    96
/* Send a touch button event for a touch */
jim@4640
    97
extern int SDL_SendTouchButton(int id, Uint8 state, Uint8 button);
jim@4640
    98
jim@4640
    99
/* Send a touch wheel event for a touch */
jim@4640
   100
extern int SDL_SendTouchWheel(int id, int x, int y);
jim@4640
   101
jim@4640
   102
/* Send a proximity event for a touch */
jim@4640
   103
extern int SDL_SendProximity(int id, int x, int y, int type);
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: */