include/SDL_touch.h
author Sam Lantinga <slouken@libsdl.org>
Wed, 18 Jul 2012 15:53:33 -0700
changeset 6372 76d0f2cf2ca6
parent 6342 ac83b73f0edd
child 6885 700f1b25f77f
permissions -rw-r--r--
Fixed bug 1542 - SDL_Touch should reserve tilt_x and tilt_y

Gerry JJ 2012-07-14 19:42:23 PDT
The SDL_Touch structure currently reserves fields for tablet tilt and rotation
(marked "for future use"), but a tablet stylus can tilt in both x and y
directions in addition to rotation around itself (or, put another way, it can
rotate in x, y and z). So, the struct should probably reserve fields for both
tilt_x and tilt_y, not just tilt.
jim@4646
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@6138
     3
  Copyright (C) 1997-2012 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
jim@4646
    43
slouken@4679
    44
typedef Sint64 SDL_TouchID;
slouken@4679
    45
typedef Sint64 SDL_FingerID;
jimtla@4678
    46
jimtla@4678
    47
jim@4646
    48
struct SDL_Finger {
jimtla@4678
    49
  SDL_FingerID id;
jimtla@4678
    50
  Uint16 x;
jimtla@4678
    51
  Uint16 y;
jim@4689
    52
  Uint16 pressure;
jimtla@4678
    53
  Uint16 xdelta;
jimtla@4678
    54
  Uint16 ydelta;
jimtla@4678
    55
  Uint16 last_x, last_y,last_pressure;  /* the last reported coordinates */
jim@4655
    56
  SDL_bool down;
jim@4646
    57
};
jim@4646
    58
jimtla@4649
    59
typedef struct SDL_Touch SDL_Touch;
jimtla@4649
    60
typedef struct SDL_Finger SDL_Finger;
jim@4646
    61
jimtla@4649
    62
jimtla@4649
    63
struct SDL_Touch {
jim@4646
    64
  
jim@4646
    65
  /* Free the touch when it's time */
jim@4646
    66
  void (*FreeTouch) (SDL_Touch * touch);
jim@4646
    67
  
jim@4646
    68
  /* data common for tablets */
jimtla@4676
    69
  float pressure_max, pressure_min;
jimtla@4676
    70
  float x_max,x_min;
jimtla@4676
    71
  float y_max,y_min;
jimtla@4678
    72
  Uint16 xres,yres,pressureres;
jimtla@4678
    73
  float native_xres,native_yres,native_pressureres;
slouken@6372
    74
  float tilt_x;                 /* for future use */
slouken@6372
    75
  float tilt_y;                 /* for future use */
jimtla@4676
    76
  float rotation;               /* for future use */
jim@4646
    77
  
jim@4646
    78
  /* Data common to all touch */
jimtla@4678
    79
  SDL_TouchID id;
jim@4646
    80
  SDL_Window *focus;
jim@4646
    81
  
jim@4646
    82
  char *name;
jim@4646
    83
  Uint8 buttonstate;
jim@4646
    84
  SDL_bool relative_mode;
jim@4646
    85
  SDL_bool flush_motion;
jim@4646
    86
jim@4646
    87
  int num_fingers;
jim@4646
    88
  int max_fingers;
jim@4646
    89
  SDL_Finger** fingers;
jim@4646
    90
    
jim@4646
    91
  void *driverdata;
jim@4646
    92
};
jim@4646
    93
jim@4646
    94
jimtla@4649
    95
jim@4646
    96
/* Function prototypes */
jim@4646
    97
jim@4646
    98
/**
jim@4646
    99
 *  \brief Get the touch object at the given id.
jim@4646
   100
 *
jim@4646
   101
 *
jim@4646
   102
 */
jimtla@4678
   103
  extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id);
jim@4646
   104
jim@4646
   105
jim@4646
   106
jim@4646
   107
/**
jim@4646
   108
 *  \brief Get the finger object of the given touch, at the given id.
jim@4646
   109
 *
jim@4646
   110
 *
jim@4646
   111
 */
jimtla@4678
   112
  extern 
jimtla@4678
   113
  DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
jim@4646
   114
jim@4646
   115
/* Ends C function definitions when using C++ */
jim@4646
   116
#ifdef __cplusplus
jim@4646
   117
/* *INDENT-OFF* */
jim@4646
   118
}
jim@4646
   119
/* *INDENT-ON* */
jim@4646
   120
#endif
jim@4646
   121
#include "close_code.h"
jim@4646
   122
slouken@6342
   123
#endif /* _SDL_touch_h */
jim@4646
   124
jim@4646
   125
/* vi: set ts=4 sw=4 expandtab: */