1 | /* |
2 | Simple DirectMedia Layer |
3 | Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org> |
4 | |
5 | This software is provided 'as-is', without any express or implied |
6 | warranty. In no event will the authors be held liable for any damages |
7 | arising from the use of this software. |
8 | |
9 | Permission is granted to anyone to use this software for any purpose, |
10 | including commercial applications, and to alter it and redistribute it |
11 | freely, subject to the following restrictions: |
12 | |
13 | 1. The origin of this software must not be misrepresented; you must not |
14 | claim that you wrote the original software. If you use this software |
15 | in a product, an acknowledgment in the product documentation would be |
16 | appreciated but is not required. |
17 | 2. Altered source versions must be plainly marked as such, and must not be |
18 | misrepresented as being the original software. |
19 | 3. This notice may not be removed or altered from any source distribution. |
20 | */ |
21 | |
22 | /** |
23 | * \file SDL_gesture.h |
24 | * |
25 | * Include file for SDL gesture event handling. |
26 | */ |
27 | |
28 | #ifndef SDL_gesture_h_ |
29 | #define SDL_gesture_h_ |
30 | |
31 | #include "SDL_stdinc.h" |
32 | #include "SDL_error.h" |
33 | #include "SDL_video.h" |
34 | |
35 | #include "SDL_touch.h" |
36 | |
37 | |
38 | #include "begin_code.h" |
39 | /* Set up for C function definitions, even when using C++ */ |
40 | #ifdef __cplusplus |
41 | extern "C" { |
42 | #endif |
43 | |
44 | typedef Sint64 SDL_GestureID; |
45 | |
46 | /* Function prototypes */ |
47 | |
48 | /** |
49 | * Begin recording a gesture on a specified touch device or all touch devices. |
50 | * |
51 | * If the parameter `touchId` is -1 (i.e., all devices), this function will |
52 | * always return 1, regardless of whether there actually are any devices. |
53 | * |
54 | * \param touchId the touch device id, or -1 for all touch devices |
55 | * \returns 1 on success or 0 if the specified device could not be found. |
56 | * |
57 | * \since This function is available since SDL 2.0.0. |
58 | * |
59 | * \sa SDL_GetTouchDevice |
60 | */ |
61 | extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); |
62 | |
63 | |
64 | /** |
65 | * Save all currently loaded Dollar Gesture templates. |
66 | * |
67 | * \param dst a SDL_RWops to save to |
68 | * \returns the number of saved templates on success or 0 on failure; call |
69 | * SDL_GetError() for more information. |
70 | * |
71 | * \since This function is available since SDL 2.0.0. |
72 | * |
73 | * \sa SDL_LoadDollarTemplates |
74 | * \sa SDL_SaveDollarTemplate |
75 | */ |
76 | extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst); |
77 | |
78 | /** |
79 | * Save a currently loaded Dollar Gesture template. |
80 | * |
81 | * \param gestureId a gesture id |
82 | * \param dst a SDL_RWops to save to |
83 | * \returns 1 on success or 0 on failure; call SDL_GetError() for more |
84 | * information. |
85 | * |
86 | * \since This function is available since SDL 2.0.0. |
87 | * |
88 | * \sa SDL_LoadDollarTemplates |
89 | * \sa SDL_SaveAllDollarTemplates |
90 | */ |
91 | extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst); |
92 | |
93 | |
94 | /** |
95 | * Load Dollar Gesture templates from a file. |
96 | * |
97 | * \param touchId a touch id |
98 | * \param src a SDL_RWops to load from |
99 | * \returns the number of loaded templates on success or a negative error code |
100 | * (or 0) on failure; call SDL_GetError() for more information. |
101 | * |
102 | * \since This function is available since SDL 2.0.0. |
103 | * |
104 | * \sa SDL_SaveAllDollarTemplates |
105 | * \sa SDL_SaveDollarTemplate |
106 | */ |
107 | extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src); |
108 | |
109 | /* Ends C function definitions when using C++ */ |
110 | #ifdef __cplusplus |
111 | } |
112 | #endif |
113 | #include "close_code.h" |
114 | |
115 | #endif /* SDL_gesture_h_ */ |
116 | |
117 | /* vi: set ts=4 sw=4 expandtab: */ |
118 | |