include/SDL_touch.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 03 Mar 2013 01:01:33 -0800
changeset 6951 7833f01322b3
parent 6950 1ddb72193079
child 7170 d5f5a491fe49
permissions -rw-r--r--
Updated touch API
* Normalized touch coordinates as floats in the 0...1 range
* Removed unused touchpad concepts from the API
* Added API functions to get active touch devices and current finger state
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@6951
    49
    float x;
slouken@6951
    50
    float y;
slouken@6951
    51
    float pressure;
slouken@6950
    52
} SDL_Finger;
jimtla@4678
    53
slouken@6950
    54
/* Used as the device ID for mouse events simulated with touch input */
slouken@6950
    55
#define SDL_TOUCH_MOUSEID ((Uint32)-1)
jim@4646
    56
jimtla@4649
    57
jim@4646
    58
/* Function prototypes */
jim@4646
    59
jim@4646
    60
/**
slouken@6951
    61
 *  \brief Get the number of registered touch devices.
jim@4646
    62
 */
slouken@6951
    63
extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices();
jim@4646
    64
jim@4646
    65
/**
slouken@6951
    66
 *  \brief Get the touch ID with the given index, or 0 if the index is invalid.
jim@4646
    67
 */
slouken@6951
    68
extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
slouken@6951
    69
slouken@6951
    70
/**
slouken@6951
    71
 *  \brief Get the number of active fingers for a given touch device.
slouken@6951
    72
 */
slouken@6951
    73
extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
slouken@6951
    74
slouken@6951
    75
/**
slouken@6951
    76
 *  \brief Get the finger object of the given touch, with the given index.
slouken@6951
    77
 */
slouken@6951
    78
extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
jim@4646
    79
jim@4646
    80
/* Ends C function definitions when using C++ */
jim@4646
    81
#ifdef __cplusplus
jim@4646
    82
/* *INDENT-OFF* */
jim@4646
    83
}
jim@4646
    84
/* *INDENT-ON* */
jim@4646
    85
#endif
jim@4646
    86
#include "close_code.h"
jim@4646
    87
slouken@6342
    88
#endif /* _SDL_touch_h */
jim@4646
    89
jim@4646
    90
/* vi: set ts=4 sw=4 expandtab: */