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