| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SDL2::HapticEffect { |
|
2
|
2
|
|
|
2
|
|
15
|
use SDL2::Utils; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
19
|
|
|
3
|
2
|
|
|
2
|
|
1224
|
use FFI::C::UnionDef; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
52
|
|
|
4
|
2
|
|
|
2
|
|
739
|
use SDL2::HapticConstant; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
125
|
|
|
5
|
2
|
|
|
2
|
|
1036
|
use SDL2::HapticPeriodic; |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
113
|
|
|
6
|
2
|
|
|
2
|
|
1018
|
use SDL2::HapticCondition; |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
126
|
|
|
7
|
2
|
|
|
2
|
|
1170
|
use SDL2::HapticRamp; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
111
|
|
|
8
|
2
|
|
|
2
|
|
1046
|
use SDL2::HapticLeftRight; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
92
|
|
|
9
|
2
|
|
|
2
|
|
920
|
use SDL2::HapticCustom; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
276
|
|
|
10
|
|
|
|
|
|
|
FFI::C::UnionDef->new( ffi, |
|
11
|
|
|
|
|
|
|
name => 'SDL_HapticEffect', |
|
12
|
|
|
|
|
|
|
class => 'SDL2::HapticEffect', |
|
13
|
|
|
|
|
|
|
members => [ |
|
14
|
|
|
|
|
|
|
type => 'uint16', |
|
15
|
|
|
|
|
|
|
constant => 'SDL_HapticConstant', |
|
16
|
|
|
|
|
|
|
periodic => 'SDL_HapticPeriodic', |
|
17
|
|
|
|
|
|
|
condition => 'SDL_HapticCondition', |
|
18
|
|
|
|
|
|
|
ramp => 'SDL_HapticRamp', |
|
19
|
|
|
|
|
|
|
leftright => 'SDL_HapticLeftRight', |
|
20
|
|
|
|
|
|
|
custom => 'SDL_HapticCustom' |
|
21
|
|
|
|
|
|
|
] |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=encoding utf-8 |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
SDL2::HapticEffect - A generic template for a any haptic effect |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use SDL2 qw[:all]; |
|
33
|
|
|
|
|
|
|
# TODO: I need to whip up a quick example |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
SDL2::HapticEffect is a C union which generalizes all known haptic effects. |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
All values max at C<32767> (C<0x7FFF>). Signed values also can be negative. |
|
40
|
|
|
|
|
|
|
Time values unless specified otherwise are in milliseconds. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
You can also pass C to length instead of a C<0-32767> |
|
43
|
|
|
|
|
|
|
value. Neither C, C, C nor C |
|
44
|
|
|
|
|
|
|
support C. Fade will also not be used since effect never |
|
45
|
|
|
|
|
|
|
ends. |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Additionally, the C effect does not support a duration of |
|
48
|
|
|
|
|
|
|
C. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Button triggers may not be supported on all devices, it is advised to not use |
|
51
|
|
|
|
|
|
|
them if possible. Buttons start at index C<1> instead of index C<0> like the |
|
52
|
|
|
|
|
|
|
joystick. |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
If both C and C are C<0>, the envelope is not used, |
|
55
|
|
|
|
|
|
|
otherwise both values are used. |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Common parts: |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=over |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item Replay - All effects have this |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=over |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item C - Duration of effect (ms). |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item C - Delay before starting effect. |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=back |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item Trigger - All effects have this |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=over |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item C - Button that triggers effect. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item C - How soon before effect can be triggered again. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=back |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item Envelope - All effects except condition effects have this |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=over |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item C - Duration of the attack (ms). |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item C - Level at the start of the attack. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item C - Duration of the fade out (ms). |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item C - Level at the end of the fade. |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=back |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=back |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Here we have an example of a constant effect evolution in time: |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Strength |
|
100
|
|
|
|
|
|
|
^ |
|
101
|
|
|
|
|
|
|
| |
|
102
|
|
|
|
|
|
|
| effect level --> _________________ |
|
103
|
|
|
|
|
|
|
| / \ |
|
104
|
|
|
|
|
|
|
| / \ |
|
105
|
|
|
|
|
|
|
| / \ |
|
106
|
|
|
|
|
|
|
| / \ |
|
107
|
|
|
|
|
|
|
| attack_level --> | \ |
|
108
|
|
|
|
|
|
|
| | | <--- fade_level |
|
109
|
|
|
|
|
|
|
| |
|
110
|
|
|
|
|
|
|
+--------------------------------------------------> Time |
|
111
|
|
|
|
|
|
|
[--] [---] |
|
112
|
|
|
|
|
|
|
attack_length fade_length |
|
113
|
|
|
|
|
|
|
[------------------][-----------------------] |
|
114
|
|
|
|
|
|
|
delay length |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Note either the C or the C may be above the actual |
|
117
|
|
|
|
|
|
|
effect level. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 Fields |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
As a union, this object main contain the following structures: |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=over |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item C - Effect type |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item C - SDL2::HapticConstant |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item C - SDL2::HapticPeriodic |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item C - SDL2::HapticCondition |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item C - SDL2::HapticRamp |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item C - SDL2::HapticLeftRight |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item C - SDL2::HapticCustom |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=back |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 AUTHOR |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=begin stopwords |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=end stopwords |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
}; |
|
153
|
|
|
|
|
|
|
1; |