| 1 | package SDL2::gesture 0.01 { | ||
| 2 | use SDL2::Utils; | ||
| 3 | use SDL2::stdinc; | ||
| 4 | use SDL2::error; | ||
| 5 | use SDL2::video; | ||
| 6 | use SDL2::touch; | ||
| 7 | # | ||
| 8 | ffi->type( 'sint64' => 'SDL_GestureID' ); | ||
| 9 | # | ||
| 10 | attach gesture => { | ||
| 11 | SDL_RecordGesture => [ ['SDL_TouchID'], 'int' ], | ||
| 12 | SDL_SaveAllDollarTemplates => [ ['SDL_RWops'], 'int' ], | ||
| 13 | SDL_SaveDollarTemplate => [ [ 'SDL_GestureID', 'SDL_RWops' ], 'int' ], | ||
| 14 | SDL_LoadDollarTemplates => [ [ 'SDL_TouchID', 'SDL_RWops' ], 'int' ] | ||
| 15 | }; | ||
| 16 | |||
| 17 | =encoding utf-8 | ||
| 18 | |||
| 19 | =head1 NAME | ||
| 20 | |||
| 21 | SDL2::gesture - SDL Gesture Event Handling | ||
| 22 | |||
| 23 | =head1 SYNOPSIS | ||
| 24 | |||
| 25 | use SDL2 qw[:gesture]; | ||
| 26 | |||
| 27 | =head1 DESCRIPTION | ||
| 28 | |||
| 29 | SDL2::gesture provides functions that allow for simple and complex gesture | ||
| 30 | events. These functions may be imported by name or with the C<:gesture> tag. | ||
| 31 | |||
| 32 | =head1 Functions | ||
| 33 | |||
| 34 | These may be imported by name or with the C<:gesture> tag. | ||
| 35 | |||
| 36 | =head2 C<SDL_RecordGesture( ... )> | ||
| 37 | |||
| 38 | Begin recording a gesture on a specified touch device or all touch devices. | ||
| 39 | |||
| 40 | If the parameter C<touchId> is C<-1> (i.e., all devices), this function will | ||
| 41 | always return C<1>, regardless of whether there actually are any devices. | ||
| 42 | |||
| 43 | Expected parameters include: | ||
| 44 | |||
| 45 | =over | ||
| 46 | |||
| 47 | =item C<touchId> - the touch device id, or C<-1> for all touch devices | ||
| 48 | |||
| 49 | =back | ||
| 50 | |||
| 51 | Returns C<1> on success or C<0> if the specified device could not be found. | ||
| 52 | |||
| 53 | =head2 C<SDL_SaveAllDollarTemplates( ... )> | ||
| 54 | |||
| 55 | Save all currently loaded Dollar Gesture templates. | ||
| 56 | |||
| 57 | Expected parameters include: | ||
| 58 | |||
| 59 | =over | ||
| 60 | |||
| 61 | =item C<dst> - a L<SDL2::RWops> to save to | ||
| 62 | |||
| 63 | =back | ||
| 64 | |||
| 65 | Returns the number of saved templates on success or C<0> on failure; call | ||
| 66 | C<SDL_GetError( )> for more information. | ||
| 67 | |||
| 68 | =head2 C<SDL_SaveDollarTemplate( ... )> | ||
| 69 | |||
| 70 | Save a currently loaded Dollar Gesture template. | ||
| 71 | |||
| 72 | Expected parameters include: | ||
| 73 | |||
| 74 | =over | ||
| 75 | |||
| 76 | =item C<gestureId> - a gesture id | ||
| 77 | |||
| 78 | =item C<dst> - a L<SDL2::RWops> to save to | ||
| 79 | |||
| 80 | =back | ||
| 81 | |||
| 82 | Returns C<1> on success or C<0> on failure; call C<SDL_GetError( )> for more | ||
| 83 | information. | ||
| 84 | |||
| 85 | =head2 C<SDL_LoadDollarTemplates( ... )> | ||
| 86 | |||
| 87 | Load Dollar Gesture templates from a file. | ||
| 88 | |||
| 89 | Expected parameters include: | ||
| 90 | |||
| 91 | =over | ||
| 92 | |||
| 93 | =item C<touchId> - a touch id | ||
| 94 | |||
| 95 | =item C<src> - a L<SDL2::RWops> to load from | ||
| 96 | |||
| 97 | =back | ||
| 98 | |||
| 99 | Returns the number of loaded templates on success or a negative error code (or | ||
| 100 | C<0>) on failure; call C<SDL_GetError( )> for more information. | ||
| 101 | |||
| 102 | =head1 Defined Types | ||
| 103 | |||
| 104 | These are used internally. | ||
| 105 | |||
| 106 | =head2 C<SDL_GestureID> | ||
| 107 | |||
| 108 | A signed 64-bit integer. | ||
| 109 | |||
| 110 | =head1 LICENSE | ||
| 111 | |||
| 112 | Copyright (C) Sanko Robinson. | ||
| 113 | |||
| 114 | This library is free software; you can redistribute it and/or modify it under | ||
| 115 | the terms found in the Artistic License 2. Other copyrights, terms, and | ||
| 116 | conditions may apply to data transmitted through this module. | ||
| 117 | |||
| 118 | =head1 AUTHOR | ||
| 119 | |||
| 120 | Sanko Robinson E<lt>sanko@cpan.orgE<gt> | ||
| 121 | |||
| 122 | =begin stopwords | ||
| 123 | |||
| 124 | =end stopwords | ||
| 125 | |||
| 126 | =cut | ||
| 127 | |||
| 128 | }; | ||
| 129 | 1; |