line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SDL2::FFI 0.05 { |
2
|
2
|
|
|
2
|
|
526474
|
use lib '../lib', 'lib'; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
12
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: FFI Wrapper for SDL (Simple DirectMedia Layer) Development Library |
5
|
2
|
|
|
2
|
|
1619
|
use strictures 2; |
|
2
|
|
|
|
|
3743
|
|
|
2
|
|
|
|
|
100
|
|
6
|
2
|
|
|
2
|
|
1871
|
use experimental 'signatures'; |
|
2
|
|
|
|
|
8029
|
|
|
2
|
|
|
|
|
18
|
|
7
|
2
|
|
|
2
|
|
446
|
use base 'Exporter::Tiny'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1359
|
|
8
|
2
|
|
|
2
|
|
8318
|
use SDL2::Utils; |
|
2
|
|
|
|
|
20
|
|
|
2
|
|
|
|
|
33
|
|
9
|
2
|
|
|
2
|
|
1381
|
use Config; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
402
|
|
10
|
4
|
|
66
|
4
|
0
|
16
|
sub bigendian () { CORE::state $bigendian //= ( $Config{byteorder} != 4321 ); $bigendian } |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
154
|
|
|
4
|
|
|
|
|
232
|
|
11
|
|
|
|
|
|
|
our %EXPORT_TAGS; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# I need these first |
14
|
|
|
|
|
|
|
attach version => { SDL_GetVersion => [ ['SDL_version'] ] }; |
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
SDL_GetVersion( my $ver = SDL2::version->new() ); |
17
|
|
|
|
|
|
|
my $platform = $^O; # https://perldoc.perl.org/perlport#PLATFORMS |
18
|
|
|
|
|
|
|
my $Windows = !!( $platform eq 'MSWin32' ); |
19
|
|
|
|
|
|
|
# |
20
|
2
|
|
|
2
|
|
991
|
use SDL2::version; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
87
|
|
21
|
2
|
|
|
2
|
|
2281
|
use SDL2::Enum; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
190
|
|
22
|
2
|
|
|
2
|
|
1206
|
use SDL2::AudioCVT; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
122
|
|
23
|
2
|
|
|
2
|
|
1022
|
use SDL2::AudioSpec; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
113
|
|
24
|
2
|
|
|
2
|
|
1062
|
use SDL2::Event; # Includes all known events |
|
2
|
|
|
|
|
59
|
|
|
2
|
|
|
|
|
82
|
|
25
|
2
|
|
|
2
|
|
819
|
use SDL2::Point; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
107
|
|
26
|
2
|
|
|
2
|
|
710
|
use SDL2::FPoint; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
76
|
|
27
|
2
|
|
|
2
|
|
700
|
use SDL2::FRect; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
64
|
|
28
|
2
|
|
|
2
|
|
703
|
use SDL2::Rect; |
|
2
|
|
|
|
|
39
|
|
|
2
|
|
|
|
|
71
|
|
29
|
2
|
|
|
2
|
|
737
|
use SDL2::DisplayMode; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
72
|
|
30
|
2
|
|
|
2
|
|
730
|
use SDL2::Surface; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
68
|
|
31
|
2
|
|
|
2
|
|
747
|
use SDL2::Window; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
124
|
|
32
|
2
|
|
|
2
|
|
1143
|
use SDL2::WindowShaper; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
121
|
|
33
|
2
|
|
|
2
|
|
911
|
use SDL2::Texture; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
67
|
|
34
|
2
|
|
|
2
|
|
792
|
use SDL2::Renderer; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
67
|
|
35
|
2
|
|
|
2
|
|
796
|
use SDL2::RendererInfo; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
120
|
|
36
|
2
|
|
|
2
|
|
997
|
use SDL2::GameControllerButtonBind; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
84
|
|
37
|
2
|
|
|
2
|
|
1147
|
use SDL2::HapticDirection; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
89
|
|
38
|
2
|
|
|
2
|
|
881
|
use SDL2::HapticEffect; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
102
|
|
39
|
2
|
|
|
2
|
|
930
|
use SDL2::Joystick; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
66
|
|
40
|
2
|
|
|
2
|
|
774
|
use SDL2::JoystickGUID; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
79
|
|
41
|
2
|
|
|
2
|
|
16
|
use SDL2::Keysym; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
51
|
|
42
|
2
|
|
|
2
|
|
810
|
use SDL2::Locale; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
93
|
|
43
|
2
|
|
|
2
|
|
878
|
use SDL2::MessageBoxData; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
99
|
|
44
|
2
|
|
|
2
|
|
959
|
use SDL2::MetalView; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
71
|
|
45
|
2
|
|
|
2
|
|
827
|
use SDL2::Mutex; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
69
|
|
46
|
2
|
|
|
2
|
|
813
|
use SDL2::Semaphore; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
72
|
|
47
|
2
|
|
|
2
|
|
795
|
use SDL2::Cond; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
62
|
|
48
|
2
|
|
|
2
|
|
774
|
use SDL2::Color; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
85
|
|
49
|
2
|
|
|
2
|
|
910
|
use SDL2::Palette; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
143
|
|
50
|
2
|
|
|
2
|
|
882
|
use SDL2::PixelFormat; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
126
|
|
51
|
|
|
|
|
|
|
# |
52
|
2
|
|
|
2
|
|
1594
|
use Data::Dump; |
|
2
|
|
|
|
|
11517
|
|
|
2
|
|
|
|
|
1945
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# https://github.com/libsdl-org/SDL/blob/main/include/SDL.h |
55
|
|
|
|
|
|
|
push @{ $EXPORT_TAGS{default} }, qw[:init]; |
56
|
|
|
|
|
|
|
attach init => { |
57
|
|
|
|
|
|
|
SDL_Init => [ ['uint32'] => 'int' ], |
58
|
|
|
|
|
|
|
SDL_InitSubSystem => [ ['uint32'] => 'int' ], |
59
|
|
|
|
|
|
|
SDL_Quit => [ [] ], |
60
|
|
|
|
|
|
|
SDL_QuitSubSystem => [ ['uint32'] ], |
61
|
|
|
|
|
|
|
SDL_WasInit => [ ['uint32'] => 'uint32' ] |
62
|
|
|
|
|
|
|
}; |
63
|
|
|
|
|
|
|
# |
64
|
|
|
|
|
|
|
ffi->type( '(opaque,string,string,string)->void' => 'SDL_HintCallback' ); |
65
|
|
|
|
|
|
|
attach hints => { |
66
|
|
|
|
|
|
|
SDL_SetHintWithPriority => [ [ 'string', 'string', 'int' ] => 'bool' ], |
67
|
|
|
|
|
|
|
SDL_SetHint => [ [ 'string', 'string' ] => 'bool' ], |
68
|
|
|
|
|
|
|
SDL_GetHint => [ ['string'] => 'string' ], |
69
|
|
|
|
|
|
|
$ver->patch >= 5 ? ( SDL_GetHintBoolean => [ [ 'string', 'bool' ] => 'bool' ] ) : (), |
70
|
|
|
|
|
|
|
SDL_AddHintCallback => [ |
71
|
|
|
|
|
|
|
[ 'string', 'SDL_HintCallback', 'opaque' ] => 'void' => |
72
|
|
|
|
|
|
|
sub ( $xsub, $name, $callback, $userdata ) { # Fake void pointer |
73
|
|
|
|
|
|
|
my $cb = FFI::Platypus::Closure->new( |
74
|
|
|
|
|
|
|
sub ( $ptr, @etc ) { $callback->( $userdata, @etc ) } ); |
75
|
|
|
|
|
|
|
$cb->sticky; |
76
|
|
|
|
|
|
|
$xsub->( $name, $cb, $userdata ); |
77
|
|
|
|
|
|
|
return $cb; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
], |
80
|
|
|
|
|
|
|
SDL_DelHintCallback => [ |
81
|
|
|
|
|
|
|
[ 'string', 'SDL_HintCallback', 'opaque' ] => 'void' => |
82
|
|
|
|
|
|
|
sub ( $xsub, $name, $callback, $userdata ) { # Fake void pointer |
83
|
|
|
|
|
|
|
my $cb = $callback; |
84
|
|
|
|
|
|
|
$cb->unstick; |
85
|
|
|
|
|
|
|
$xsub->( $name, $cb, $userdata ); |
86
|
|
|
|
|
|
|
return $cb; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
], |
89
|
|
|
|
|
|
|
SDL_ClearHints => [ [] => 'void' ], |
90
|
|
|
|
|
|
|
}, |
91
|
|
|
|
|
|
|
error => { |
92
|
|
|
|
|
|
|
SDL_SetError => [ |
93
|
|
|
|
|
|
|
['string'] => 'int' => |
94
|
|
|
|
|
|
|
sub ( $inner, $fmt, @params ) { $inner->( sprintf( $fmt, @params ) ); } |
95
|
|
|
|
|
|
|
], |
96
|
|
|
|
|
|
|
SDL_GetError => [ [] => 'string' ], |
97
|
|
|
|
|
|
|
SDL_GetErrorMsg => [ |
98
|
|
|
|
|
|
|
[ 'string', 'int' ] => 'string' => sub ( $inner, $errstr, $maxlen = length $errstr ) { |
99
|
|
|
|
|
|
|
$_[1] = ' ' x $maxlen if !defined $_[1] || length $errstr != $maxlen; |
100
|
|
|
|
|
|
|
$inner->( $_[1], $maxlen ); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
], |
103
|
|
|
|
|
|
|
SDL_ClearError => [ [] => 'void' ] |
104
|
|
|
|
|
|
|
}; |
105
|
|
|
|
|
|
|
ffi->type( '(opaque,int,int,string)->void' => 'SDL_LogOutputFunction' ); |
106
|
|
|
|
|
|
|
attach log => { |
107
|
|
|
|
|
|
|
SDL_LogSetAllPriority => [ ['SDL_LogPriority'] ], |
108
|
|
|
|
|
|
|
SDL_LogSetPriority => [ [ 'SDL_LogCategory', 'SDL_LogPriority' ] ], |
109
|
|
|
|
|
|
|
SDL_LogGetPriority => [ ['SDL_LogCategory'] => 'SDL_LogPriority' ], |
110
|
|
|
|
|
|
|
SDL_LogResetPriorities => [ [] ], |
111
|
|
|
|
|
|
|
SDL_Log => [ |
112
|
|
|
|
|
|
|
['string'] => 'string' => |
113
|
|
|
|
|
|
|
sub ( $inner, $fmt, @args ) { $inner->( sprintf( $fmt, @args ) ) } |
114
|
|
|
|
|
|
|
], |
115
|
|
|
|
|
|
|
SDL_LogVerbose => => [ |
116
|
|
|
|
|
|
|
[ 'SDL_LogCategory', 'string' ] => sub ( $inner, $category, $fmt, @args ) { |
117
|
|
|
|
|
|
|
$inner->( $category, sprintf( $fmt, @args ) ); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
], |
120
|
|
|
|
|
|
|
SDL_LogDebug => => [ |
121
|
|
|
|
|
|
|
[ 'SDL_LogCategory', 'string' ] => sub ( $inner, $category, $fmt, @args ) { |
122
|
|
|
|
|
|
|
$inner->( $category, sprintf( $fmt, @args ) ); |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
], |
125
|
|
|
|
|
|
|
SDL_LogInfo => => [ |
126
|
|
|
|
|
|
|
[ 'SDL_LogCategory', 'string' ] => sub ( $inner, $category, $fmt, @args ) { |
127
|
|
|
|
|
|
|
$inner->( $category, sprintf( $fmt, @args ) ); |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
], |
130
|
|
|
|
|
|
|
SDL_LogWarn => => [ |
131
|
|
|
|
|
|
|
[ 'SDL_LogCategory', 'string' ] => sub ( $inner, $category, $fmt, @args ) { |
132
|
|
|
|
|
|
|
$inner->( $category, sprintf( $fmt, @args ) ); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
], |
135
|
|
|
|
|
|
|
SDL_LogError => => [ |
136
|
|
|
|
|
|
|
[ 'SDL_LogCategory', 'string' ] => sub ( $inner, $category, $fmt, @args ) { |
137
|
|
|
|
|
|
|
$inner->( $category, sprintf( $fmt, @args ) ); |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
], |
140
|
|
|
|
|
|
|
SDL_LogCritical => => [ |
141
|
|
|
|
|
|
|
[ 'SDL_LogCategory', 'string' ] => sub ( $inner, $category, $fmt, @args ) { |
142
|
|
|
|
|
|
|
$inner->( $category, sprintf( $fmt, @args ) ); |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
], |
145
|
|
|
|
|
|
|
SDL_LogMessage => [ |
146
|
|
|
|
|
|
|
[ 'SDL_LogCategory', 'SDL_LogPriority', 'string' ] => |
147
|
|
|
|
|
|
|
sub ( $inner, $category, $priority, $fmt, @args ) { |
148
|
|
|
|
|
|
|
$inner->( $category, $priority, sprintf( $fmt, @args ) ); |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
], |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
# TODO |
153
|
|
|
|
|
|
|
SDL_LogGetOutputFunction => [ [ 'SDL_LogOutputFunction', 'opaque' ] ], |
154
|
|
|
|
|
|
|
SDL_LogSetOutputFunction => [ |
155
|
|
|
|
|
|
|
[ 'SDL_LogOutputFunction', 'opaque' ] => 'void' => sub ( $xsub, $callback, $userdata ) |
156
|
|
|
|
|
|
|
{ # Fake void pointer |
157
|
|
|
|
|
|
|
my $cb = FFI::Platypus::Closure->new( |
158
|
|
|
|
|
|
|
sub ( $ptr, @etc ) { $callback->( $userdata, @etc ) } ); |
159
|
|
|
|
|
|
|
$cb->sticky; |
160
|
|
|
|
|
|
|
$xsub->( $cb, $userdata ); |
161
|
|
|
|
|
|
|
return $cb; |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
] |
164
|
|
|
|
|
|
|
}; |
165
|
|
|
|
|
|
|
# |
166
|
|
|
|
|
|
|
package SDL2::AssertData { |
167
|
2
|
|
|
2
|
|
22
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
24
|
|
168
|
|
|
|
|
|
|
has |
169
|
|
|
|
|
|
|
always_ignore => 'int', |
170
|
|
|
|
|
|
|
trigger_count => 'uint', |
171
|
|
|
|
|
|
|
condition => 'opaque', # string |
172
|
|
|
|
|
|
|
filename => 'opaque', # string |
173
|
|
|
|
|
|
|
linenum => 'int', |
174
|
|
|
|
|
|
|
function => 'opaque', # string |
175
|
|
|
|
|
|
|
next => 'opaque' # const struct SDL_AssertData *next |
176
|
|
|
|
|
|
|
}; |
177
|
|
|
|
|
|
|
attach assert => { |
178
|
|
|
|
|
|
|
SDL_ReportAssertion => [ [ 'opaque', 'string', 'string', 'int' ], 'opaque' ], |
179
|
|
|
|
|
|
|
SDL_GetAssertionReport => [ ['SDL_AssertData'] ], |
180
|
|
|
|
|
|
|
}; |
181
|
|
|
|
|
|
|
FFI::C::ArrayDef->new( # Used sparingly when I need to pass a list of SDL_Point objects |
182
|
|
|
|
|
|
|
ffi, |
183
|
|
|
|
|
|
|
name => 'SDL2x_PointList', |
184
|
|
|
|
|
|
|
class => 'SDL2x::PointList', |
185
|
|
|
|
|
|
|
members => ['SDL_Point'], |
186
|
|
|
|
|
|
|
); |
187
|
|
|
|
|
|
|
FFI::C::ArrayDef->new( # Used sparingly when I need to pass a list of SDL_Point objects |
188
|
|
|
|
|
|
|
ffi, |
189
|
|
|
|
|
|
|
name => 'SDL2x_FPointList', |
190
|
|
|
|
|
|
|
class => 'SDL2x::FPointList', |
191
|
|
|
|
|
|
|
members => ['SDL_Point'], |
192
|
|
|
|
|
|
|
); |
193
|
|
|
|
|
|
|
FFI::C::ArrayDef->new( # Used sparingly when I need to pass a list of SDL_Rect objects |
194
|
|
|
|
|
|
|
ffi, |
195
|
|
|
|
|
|
|
name => 'SDL2x_RectList', |
196
|
|
|
|
|
|
|
class => 'SDL2x::RectList', |
197
|
|
|
|
|
|
|
members => ['SDL_Rect'], |
198
|
|
|
|
|
|
|
); |
199
|
|
|
|
|
|
|
FFI::C::ArrayDef->new( # Used sparingly when I need to pass a list of SDL_Rect objects |
200
|
|
|
|
|
|
|
ffi, |
201
|
|
|
|
|
|
|
name => 'SDL2x_FRectList', |
202
|
|
|
|
|
|
|
class => 'SDL2x::FRectList', |
203
|
|
|
|
|
|
|
members => ['SDL_FRect'], |
204
|
|
|
|
|
|
|
); |
205
|
|
|
|
|
|
|
# |
206
|
|
|
|
|
|
|
ffi->type( '(opaque,opaque,opaque)->int' => 'SDL_HitTest' ); |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
# An opaque handle to an OpenGL context. |
209
|
2
|
|
|
2
|
|
1646
|
package SDL2::GLContext { use SDL2::Utils; has() }; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
210
|
|
|
|
|
|
|
attach video => { |
211
|
|
|
|
|
|
|
SDL_GetNumVideoDrivers => [ [], 'int' ], |
212
|
|
|
|
|
|
|
SDL_GetVideoDriver => [ ['int'], 'string' ], |
213
|
|
|
|
|
|
|
SDL_VideoInit => [ ['string'], 'int' ], |
214
|
|
|
|
|
|
|
SDL_VideoQuit => [ [] ], |
215
|
|
|
|
|
|
|
SDL_GetCurrentVideoDriver => [ [], 'string' ], |
216
|
|
|
|
|
|
|
SDL_GetNumVideoDisplays => [ [], 'int' ], |
217
|
|
|
|
|
|
|
SDL_GetDisplayName => [ ['int'], 'string' ], |
218
|
|
|
|
|
|
|
SDL_GetDisplayBounds => [ [ 'int', 'SDL_Rect' ], 'int' ], |
219
|
|
|
|
|
|
|
SDL_GetDisplayUsableBounds => [ [ 'int', 'SDL_Rect' ], 'int' ], |
220
|
|
|
|
|
|
|
SDL_GetDisplayDPI => [ [ 'int', 'float *', 'float *', 'float *' ], 'int' ], |
221
|
|
|
|
|
|
|
SDL_GetDisplayOrientation => [ ['int'], 'int' ], |
222
|
|
|
|
|
|
|
SDL_GetNumDisplayModes => [ ['int'], 'int' ], |
223
|
|
|
|
|
|
|
SDL_GetDisplayMode => [ [ 'int', 'int', 'SDL_DisplayMode' ], 'int' ], |
224
|
|
|
|
|
|
|
SDL_GetDesktopDisplayMode => [ [ 'int', 'SDL_DisplayMode' ], 'int' ], |
225
|
|
|
|
|
|
|
SDL_GetCurrentDisplayMode => [ [ 'int', 'SDL_DisplayMode' ], 'int' ], |
226
|
|
|
|
|
|
|
SDL_GetClosestDisplayMode => [ [ 'int', 'SDL_DisplayMode', 'SDL_DisplayMode' ], 'opaque' ], |
227
|
|
|
|
|
|
|
SDL_GetWindowDisplayIndex => [ ['SDL_Window'], 'int' ], |
228
|
|
|
|
|
|
|
SDL_SetWindowDisplayMode => [ [ 'SDL_Window', 'SDL_DisplayMode' ], 'int' ], |
229
|
|
|
|
|
|
|
SDL_GetWindowDisplayMode => [ [ 'SDL_Window', 'SDL_DisplayMode' ], 'int' ], |
230
|
|
|
|
|
|
|
SDL_GetWindowPixelFormat => [ ['SDL_Window'], 'uint32' ], |
231
|
|
|
|
|
|
|
SDL_CreateWindow => [ [ 'string', 'int', 'int', 'int', 'int', 'uint32' ] => 'SDL_Window' ], |
232
|
|
|
|
|
|
|
SDL_CreateWindowFrom => [ ['opaque'] => 'SDL_Window' ], |
233
|
|
|
|
|
|
|
SDL_GetWindowID => [ ['SDL_Window'] => 'uint32' ], |
234
|
|
|
|
|
|
|
SDL_GetWindowFromID => [ ['uint32'] => 'SDL_Window' ], |
235
|
|
|
|
|
|
|
SDL_GetWindowFlags => [ ['SDL_Window'] => 'uint32' ], |
236
|
|
|
|
|
|
|
SDL_SetWindowTitle => [ [ 'SDL_Window', 'string' ] ], |
237
|
|
|
|
|
|
|
SDL_GetWindowTitle => [ ['SDL_Window'], 'string' ], |
238
|
|
|
|
|
|
|
SDL_SetWindowIcon => [ [ 'SDL_Window', 'SDL_Surface' ] ], |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
# These don't work correctly yet. (cast issues) |
241
|
|
|
|
|
|
|
SDL_SetWindowData => [ [ 'SDL_Window', 'string', 'opaque*' ], 'opaque*' ], |
242
|
|
|
|
|
|
|
SDL_GetWindowData => [ [ 'SDL_Window', 'string' ], 'opaque*' ], |
243
|
|
|
|
|
|
|
SDL_SetWindowPosition => [ [ 'SDL_Window', 'int', 'int' ] ], |
244
|
|
|
|
|
|
|
SDL_GetWindowPosition => [ [ 'SDL_Window', 'int*', 'int*' ] ], |
245
|
|
|
|
|
|
|
SDL_SetWindowSize => [ [ 'SDL_Window', 'int', 'int' ] ], |
246
|
|
|
|
|
|
|
SDL_GetWindowSize => [ [ 'SDL_Window', 'int*', 'int*' ] ], |
247
|
|
|
|
|
|
|
SDL_GetWindowBordersSize => [ [ 'SDL_Window', 'int*', 'int*', 'int*', 'int*' ], 'int' ], |
248
|
|
|
|
|
|
|
SDL_SetWindowMinimumSize => [ [ 'SDL_Window', 'int', 'int' ] ], |
249
|
|
|
|
|
|
|
SDL_GetWindowMinimumSize => [ [ 'SDL_Window', 'int*', 'int*' ] ], |
250
|
|
|
|
|
|
|
SDL_SetWindowMaximumSize => [ [ 'SDL_Window', 'int', 'int' ] ], |
251
|
|
|
|
|
|
|
SDL_GetWindowMaximumSize => [ [ 'SDL_Window', 'int*', 'int*' ] ], |
252
|
|
|
|
|
|
|
SDL_SetWindowBordered => [ [ 'SDL_Window', 'bool' ] ], |
253
|
|
|
|
|
|
|
SDL_SetWindowResizable => [ [ 'SDL_Window', 'bool' ] ], |
254
|
|
|
|
|
|
|
SDL_ShowWindow => [ ['SDL_Window'] ], |
255
|
|
|
|
|
|
|
SDL_HideWindow => [ ['SDL_Window'] ], |
256
|
|
|
|
|
|
|
SDL_RaiseWindow => [ ['SDL_Window'] ], |
257
|
|
|
|
|
|
|
SDL_MaximizeWindow => [ ['SDL_Window'] ], |
258
|
|
|
|
|
|
|
SDL_MinimizeWindow => [ ['SDL_Window'] ], |
259
|
|
|
|
|
|
|
SDL_RestoreWindow => [ ['SDL_Window'] ], |
260
|
|
|
|
|
|
|
SDL_SetWindowFullscreen => [ [ 'SDL_Window', 'uint32' ], 'int' ], |
261
|
|
|
|
|
|
|
SDL_GetWindowSurface => [ ['SDL_Window'], 'SDL_Surface' ], |
262
|
|
|
|
|
|
|
SDL_UpdateWindowSurface => [ ['SDL_Window'], 'int' ], |
263
|
|
|
|
|
|
|
SDL_UpdateWindowSurfaceRects => [ [ 'SDL_Window', 'opaque*', 'int' ], 'int' ], |
264
|
|
|
|
|
|
|
SDL_SetWindowGrab => [ [ 'SDL_Window', 'bool' ] ], |
265
|
|
|
|
|
|
|
( $ver->patch >= 15 ? ( SDL_SetWindowKeyboardGrab => [ [ 'SDL_Window', 'bool' ] ] ) : () ), |
266
|
|
|
|
|
|
|
( $ver->patch >= 15 ? ( SDL_SetWindowMouseGrab => [ [ 'SDL_Window', 'bool' ] ] ) : () ), |
267
|
|
|
|
|
|
|
SDL_GetWindowGrab => [ ['SDL_Window'], 'bool' ], |
268
|
|
|
|
|
|
|
( $ver->patch >= 15 ? ( SDL_GetWindowKeyboardGrab => [ ['SDL_Window'], 'bool' ] ) : () ), |
269
|
|
|
|
|
|
|
( $ver->patch >= 15 ? ( SDL_GetWindowMouseGrab => [ ['SDL_Window'], 'bool' ] ) : () ), |
270
|
|
|
|
|
|
|
SDL_GetGrabbedWindow => [ [], 'SDL_Window' ], |
271
|
|
|
|
|
|
|
SDL_SetWindowBrightness => [ [ 'SDL_Window', 'float' ], 'int' ], |
272
|
|
|
|
|
|
|
SDL_GetWindowBrightness => [ ['SDL_Window'], 'float' ], |
273
|
|
|
|
|
|
|
SDL_SetWindowOpacity => [ [ 'SDL_Window', 'float' ], 'int' ], |
274
|
|
|
|
|
|
|
SDL_GetWindowOpacity => [ [ 'SDL_Window', 'float*' ], 'int' ], |
275
|
|
|
|
|
|
|
SDL_SetWindowModalFor => [ [ 'SDL_Window', 'SDL_Window' ], 'int' ], |
276
|
|
|
|
|
|
|
SDL_SetWindowInputFocus => [ ['SDL_Window'], 'int' ], |
277
|
|
|
|
|
|
|
SDL_SetWindowGammaRamp => |
278
|
|
|
|
|
|
|
[ [ 'SDL_Window', 'uint32[256]', 'uint32[256]', 'uint32[256]' ], 'int' ], |
279
|
|
|
|
|
|
|
SDL_GetWindowGammaRamp => [ |
280
|
|
|
|
|
|
|
[ 'SDL_Window', 'uint32[256]', 'uint32[256]', 'uint32[256]' ], 'int' |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
#=> sub ( $inner, $window ) { |
283
|
|
|
|
|
|
|
# my @red = my @blue = my @green = map { \0 } 1 .. 256; |
284
|
|
|
|
|
|
|
# my $ok = $inner->( $window, \@red, \@green, \@blue ); |
285
|
|
|
|
|
|
|
# $ok == 0 ? ( \@red, \@green, \@blue ) : $ok; |
286
|
|
|
|
|
|
|
#} |
287
|
|
|
|
|
|
|
], |
288
|
|
|
|
|
|
|
SDL_SetWindowHitTest => [ |
289
|
|
|
|
|
|
|
[ 'SDL_Window', 'SDL_HitTest', 'opaque' ], |
290
|
|
|
|
|
|
|
'int' => sub ( $xsub, $window, $callback, $callback_data = () ) { # Fake void pointer |
291
|
|
|
|
|
|
|
my $cb = $callback; |
292
|
|
|
|
|
|
|
if ( defined $callback ) { |
293
|
|
|
|
|
|
|
$cb = FFI::Platypus::Closure->new( |
294
|
|
|
|
|
|
|
sub ( $win, $area, $data ) { |
295
|
|
|
|
|
|
|
$callback->( |
296
|
|
|
|
|
|
|
ffi->cast( 'opaque' => 'SDL_Window', $win ), |
297
|
|
|
|
|
|
|
ffi->cast( 'opaque' => 'SDL_Point', $area ), |
298
|
|
|
|
|
|
|
$callback_data |
299
|
|
|
|
|
|
|
); |
300
|
|
|
|
|
|
|
} |
301
|
|
|
|
|
|
|
); |
302
|
|
|
|
|
|
|
$cb->sticky; |
303
|
|
|
|
|
|
|
} |
304
|
|
|
|
|
|
|
$xsub->( $window, $cb, $callback_data ); |
305
|
|
|
|
|
|
|
return $cb; |
306
|
|
|
|
|
|
|
} |
307
|
|
|
|
|
|
|
], |
308
|
|
|
|
|
|
|
( $ver->patch >= 15 ? ( SDL_FlashWindow => [ [ 'SDL_Window', 'uint32' ], 'int' ] ) : () ), |
309
|
|
|
|
|
|
|
SDL_DestroyWindow => [ ['SDL_Window'] ], |
310
|
|
|
|
|
|
|
SDL_IsScreenSaverEnabled => [ [], 'bool' ], |
311
|
|
|
|
|
|
|
SDL_EnableScreenSaver => [ [] ], |
312
|
|
|
|
|
|
|
SDL_DisableScreenSaver => [ [] ], |
313
|
|
|
|
|
|
|
}, |
314
|
|
|
|
|
|
|
opengl => { |
315
|
|
|
|
|
|
|
SDL_GL_LoadLibrary => [ ['string'], 'int' ], |
316
|
|
|
|
|
|
|
SDL_GL_GetProcAddress => [ ['string'], 'opaque' ], |
317
|
|
|
|
|
|
|
SDL_GL_UnloadLibrary => [ [] ], |
318
|
|
|
|
|
|
|
SDL_GL_ExtensionSupported => [ ['string'], 'bool' ], |
319
|
|
|
|
|
|
|
SDL_GL_ResetAttributes => [ [] ], |
320
|
|
|
|
|
|
|
SDL_GL_SetAttribute => [ [ 'SDL_GLattr', 'int' ], 'int' ], |
321
|
|
|
|
|
|
|
SDL_GL_GetAttribute => [ [ 'SDL_GLattr', 'int*' ], 'int' ], |
322
|
|
|
|
|
|
|
SDL_GL_CreateContext => [ ['SDL_Window'], 'SDL_GLContext' ], |
323
|
|
|
|
|
|
|
SDL_GL_MakeCurrent => [ [ 'SDL_Window', 'SDL_GLContext' ], 'int' ], |
324
|
|
|
|
|
|
|
SDL_GL_GetCurrentWindow => [ [], 'SDL_Window' ], |
325
|
|
|
|
|
|
|
SDL_GL_GetCurrentContext => [ [], 'SDL_GLContext' ], |
326
|
|
|
|
|
|
|
SDL_GL_GetDrawableSize => [ [ 'SDL_Window', 'int*', 'int*' ], ], |
327
|
|
|
|
|
|
|
SDL_GL_SetSwapInterval => [ ['int'], 'int' ], |
328
|
|
|
|
|
|
|
SDL_GL_GetSwapInterval => [ [], 'int' ], |
329
|
|
|
|
|
|
|
SDL_GL_SwapWindow => [ ['SDL_Window'] ], |
330
|
|
|
|
|
|
|
SDL_GL_DeleteContext => [ ['SDL_GLContext'] ] |
331
|
|
|
|
|
|
|
}; |
332
|
|
|
|
|
|
|
attach render => { |
333
|
|
|
|
|
|
|
SDL_GetNumRenderDrivers => [ [], 'int' ], |
334
|
|
|
|
|
|
|
SDL_GetRenderDriverInfo => [ [ 'int', 'SDL_RendererInfo' ], 'int' ], |
335
|
|
|
|
|
|
|
SDL_CreateWindowAndRenderer => [ |
336
|
|
|
|
|
|
|
[ 'int', 'int', 'uint32', 'opaque*', 'opaque*' ], 'int' |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
#=> sub ( $inner, $width, $height, $window_flags ) { |
339
|
|
|
|
|
|
|
# my $window = SDL2::Window->new; |
340
|
|
|
|
|
|
|
# my $renderer = SDL2::Renderer->new; |
341
|
|
|
|
|
|
|
# my $ok = $inner->( $width, $height, $window_flags, \$window, \$renderer ); |
342
|
|
|
|
|
|
|
# $ok == 0 ? ( |
343
|
|
|
|
|
|
|
# ffi->cast( 'opaque' => 'SDL_Window', $window ), |
344
|
|
|
|
|
|
|
# ffi->cast( 'opaque' => 'SDL_Renderer', $renderer ), |
345
|
|
|
|
|
|
|
# ) : |
346
|
|
|
|
|
|
|
# $ok; |
347
|
|
|
|
|
|
|
#} |
348
|
|
|
|
|
|
|
], |
349
|
|
|
|
|
|
|
SDL_CreateRenderer => [ [ 'SDL_Window', 'int', 'uint32' ], 'SDL_Renderer' ], |
350
|
|
|
|
|
|
|
SDL_CreateSoftwareRenderer => [ ['SDL_Surface'], 'SDL_Renderer' ], |
351
|
|
|
|
|
|
|
SDL_GetRenderer => [ ['SDL_Window'], 'SDL_Renderer' ], |
352
|
|
|
|
|
|
|
SDL_GetRendererInfo => [ [ 'SDL_Renderer', 'SDL_RendererInfo' ], 'int' ], |
353
|
|
|
|
|
|
|
SDL_GetRendererOutputSize => [ [ 'SDL_Renderer', 'int*', 'int*' ], 'int' ], |
354
|
|
|
|
|
|
|
SDL_CreateTexture => [ [ 'SDL_Renderer', 'uint32', 'int', 'int', 'int' ], 'SDL_Texture' ], |
355
|
|
|
|
|
|
|
SDL_CreateTextureFromSurface => [ [ 'SDL_Renderer', 'SDL_Surface' ], 'SDL_Texture' ], |
356
|
|
|
|
|
|
|
SDL_QueryTexture => [ [ 'SDL_Texture', 'uint32*', 'int*', 'int*', 'int*' ], 'int' ], |
357
|
|
|
|
|
|
|
SDL_SetTextureColorMod => [ [ 'SDL_Texture', 'uint8', 'uint8', 'uint8' ], 'int' ], |
358
|
|
|
|
|
|
|
SDL_GetTextureColorMod => [ [ 'SDL_Texture', 'uint8*', 'uint8*', 'uint8*' ], 'int' ], |
359
|
|
|
|
|
|
|
SDL_SetTextureAlphaMod => [ [ 'SDL_Texture', 'uint8' ], 'int' ], |
360
|
|
|
|
|
|
|
SDL_GetTextureAlphaMod => [ [ 'SDL_Texture', 'uint8*' ], 'int' ], |
361
|
|
|
|
|
|
|
SDL_SetTextureBlendMode => [ [ 'SDL_Texture', 'SDL_BlendMode' ], 'int' ], |
362
|
|
|
|
|
|
|
SDL_GetTextureBlendMode => [ [ 'SDL_Texture', 'int*' ], 'int' ], |
363
|
|
|
|
|
|
|
SDL_UpdateTexture => [ [ 'SDL_Texture', 'SDL_Rect', 'opaque*', 'int' ], 'int' ], |
364
|
|
|
|
|
|
|
SDL_UpdateYUVTexture => [ |
365
|
|
|
|
|
|
|
[ 'SDL_Texture', 'SDL_Rect', 'uint8*', 'int', 'uint8*', 'int', 'uint8*', 'int' ], 'int' |
366
|
|
|
|
|
|
|
], ( |
367
|
|
|
|
|
|
|
$ver->patch >= 15 ? |
368
|
|
|
|
|
|
|
( SDL_UpdateNVTexture => |
369
|
|
|
|
|
|
|
[ [ 'SDL_Texture', 'SDL_Rect', 'uint8*', 'int', 'uint8*', 'int' ], 'int' ] ) : |
370
|
|
|
|
|
|
|
() |
371
|
|
|
|
|
|
|
), |
372
|
|
|
|
|
|
|
SDL_LockTexture => [ [ 'SDL_Texture', 'SDL_Rect', 'opaque*' ], 'int' ], |
373
|
|
|
|
|
|
|
SDL_LockTextureToSurface => [ [ 'SDL_Texture', 'SDL_Rect', 'SDL_Surface' ], 'int' ], |
374
|
|
|
|
|
|
|
SDL_UnlockTexture => [ ['SDL_Texture'] ], |
375
|
|
|
|
|
|
|
SDL_RenderTargetSupported => [ ['SDL_Renderer'], 'bool' ], |
376
|
|
|
|
|
|
|
SDL_SetRenderTarget => [ [ 'SDL_Renderer', 'SDL_Texture' ], 'int' ], |
377
|
|
|
|
|
|
|
SDL_GetRenderTarget => [ ['SDL_Renderer'], 'SDL_Texture' ], |
378
|
|
|
|
|
|
|
SDL_RenderSetLogicalSize => [ [ 'SDL_Renderer', 'int', 'int' ], 'int' ], |
379
|
|
|
|
|
|
|
SDL_RenderGetLogicalSize => [ [ 'SDL_Renderer', 'int*', 'int*' ], 'int' ], |
380
|
|
|
|
|
|
|
SDL_RenderSetIntegerScale => [ [ 'SDL_Renderer', 'bool' ], 'int' ], |
381
|
|
|
|
|
|
|
SDL_RenderGetIntegerScale => [ ['SDL_Renderer'], 'bool' ], |
382
|
|
|
|
|
|
|
SDL_RenderSetViewport => [ [ 'SDL_Renderer', 'SDL_Rect' ], 'int' ], |
383
|
|
|
|
|
|
|
SDL_RenderGetViewport => [ [ 'SDL_Renderer', 'SDL_Rect' ], 'int' ], |
384
|
|
|
|
|
|
|
SDL_RenderSetClipRect => [ [ 'SDL_Renderer', 'SDL_Rect' ], 'int' ], |
385
|
|
|
|
|
|
|
SDL_RenderGetClipRect => [ [ 'SDL_Renderer', 'SDL_Rect' ] ], |
386
|
|
|
|
|
|
|
SDL_RenderIsClipEnabled => [ ['SDL_Renderer'], 'bool' ], |
387
|
|
|
|
|
|
|
SDL_RenderSetScale => [ [ 'SDL_Renderer', 'float', 'float' ], 'int' ], |
388
|
|
|
|
|
|
|
SDL_RenderGetScale => [ [ 'SDL_Renderer', 'float*', 'float*' ], ], |
389
|
|
|
|
|
|
|
SDL_SetRenderDrawColor => [ [ 'SDL_Renderer', 'uint8', 'uint8', 'uint8', 'uint8' ], 'int' ], |
390
|
|
|
|
|
|
|
SDL_GetRenderDrawColor => |
391
|
|
|
|
|
|
|
[ [ 'SDL_Renderer', 'uint8*', 'uint8*', 'uint8*', 'uint8*' ], 'int' ], |
392
|
|
|
|
|
|
|
SDL_SetRenderDrawBlendMode => [ [ 'SDL_Renderer', 'SDL_BlendMode' ], 'int' ], |
393
|
|
|
|
|
|
|
SDL_GetRenderDrawBlendMode => [ [ 'SDL_Renderer', 'int*' ], 'int' ], |
394
|
|
|
|
|
|
|
SDL_RenderClear => [ ['SDL_Renderer'], 'int' ], |
395
|
|
|
|
|
|
|
SDL_RenderDrawPoint => [ [ 'SDL_Renderer', 'int', 'int' ], 'int' ], |
396
|
|
|
|
|
|
|
SDL_RenderDrawPoints => [ |
397
|
|
|
|
|
|
|
[ 'SDL_Renderer', 'SDL2x_PointList', 'int' ], |
398
|
|
|
|
|
|
|
'int' => sub ( $inner, $renderer, @points ) { |
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
# XXX - This is a workaround for FFI::C::Array not being able to accept a list of objects |
401
|
|
|
|
|
|
|
# XXX - I can rethink this map when https://github.com/PerlFFI/FFI-C/issues/53 is resolved |
402
|
|
|
|
|
|
|
$inner->( |
403
|
|
|
|
|
|
|
$renderer, |
404
|
|
|
|
|
|
|
SDL2x::PointList->new( |
405
|
|
|
|
|
|
|
[ map { ref $_ eq 'HASH' ? $_ : { x => $_->x, y => $_->y } } @points ] |
406
|
|
|
|
|
|
|
), |
407
|
|
|
|
|
|
|
scalar @points |
408
|
|
|
|
|
|
|
); |
409
|
|
|
|
|
|
|
} |
410
|
|
|
|
|
|
|
], |
411
|
|
|
|
|
|
|
SDL_RenderDrawLine => [ [ 'SDL_Renderer', 'int', 'int', 'int', 'int' ], 'int' ], |
412
|
|
|
|
|
|
|
SDL_RenderDrawLines => [ |
413
|
|
|
|
|
|
|
[ 'SDL_Renderer', 'SDL2x_PointList', 'int' ], |
414
|
|
|
|
|
|
|
'int' => sub ( $inner, $renderer, @points ) { |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
# XXX - This is a workaround for FFI::C::Array not being able to accept a list of objects |
417
|
|
|
|
|
|
|
# XXX - I can rethink this map when https://github.com/PerlFFI/FFI-C/issues/53 is resolved |
418
|
|
|
|
|
|
|
$inner->( |
419
|
|
|
|
|
|
|
$renderer, |
420
|
|
|
|
|
|
|
SDL2x::PointList->new( |
421
|
|
|
|
|
|
|
[ map { ref $_ eq 'HASH' ? $_ : { x => $_->x, y => $_->y } } @points ] |
422
|
|
|
|
|
|
|
), |
423
|
|
|
|
|
|
|
scalar @points |
424
|
|
|
|
|
|
|
); |
425
|
|
|
|
|
|
|
} |
426
|
|
|
|
|
|
|
], |
427
|
|
|
|
|
|
|
SDL_RenderDrawRect => [ [ 'SDL_Renderer', 'SDL_Rect' ], 'int' ], |
428
|
|
|
|
|
|
|
SDL_RenderDrawRects => [ |
429
|
|
|
|
|
|
|
[ 'SDL_Renderer', 'SDL2x_RectList', 'int' ], |
430
|
|
|
|
|
|
|
'int' => sub ( $inner, $renderer, @rects ) { |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
# XXX - This is a workaround for FFI::C::Array not being able to accept a list of objects |
433
|
|
|
|
|
|
|
# XXX - I can rethink this map when https://github.com/PerlFFI/FFI-C/issues/53 is resolved |
434
|
|
|
|
|
|
|
$inner->( |
435
|
|
|
|
|
|
|
$renderer, |
436
|
|
|
|
|
|
|
SDL2x::RectList->new( |
437
|
|
|
|
|
|
|
[ map { |
438
|
|
|
|
|
|
|
ref $_ eq 'HASH' ? $_ : |
439
|
|
|
|
|
|
|
{ x => $_->x, y => $_->y, w => $_->w, h => $_->h } |
440
|
|
|
|
|
|
|
} @rects |
441
|
|
|
|
|
|
|
] |
442
|
|
|
|
|
|
|
), |
443
|
|
|
|
|
|
|
scalar @rects |
444
|
|
|
|
|
|
|
); |
445
|
|
|
|
|
|
|
} |
446
|
|
|
|
|
|
|
], |
447
|
|
|
|
|
|
|
SDL_RenderFillRect => [ [ 'SDL_Renderer', 'SDL_Rect' ], 'int' ], |
448
|
|
|
|
|
|
|
SDL_RenderFillRects => [ |
449
|
|
|
|
|
|
|
[ 'SDL_Renderer', 'SDL2x_RectList', 'int' ], |
450
|
|
|
|
|
|
|
'int' => sub ( $inner, $renderer, @rects ) { |
451
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
# XXX - This is a workaround for FFI::C::Array not being able to accept a list of objects |
453
|
|
|
|
|
|
|
# XXX - I can rethink this map when https://github.com/PerlFFI/FFI-C/issues/53 is resolved |
454
|
|
|
|
|
|
|
$inner->( |
455
|
|
|
|
|
|
|
$renderer, |
456
|
|
|
|
|
|
|
SDL2x::RectList->new( |
457
|
|
|
|
|
|
|
[ map { |
458
|
|
|
|
|
|
|
ref $_ eq 'HASH' ? $_ : |
459
|
|
|
|
|
|
|
{ x => $_->x, y => $_->y, w => $_->w, h => $_->h } |
460
|
|
|
|
|
|
|
} @rects |
461
|
|
|
|
|
|
|
] |
462
|
|
|
|
|
|
|
), |
463
|
|
|
|
|
|
|
scalar @rects |
464
|
|
|
|
|
|
|
); |
465
|
|
|
|
|
|
|
} |
466
|
|
|
|
|
|
|
], |
467
|
|
|
|
|
|
|
SDL_RenderCopy => [ [ 'SDL_Renderer', 'SDL_Texture', 'SDL_Rect', 'SDL_Rect' ], 'int' ], |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
# XXX - I do not have an example for this function in docs |
470
|
|
|
|
|
|
|
SDL_RenderCopyEx => [ |
471
|
|
|
|
|
|
|
[ 'SDL_Renderer', 'SDL_Texture', 'SDL_Rect', 'SDL_Rect', |
472
|
|
|
|
|
|
|
'double', 'SDL_Point', 'SDL_RendererFlip' |
473
|
|
|
|
|
|
|
], |
474
|
|
|
|
|
|
|
'int' |
475
|
|
|
|
|
|
|
], |
476
|
|
|
|
|
|
|
SDL_RenderDrawPointF => [ [ 'SDL_Renderer', 'float', 'float' ], 'int' ], |
477
|
|
|
|
|
|
|
SDL_RenderDrawPointsF => [ |
478
|
|
|
|
|
|
|
[ 'SDL_Renderer', 'SDL2x_FPointList', 'int' ], |
479
|
|
|
|
|
|
|
'int' => sub ( $inner, $renderer, @points ) { |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
# XXX - This is a workaround for FFI::C::Array not being able to accept a list of objects |
482
|
|
|
|
|
|
|
# XXX - I can rethink this map when https://github.com/PerlFFI/FFI-C/issues/53 is resolved |
483
|
|
|
|
|
|
|
$inner->( |
484
|
|
|
|
|
|
|
$renderer, |
485
|
|
|
|
|
|
|
SDL2x::PointFList->new( |
486
|
|
|
|
|
|
|
[ map { ref $_ eq 'HASH' ? $_ : { x => $_->x, y => $_->y } } @points ] |
487
|
|
|
|
|
|
|
), |
488
|
|
|
|
|
|
|
scalar @points |
489
|
|
|
|
|
|
|
); |
490
|
|
|
|
|
|
|
} |
491
|
|
|
|
|
|
|
], |
492
|
|
|
|
|
|
|
SDL_RenderDrawLineF => [ [ 'SDL_Renderer', 'float', 'float', 'float', 'float' ], 'int' ], |
493
|
|
|
|
|
|
|
SDL_RenderDrawLinesF => [ |
494
|
|
|
|
|
|
|
[ 'SDL_Renderer', 'SDL2x_FPointList', 'int' ], |
495
|
|
|
|
|
|
|
'int' => sub ( $inner, $renderer, @points ) { |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
# XXX - This is a workaround for FFI::C::Array not being able to accept a list of objects |
498
|
|
|
|
|
|
|
# XXX - I can rethink this map when https://github.com/PerlFFI/FFI-C/issues/53 is resolved |
499
|
|
|
|
|
|
|
$inner->( |
500
|
|
|
|
|
|
|
$renderer, |
501
|
|
|
|
|
|
|
SDL2x::FPointList->new( |
502
|
|
|
|
|
|
|
[ map { ref $_ eq 'HASH' ? $_ : { x => $_->x, y => $_->y } } @points ] |
503
|
|
|
|
|
|
|
), |
504
|
|
|
|
|
|
|
scalar @points |
505
|
|
|
|
|
|
|
); |
506
|
|
|
|
|
|
|
} |
507
|
|
|
|
|
|
|
], |
508
|
|
|
|
|
|
|
SDL_RenderDrawRectF => [ |
509
|
|
|
|
|
|
|
[ 'SDL_Renderer', 'SDL2x_FRectList', 'int' ], |
510
|
|
|
|
|
|
|
'int' => sub ( $inner, $renderer, @rects ) { |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
# XXX - This is a workaround for FFI::C::Array not being able to accept a list of objects |
513
|
|
|
|
|
|
|
# XXX - I can rethink this map when https://github.com/PerlFFI/FFI-C/issues/53 is resolved |
514
|
|
|
|
|
|
|
$inner->( |
515
|
|
|
|
|
|
|
$renderer, |
516
|
|
|
|
|
|
|
SDL2x::FRectList->new( |
517
|
|
|
|
|
|
|
[ map { |
518
|
|
|
|
|
|
|
ref $_ eq 'HASH' ? $_ : |
519
|
|
|
|
|
|
|
{ x => $_->x, y => $_->y, w => $_->w, h => $_->h } |
520
|
|
|
|
|
|
|
} @rects |
521
|
|
|
|
|
|
|
] |
522
|
|
|
|
|
|
|
), |
523
|
|
|
|
|
|
|
scalar @rects |
524
|
|
|
|
|
|
|
); |
525
|
|
|
|
|
|
|
} |
526
|
|
|
|
|
|
|
], |
527
|
|
|
|
|
|
|
SDL_RenderDrawRectsF => [ |
528
|
|
|
|
|
|
|
[ 'SDL_Renderer', 'SDL2x_FRectList', 'int' ], |
529
|
|
|
|
|
|
|
'int' => sub ( $inner, $renderer, @rects ) { |
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
# XXX - This is a workaround for FFI::C::Array not being able to accept a list of objects |
532
|
|
|
|
|
|
|
# XXX - I can rethink this map when https://github.com/PerlFFI/FFI-C/issues/53 is resolved |
533
|
|
|
|
|
|
|
$inner->( |
534
|
|
|
|
|
|
|
$renderer, |
535
|
|
|
|
|
|
|
SDL2x::FRectList->new( |
536
|
|
|
|
|
|
|
[ map { |
537
|
|
|
|
|
|
|
ref $_ eq 'HASH' ? $_ : |
538
|
|
|
|
|
|
|
{ x => $_->x, y => $_->y, w => $_->w, h => $_->h } |
539
|
|
|
|
|
|
|
} @rects |
540
|
|
|
|
|
|
|
] |
541
|
|
|
|
|
|
|
), |
542
|
|
|
|
|
|
|
scalar @rects |
543
|
|
|
|
|
|
|
); |
544
|
|
|
|
|
|
|
} |
545
|
|
|
|
|
|
|
], |
546
|
|
|
|
|
|
|
SDL_RenderFillRectsF => [ |
547
|
|
|
|
|
|
|
[ 'SDL_Renderer', 'SDL2x_FRectList', 'int' ], |
548
|
|
|
|
|
|
|
'int' => sub ( $inner, $renderer, @rects ) { |
549
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
# XXX - This is a workaround for FFI::C::Array not being able to accept a list of objects |
551
|
|
|
|
|
|
|
# XXX - I can rethink this map when https://github.com/PerlFFI/FFI-C/issues/53 is resolved |
552
|
|
|
|
|
|
|
$inner->( |
553
|
|
|
|
|
|
|
$renderer, |
554
|
|
|
|
|
|
|
SDL2x::FRectList->new( |
555
|
|
|
|
|
|
|
[ map { |
556
|
|
|
|
|
|
|
ref $_ eq 'HASH' ? $_ : |
557
|
|
|
|
|
|
|
{ x => $_->x, y => $_->y, w => $_->w, h => $_->h } |
558
|
|
|
|
|
|
|
} @rects |
559
|
|
|
|
|
|
|
] |
560
|
|
|
|
|
|
|
), |
561
|
|
|
|
|
|
|
scalar @rects |
562
|
|
|
|
|
|
|
); |
563
|
|
|
|
|
|
|
} |
564
|
|
|
|
|
|
|
], |
565
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
# XXX - I do not have an example for this function in docs |
567
|
|
|
|
|
|
|
SDL_RenderCopyF => [ [ 'SDL_Renderer', 'SDL_Texture', 'SDL_Rect', 'SDL_FRect' ], 'int' ], |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
# XXX - I do not have an example for this function in docs |
570
|
|
|
|
|
|
|
SDL_RenderCopyExF => [ |
571
|
|
|
|
|
|
|
[ 'SDL_Renderer', 'SDL_Texture', 'SDL_Rect', 'SDL_FRect', |
572
|
|
|
|
|
|
|
'double', 'SDL_FPoint', 'SDL_RendererFlip' |
573
|
|
|
|
|
|
|
], |
574
|
|
|
|
|
|
|
'int' |
575
|
|
|
|
|
|
|
], |
576
|
|
|
|
|
|
|
SDL_RenderReadPixels => |
577
|
|
|
|
|
|
|
[ [ 'SDL_Renderer', 'SDL_Rect', 'uint32', 'opaque', 'int' ], 'int' ], |
578
|
|
|
|
|
|
|
SDL_RenderPresent => [ ['SDL_Renderer'] ], |
579
|
|
|
|
|
|
|
SDL_DestroyTexture => [ ['SDL_Texture'] ], |
580
|
|
|
|
|
|
|
SDL_DestroyRenderer => [ ['SDL_Renderer'] ], |
581
|
|
|
|
|
|
|
SDL_RenderFlush => [ ['SDL_Renderer'], 'int' ], |
582
|
|
|
|
|
|
|
SDL_GL_BindTexture => [ [ 'SDL_Texture', 'float*', 'float*' ], 'int' ], |
583
|
|
|
|
|
|
|
SDL_GL_UnbindTexture => [ ['SDL_Texture'], 'int' ], |
584
|
|
|
|
|
|
|
SDL_RenderGetMetalLayer => [ ['SDL_Renderer'], 'opaque' ], |
585
|
|
|
|
|
|
|
SDL_RenderGetMetalCommandEncoder => [ ['SDL_Renderer'], 'opaque' ] |
586
|
|
|
|
|
|
|
}; |
587
|
|
|
|
|
|
|
ffi->type( '(int,opaque)->uint32' => 'SDL_TimerCallback' ); |
588
|
|
|
|
|
|
|
attach timer => { |
589
|
|
|
|
|
|
|
SDL_GetTicks => [ [], 'uint32' ], |
590
|
|
|
|
|
|
|
SDL_GetPerformanceCounter => [ [], 'uint64' ], |
591
|
|
|
|
|
|
|
SDL_GetPerformanceFrequency => [ [], 'uint64' ], |
592
|
|
|
|
|
|
|
SDL_Delay => [ ['uint32'] ], |
593
|
|
|
|
|
|
|
SDL_AddTimer => [ |
594
|
|
|
|
|
|
|
[ 'uint32', 'SDL_TimerCallback', 'opaque' ], |
595
|
|
|
|
|
|
|
'int' => sub ( $xsub, $interval, $callback, $param = () ) { |
596
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
# Fake void pointer |
598
|
|
|
|
|
|
|
my $cb = FFI::Platypus::Closure->new( sub { $callback->(@_); } ); |
599
|
|
|
|
|
|
|
$cb->sticky; |
600
|
|
|
|
|
|
|
$xsub->( $interval, $cb, $param ); |
601
|
|
|
|
|
|
|
} |
602
|
|
|
|
|
|
|
], |
603
|
|
|
|
|
|
|
SDL_RemoveTimer => [ ['uint32'] => 'bool' ], |
604
|
|
|
|
|
|
|
}; |
605
|
|
|
|
|
|
|
ffi->type( '(opaque,string,int)->void' => 'SDL_AudioCallback' ); |
606
|
|
|
|
|
|
|
ffi->type( 'int' => 'SDL_AudioFormat' ); |
607
|
|
|
|
|
|
|
ffi->type( '(opaque,uint16)->void' => 'SDL_AudioFilter' ); |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
package SDL2::AudioStream { |
610
|
2
|
|
|
2
|
|
5336
|
use SDL2::Utils; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
12
|
|
611
|
|
|
|
|
|
|
has(); |
612
|
|
|
|
|
|
|
}; |
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
package SDL2::AudioDeviceID { |
615
|
2
|
|
|
2
|
|
1165
|
use SDL2::Utils; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
11
|
|
616
|
|
|
|
|
|
|
has(); |
617
|
|
|
|
|
|
|
}; |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
package SDL2::RWops { # TODO: https://github.com/libsdl-org/SDL/blob/main/include/SDL_rwops.h |
620
|
2
|
|
|
2
|
|
1110
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
24
|
|
621
|
|
|
|
|
|
|
has(); |
622
|
|
|
|
|
|
|
}; |
623
|
|
|
|
|
|
|
define audio => [ [ SDL_AUDIOCVT_MAX_FILTERS => 9 ], ]; |
624
|
|
|
|
|
|
|
attach audio => { |
625
|
|
|
|
|
|
|
SDL_AudioInit => [ ["string"], "int" ], |
626
|
|
|
|
|
|
|
SDL_AudioQuit => [ [] ], |
627
|
|
|
|
|
|
|
SDL_AudioStreamAvailable => [ ["SDL_AudioStream"], "int" ], |
628
|
|
|
|
|
|
|
SDL_AudioStreamClear => [ ["SDL_AudioStream"] ], |
629
|
|
|
|
|
|
|
SDL_AudioStreamFlush => [ ["SDL_AudioStream"], "int" ], |
630
|
|
|
|
|
|
|
SDL_AudioStreamGet => [ [ "SDL_AudioStream", "opaque*", "int" ], "int" ], |
631
|
|
|
|
|
|
|
SDL_AudioStreamPut => [ [ "SDL_AudioStream", "opaque*", "int" ], "int" ], |
632
|
|
|
|
|
|
|
SDL_BuildAudioCVT => [ |
633
|
|
|
|
|
|
|
[ "SDL_AudioCVT", "SDL_AudioFormat", "uint8", "int", |
634
|
|
|
|
|
|
|
"SDL_AudioFormat", "uint8", "int", |
635
|
|
|
|
|
|
|
], |
636
|
|
|
|
|
|
|
"int", |
637
|
|
|
|
|
|
|
], |
638
|
|
|
|
|
|
|
SDL_ClearQueuedAudio => [ ["SDL_AudioDeviceID"] ], |
639
|
|
|
|
|
|
|
SDL_CloseAudio => [ [] ], |
640
|
|
|
|
|
|
|
SDL_CloseAudioDevice => [ ["SDL_AudioDeviceID"] ], |
641
|
|
|
|
|
|
|
SDL_ConvertAudio => [ ["SDL_AudioCVT"], "int" ], |
642
|
|
|
|
|
|
|
SDL_DequeueAudio => [ [ "SDL_AudioDeviceID", "opaque*", "uint32" ], "uint32" ], |
643
|
|
|
|
|
|
|
SDL_FreeAudioStream => [ ["SDL_AudioStream"] ], |
644
|
|
|
|
|
|
|
SDL_FreeWAV => [ ["uint8 *"] ], |
645
|
|
|
|
|
|
|
SDL_GetAudioDeviceName => [ [ "int", "int" ], "string" ], ( |
646
|
|
|
|
|
|
|
$ver->patch >= 15 ? |
647
|
|
|
|
|
|
|
( SDL_GetAudioDeviceSpec => [ [ "int", "int", "SDL_AudioSpec" ], "int" ] ) : |
648
|
|
|
|
|
|
|
() |
649
|
|
|
|
|
|
|
), |
650
|
|
|
|
|
|
|
SDL_GetAudioDeviceStatus => [ ["SDL_AudioDeviceID"], "SDL_AudioStatus" ], |
651
|
|
|
|
|
|
|
SDL_GetAudioDriver => [ ["int"], "string" ], |
652
|
|
|
|
|
|
|
SDL_GetAudioStatus => [ [], "SDL_AudioStatus" ], |
653
|
|
|
|
|
|
|
SDL_GetCurrentAudioDriver => [ [], "string" ], |
654
|
|
|
|
|
|
|
SDL_GetNumAudioDevices => [ ["int"], "int" ], |
655
|
|
|
|
|
|
|
SDL_GetNumAudioDrivers => [ [], "int" ], |
656
|
|
|
|
|
|
|
SDL_GetQueuedAudioSize => [ ["SDL_AudioDeviceID"], "uint32" ], |
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
#SDL_LoadWAV_RW => [ |
659
|
|
|
|
|
|
|
# ["SDL_RWops", "int", "SDL_AudioSpec", "uint8**", "uint32 *"], |
660
|
|
|
|
|
|
|
# "SDL_AudioSpec", |
661
|
|
|
|
|
|
|
# ], |
662
|
|
|
|
|
|
|
SDL_LockAudio => [ [] ], |
663
|
|
|
|
|
|
|
SDL_LockAudioDevice => [ ["SDL_AudioDeviceID"] ], |
664
|
|
|
|
|
|
|
SDL_MixAudio => [ [ "uint8 *", "uint8 *", "uint32", "int" ] ], |
665
|
|
|
|
|
|
|
SDL_MixAudioFormat => [ [ "uint8 *", "uint8 *", "SDL_AudioFormat", "uint32", "int" ] ], |
666
|
|
|
|
|
|
|
SDL_NewAudioStream => [ |
667
|
|
|
|
|
|
|
[ "SDL_AudioFormat", "uint8", "int", "SDL_AudioFormat", "uint8", "int", ], |
668
|
|
|
|
|
|
|
"SDL_AudioStream", |
669
|
|
|
|
|
|
|
], |
670
|
|
|
|
|
|
|
SDL_OpenAudio => [ |
671
|
|
|
|
|
|
|
[ 'SDL_AudioSpec', 'SDL_AudioSpec' ], |
672
|
|
|
|
|
|
|
'int' => sub ( $inner, $desired, $obtained = () ) { |
673
|
|
|
|
|
|
|
deprecate <<'END'; |
674
|
|
|
|
|
|
|
SDL_OpenAudio( ... ) remains for compatibility with SDL 1.2. The new, more |
675
|
|
|
|
|
|
|
powerful, and preferred way to do this is SDL_OpenAudioDevice( ... ); |
676
|
|
|
|
|
|
|
END |
677
|
|
|
|
|
|
|
$inner->( $desired, $obtained ); |
678
|
|
|
|
|
|
|
} |
679
|
|
|
|
|
|
|
], |
680
|
|
|
|
|
|
|
SDL_OpenAudioDevice => |
681
|
|
|
|
|
|
|
[ [ "string", "int", "SDL_AudioSpec", "SDL_AudioSpec", "int" ], "SDL_AudioDeviceID", ], |
682
|
|
|
|
|
|
|
SDL_PauseAudio => [ ["int"] ], |
683
|
|
|
|
|
|
|
SDL_PauseAudioDevice => [ [ "SDL_AudioDeviceID", "int" ] ], |
684
|
|
|
|
|
|
|
SDL_QueueAudio => [ [ "SDL_AudioDeviceID", "opaque*", "uint32" ], "int" ], |
685
|
|
|
|
|
|
|
SDL_UnlockAudio => [ [] ], |
686
|
|
|
|
|
|
|
SDL_UnlockAudioDevice => [ ["SDL_AudioDeviceID"] ], |
687
|
|
|
|
|
|
|
}; |
688
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
# Everything below this line will be rewritten!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
690
|
|
|
|
|
|
|
# |
691
|
|
|
|
|
|
|
#https://github.com/libsdl-org/SDL/blob/main/include/SDL_surface.h#L327 |
692
|
|
|
|
|
|
|
push @{ $EXPORT_TAGS{'surface'} }, 'SDL_LoadBMP'; |
693
|
|
|
|
|
|
|
attach surface => { SDL_LoadBMP_RW => [ [ 'SDL_RWops', 'int' ], 'SDL_Surface' ], }; |
694
|
0
|
|
|
0
|
0
|
|
sub SDL_LoadBMP ($file) { SDL_LoadBMP_RW( SDL_RWFromFile( $file, "rb" ), 1 ) } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
695
|
|
|
|
|
|
|
push @{ $EXPORT_TAGS{'surface'} }, 'SDL_FreeSurface'; |
696
|
|
|
|
|
|
|
ffi->attach( SDL_FreeSurface => ['SDL_Surface'] ); |
697
|
|
|
|
|
|
|
ffi->attach( SDL_SaveBMP_RW => [ 'SDL_Surface', 'SDL_RWops', 'int' ], 'int' ); |
698
|
|
|
|
|
|
|
attach future => { |
699
|
|
|
|
|
|
|
SDL_ComposeCustomBlendMode => [ |
700
|
|
|
|
|
|
|
[ 'SDL_BlendFactor', 'SDL_BlendFactor', |
701
|
|
|
|
|
|
|
'SDL_BlendOperation', 'SDL_BlendFactor', |
702
|
|
|
|
|
|
|
'SDL_BlendFactor', 'SDL_BlendOperation' |
703
|
|
|
|
|
|
|
], |
704
|
|
|
|
|
|
|
'SDL_BlendMode' |
705
|
|
|
|
|
|
|
], |
706
|
|
|
|
|
|
|
}; |
707
|
|
|
|
|
|
|
ffi->attach( SDL_RWFromFile => [ 'string', 'string' ], 'SDL_RWops' ); |
708
|
|
|
|
|
|
|
|
709
|
0
|
|
|
0
|
0
|
|
sub SDL_SaveBMP ( $surface, $file ) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
710
|
0
|
|
|
|
|
|
SDL_SaveBMP_RW( $surface, SDL_RWFromFile( $file, 'wb' ), 1 ); |
711
|
|
|
|
|
|
|
} |
712
|
|
|
|
|
|
|
ffi->attach( SDL_GetPlatform => [] => 'string' ); |
713
|
|
|
|
|
|
|
ffi->attach( SDL_CreateRGBSurface => |
714
|
|
|
|
|
|
|
[ 'uint32', 'int', 'int', 'int', 'uint32', 'uint32', 'uint32', 'uint32' ] => |
715
|
|
|
|
|
|
|
'SDL_Surface' ); |
716
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
# https://wiki.libsdl.org/CategoryCPU |
718
|
|
|
|
|
|
|
ffi->attach( SDL_GetCPUCacheLineSize => [] => 'int' ); |
719
|
|
|
|
|
|
|
ffi->attach( SDL_GetCPUCount => [] => 'int' ); |
720
|
|
|
|
|
|
|
ffi->attach( SDL_GetSystemRAM => [] => 'int' ); |
721
|
|
|
|
|
|
|
ffi->attach( SDL_Has3DNow => [] => 'bool' ); |
722
|
|
|
|
|
|
|
ffi->attach( SDL_HasAVX => [] => 'bool' ); |
723
|
|
|
|
|
|
|
ffi->attach( SDL_HasAVX2 => [] => 'bool' ); |
724
|
|
|
|
|
|
|
ffi->attach( SDL_HasAltiVec => [] => 'bool' ); |
725
|
|
|
|
|
|
|
ffi->attach( SDL_HasMMX => [] => 'bool' ); |
726
|
|
|
|
|
|
|
ffi->attach( SDL_HasRDTSC => [] => 'bool' ); |
727
|
|
|
|
|
|
|
ffi->attach( SDL_HasSSE => [] => 'bool' ); |
728
|
|
|
|
|
|
|
ffi->attach( SDL_HasSSE2 => [] => 'bool' ); |
729
|
|
|
|
|
|
|
ffi->attach( SDL_HasSSE3 => [] => 'bool' ); |
730
|
|
|
|
|
|
|
ffi->attach( SDL_HasSSE41 => [] => 'bool' ); |
731
|
|
|
|
|
|
|
ffi->attach( SDL_HasSSE42 => [] => 'bool' ); |
732
|
|
|
|
|
|
|
ffi->attach( SDL_GetPowerInfo => [ 'int*', 'int*' ] => 'int' ); |
733
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
# https://wiki.libsdl.org/CategoryStandard |
735
|
|
|
|
|
|
|
ffi->attach( SDL_acos => ['double'] => 'double' ); |
736
|
|
|
|
|
|
|
ffi->attach( SDL_asin => ['double'] => 'double' ); # Not in wiki |
737
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
# https://wiki.libsdl.org/CategoryVideo |
739
|
|
|
|
|
|
|
# Macros defined in SDL_video.h |
740
|
0
|
|
|
|
|
|
define video => [ |
741
|
|
|
|
|
|
|
[ SDL_WINDOWPOS_UNDEFINED_MASK => 0x1FFF0000 ], |
742
|
|
|
|
|
|
|
[ SDL_WINDOWPOS_UNDEFINED_DISPLAY => |
743
|
0
|
|
|
0
|
|
|
sub ($X) { ( SDL_WINDOWPOS_UNDEFINED_MASK() | ($X) ) } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
744
|
0
|
|
|
0
|
|
|
], |
745
|
0
|
|
|
|
|
|
[ SDL_WINDOWPOS_UNDEFINED => sub () { SDL_WINDOWPOS_UNDEFINED_DISPLAY(0) } ], |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
[ SDL_WINDOWPOS_ISUNDEFINED => |
747
|
0
|
|
|
0
|
|
|
sub ($X) { ( ( ($X) & 0xFFFF0000 ) == SDL_WINDOWPOS_UNDEFINED_MASK() ) } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
748
|
0
|
|
|
0
|
|
|
], |
749
|
|
|
|
|
|
|
# |
750
|
0
|
|
|
|
|
|
[ SDL_WINDOWPOS_CENTERED_MASK => sub () {0x2FFF0000} ], |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
751
|
0
|
|
|
0
|
|
|
[ SDL_WINDOWPOS_CENTERED_DISPLAY => sub ($X) { ( SDL_WINDOWPOS_CENTERED_MASK() | ($X) ) } ], |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
752
|
0
|
|
|
|
|
|
[ SDL_WINDOWPOS_CENTERED => sub() { SDL_WINDOWPOS_CENTERED_DISPLAY(0) } ], |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
753
|
|
|
|
|
|
|
[ SDL_WINDOWPOS_ISCENTERED => |
754
|
0
|
|
|
0
|
|
|
sub ($X) { ( ( ($X) & 0xFFFF0000 ) == SDL_WINDOWPOS_CENTERED_MASK() ) } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
755
|
|
|
|
|
|
|
], |
756
|
|
|
|
|
|
|
]; |
757
|
|
|
|
|
|
|
attach future => { |
758
|
|
|
|
|
|
|
SDL_FillRect => [ [ 'SDL_Surface', 'opaque', 'uint32' ], 'int' ], |
759
|
|
|
|
|
|
|
SDL_MapRGB => [ |
760
|
|
|
|
|
|
|
[ 'SDL_PixelFormat', 'uint8', 'uint8', 'uint8' ] => 'uint32' => |
761
|
|
|
|
|
|
|
sub ( $inner, $format, $r, $g, $b ) { |
762
|
|
|
|
|
|
|
$format = ffi->cast( 'opaque', 'SDL_PixelFormat', $format ) if !ref $format; |
763
|
|
|
|
|
|
|
$inner->( $format, $r, $g, $b ); |
764
|
|
|
|
|
|
|
} |
765
|
|
|
|
|
|
|
] |
766
|
|
|
|
|
|
|
}; |
767
|
|
|
|
|
|
|
ffi->type( '(opaque, opaque)->int' => 'SDL_EventFilter' ); |
768
|
|
|
|
|
|
|
attach events => { |
769
|
|
|
|
|
|
|
SDL_PeepEvents => |
770
|
|
|
|
|
|
|
[ [ 'SDL_Event', 'int', 'SDL_EventAction', 'uint32', 'uint32' ] => 'int' ], |
771
|
|
|
|
|
|
|
SDL_HasEvent => [ ['uint32'] => 'bool' ], |
772
|
|
|
|
|
|
|
SDL_HasEvents => [ [ 'uint32', 'uint32' ] => 'bool' ], |
773
|
|
|
|
|
|
|
SDL_FlushEvent => [ ['uint32'] ], |
774
|
|
|
|
|
|
|
SDL_FlushEvents => [ [ 'uint32', 'uint32' ] ], |
775
|
|
|
|
|
|
|
SDL_PollEvent => [ ['SDL_Event'] => 'int' ], |
776
|
|
|
|
|
|
|
SDL_WaitEvent => [ ['SDL_Event'] => 'int' ], |
777
|
|
|
|
|
|
|
SDL_WaitEventTimeout => [ [ 'SDL_Event', 'int' ] => 'int' ], |
778
|
|
|
|
|
|
|
SDL_PushEvent => [ ['SDL_Event'] => 'int' ], |
779
|
|
|
|
|
|
|
SDL_SetEventFilter => [ [ 'SDL_EventFilter', 'opaque' ] ], |
780
|
|
|
|
|
|
|
SDL_GetEventFilter => [ [ 'SDL_EventFilter', 'opaque' ] => 'bool' ], |
781
|
|
|
|
|
|
|
SDL_AddEventWatch => [ [ 'SDL_EventFilter', 'opaque' ] ], |
782
|
|
|
|
|
|
|
SDL_DelEventWatch => [ [ 'SDL_EventFilter', 'opaque' ] ], |
783
|
|
|
|
|
|
|
SDL_FilterEvents => [ [ 'SDL_EventFilter', 'opaque' ] ] |
784
|
|
|
|
|
|
|
}; |
785
|
|
|
|
|
|
|
# |
786
|
|
|
|
|
|
|
# |
787
|
|
|
|
|
|
|
ffi->attach( SDL_EventState => [ 'uint32', 'int' ] => 'uint8' ); |
788
|
0
|
|
|
0
|
0
|
|
sub SDL_GetEventState ($type) { SDL_EventState( $type, SDL_QUERY ) } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
789
|
|
|
|
|
|
|
ffi->attach( SDL_RegisterEvents => ['int'] => 'uint32' ); |
790
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
# From src/events/SDL_mouse_c.h |
792
|
|
|
|
|
|
|
package SDL2::Cursor { |
793
|
2
|
|
|
2
|
|
3305
|
use SDL2::Utils; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
11
|
|
794
|
|
|
|
|
|
|
has |
795
|
|
|
|
|
|
|
next => 'opaque', # SDL_Cursor |
796
|
|
|
|
|
|
|
driverdata => 'opaque' # void |
797
|
|
|
|
|
|
|
}; |
798
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
# From SDL_mouse.h |
800
|
|
|
|
|
|
|
ffi->attach( SDL_GetMouseFocus => [] => 'SDL_Window' ); |
801
|
|
|
|
|
|
|
ffi->attach( SDL_GetMouseState => [ 'int', 'int' ] => 'uint32' ); |
802
|
|
|
|
|
|
|
ffi->attach( SDL_GetGlobalMouseState => [ 'int', 'int' ] => 'uint32' ); |
803
|
|
|
|
|
|
|
ffi->attach( SDL_GetRelativeMouseState => [ 'int', 'int' ] => 'uint32' ); |
804
|
|
|
|
|
|
|
ffi->attach( SDL_WarpMouseInWindow => [ 'SDL_Window', 'int', 'int' ] ); |
805
|
|
|
|
|
|
|
ffi->attach( SDL_SetRelativeMouseMode => ['bool'] => 'int' ); |
806
|
|
|
|
|
|
|
ffi->attach( SDL_CaptureMouse => ['bool'] => 'int' ); |
807
|
|
|
|
|
|
|
ffi->attach( SDL_GetRelativeMouseMode => [] => 'bool' ); |
808
|
|
|
|
|
|
|
ffi->attach( |
809
|
|
|
|
|
|
|
SDL_CreateCursor => [ 'uint8', 'uint8', 'int', 'int', 'int', 'int' ] => 'SDL_Cursor' ); |
810
|
|
|
|
|
|
|
ffi->attach( SDL_CreateSystemCursor => ['SDL_SystemCursor'] => 'SDL_Cursor' ); |
811
|
|
|
|
|
|
|
ffi->attach( SDL_SetCursor => ['SDL_Cursor'] ); |
812
|
|
|
|
|
|
|
ffi->attach( SDL_GetCursor => [] => 'SDL_Cursor' ); |
813
|
|
|
|
|
|
|
ffi->attach( SDL_GetDefaultCursor => [] => 'SDL_Cursor' ); |
814
|
|
|
|
|
|
|
ffi->attach( SDL_FreeCursor => [] => 'SDL_Cursor' ); |
815
|
|
|
|
|
|
|
ffi->attach( SDL_ShowCursor => ['int'] => 'int' ); |
816
|
|
|
|
|
|
|
# |
817
|
|
|
|
|
|
|
# XXX - From SDL_stding.h |
818
|
|
|
|
|
|
|
# Define a four character code as a Uint32 |
819
|
0
|
|
|
0
|
0
|
|
sub SDL_FOURCC ( $A, $B, $C, $D ) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
820
|
0
|
|
|
|
|
|
( $A << 0 ) | ( $B << 8 ) | ( $C << 16 ) | ( $D << 24 ); |
821
|
|
|
|
|
|
|
} |
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
# Unsorted - https://github.com/libsdl-org/SDL/blob/c59d4dcd38c382a1e9b69b053756f1139a861574/include/SDL_keycode.h |
824
|
|
|
|
|
|
|
# https://github.com/libsdl-org/SDL/blob/c59d4dcd38c382a1e9b69b053756f1139a861574/include/SDL_scancode.h#L151 |
825
|
|
|
|
|
|
|
attach( |
826
|
|
|
|
|
|
|
all => { |
827
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
# Unknown... |
829
|
|
|
|
|
|
|
SDL_SetMainReady => [ [] => 'void' ] |
830
|
|
|
|
|
|
|
} |
831
|
|
|
|
|
|
|
); |
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
# TODO |
834
|
|
|
|
|
|
|
package SDL2::assert_data { |
835
|
2
|
|
|
2
|
|
1550
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
27
|
|
836
|
|
|
|
|
|
|
has; |
837
|
|
|
|
|
|
|
}; |
838
|
|
|
|
|
|
|
|
839
|
|
|
|
|
|
|
package SDL2::atomic_t { |
840
|
2
|
|
|
2
|
|
1028
|
use SDL2::Utils; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
8
|
|
841
|
|
|
|
|
|
|
has value => 'int'; |
842
|
|
|
|
|
|
|
}; |
843
|
|
|
|
|
|
|
|
844
|
|
|
|
|
|
|
package SDL2::Finger { |
845
|
2
|
|
|
2
|
|
1017
|
use SDL2::Utils; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
7
|
|
846
|
|
|
|
|
|
|
ffi->type( 'sint64' => 'SDL_TouchID' ); |
847
|
|
|
|
|
|
|
ffi->type( 'sint64' => 'SDL_FingerID' ); |
848
|
|
|
|
|
|
|
has |
849
|
|
|
|
|
|
|
id => 'SDL_FingerID', |
850
|
|
|
|
|
|
|
x => 'float', |
851
|
|
|
|
|
|
|
y => 'float', |
852
|
|
|
|
|
|
|
pressure => 'float'; |
853
|
|
|
|
|
|
|
}; |
854
|
|
|
|
|
|
|
|
855
|
|
|
|
|
|
|
package SDL2::_GameController { |
856
|
2
|
|
|
2
|
|
1300
|
use SDL2::Utils; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
8
|
|
857
|
|
|
|
|
|
|
has; |
858
|
|
|
|
|
|
|
}; |
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
package SDL2::GameCrontroller { |
861
|
2
|
|
|
2
|
|
993
|
use SDL2::Utils; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
56
|
|
862
|
|
|
|
|
|
|
has; |
863
|
|
|
|
|
|
|
}; |
864
|
|
|
|
|
|
|
|
865
|
|
|
|
|
|
|
package SDL2::_Haptic { |
866
|
2
|
|
|
2
|
|
1039
|
use SDL2::Utils; |
|
2
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
12
|
|
867
|
|
|
|
|
|
|
has; |
868
|
|
|
|
|
|
|
}; |
869
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
package SDL2::Haptic { |
871
|
2
|
|
|
2
|
|
983
|
use SDL2::Utils; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
7
|
|
872
|
|
|
|
|
|
|
has; |
873
|
|
|
|
|
|
|
}; |
874
|
|
|
|
|
|
|
|
875
|
|
|
|
|
|
|
package SDL2::JoystickID { |
876
|
2
|
|
|
2
|
|
1009
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
8
|
|
877
|
|
|
|
|
|
|
has; |
878
|
|
|
|
|
|
|
}; |
879
|
|
|
|
|
|
|
|
880
|
|
|
|
|
|
|
package SDL2::_JoyStick { |
881
|
2
|
|
|
2
|
|
985
|
use SDL2::Utils; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
8
|
|
882
|
|
|
|
|
|
|
has; |
883
|
|
|
|
|
|
|
}; |
884
|
|
|
|
|
|
|
attach messagebox => { |
885
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
#SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, ("R.E.L.I.V.E. " + BuildString()).c_str(), msg, nullptr); |
887
|
|
|
|
|
|
|
SDL_ShowSimpleMessageBox => [ [ 'uint32', 'string', 'string', 'SDL_Window' ], 'int' ] |
888
|
|
|
|
|
|
|
}; |
889
|
|
|
|
|
|
|
|
890
|
|
|
|
|
|
|
package SDL2::Sensor { |
891
|
2
|
|
|
2
|
|
1029
|
use SDL2::Utils; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
8
|
|
892
|
|
|
|
|
|
|
has; |
893
|
|
|
|
|
|
|
}; |
894
|
|
|
|
|
|
|
|
895
|
|
|
|
|
|
|
package SDL2::SensorID { }; # type |
896
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
package SDL2::ControllerTouchpadEvent { |
898
|
2
|
|
|
2
|
|
1118
|
use SDL2::Utils; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
9
|
|
899
|
|
|
|
|
|
|
has; |
900
|
|
|
|
|
|
|
}; |
901
|
|
|
|
|
|
|
|
902
|
|
|
|
|
|
|
package SDL2::Mixer { |
903
|
2
|
|
|
2
|
|
999
|
use SDL2::Utils; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
9
|
|
904
|
|
|
|
|
|
|
has; |
905
|
|
|
|
|
|
|
}; |
906
|
|
|
|
|
|
|
|
907
|
|
|
|
|
|
|
package SDL2::Mixer::Mix::Chunk { |
908
|
2
|
|
|
2
|
|
1068
|
use SDL2::Utils; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
9
|
|
909
|
|
|
|
|
|
|
has; |
910
|
|
|
|
|
|
|
}; |
911
|
|
|
|
|
|
|
|
912
|
|
|
|
|
|
|
package SDL2::Mixer::Mix::Fading { |
913
|
2
|
|
|
2
|
|
1055
|
use SDL2::Utils; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
10
|
|
914
|
|
|
|
|
|
|
has; |
915
|
|
|
|
|
|
|
}; |
916
|
|
|
|
|
|
|
|
917
|
|
|
|
|
|
|
package SDL2::Mixer::Mix::MusicType { |
918
|
2
|
|
|
2
|
|
1017
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
9
|
|
919
|
|
|
|
|
|
|
has; |
920
|
|
|
|
|
|
|
}; |
921
|
|
|
|
|
|
|
|
922
|
|
|
|
|
|
|
package SDL2::Mixer::Mix::Music { |
923
|
2
|
|
|
2
|
|
1070
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
8
|
|
924
|
|
|
|
|
|
|
has; |
925
|
|
|
|
|
|
|
}; |
926
|
|
|
|
|
|
|
|
927
|
|
|
|
|
|
|
package SDL2::Mixer::Chunk { |
928
|
2
|
|
|
2
|
|
999
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
9
|
|
929
|
|
|
|
|
|
|
has; |
930
|
|
|
|
|
|
|
}; |
931
|
|
|
|
|
|
|
|
932
|
|
|
|
|
|
|
package SDL2::Mixer::Fading { |
933
|
2
|
|
|
2
|
|
1009
|
use SDL2::Utils; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
9
|
|
934
|
|
|
|
|
|
|
has; |
935
|
|
|
|
|
|
|
}; |
936
|
|
|
|
|
|
|
|
937
|
|
|
|
|
|
|
package SDL2::Mixer::MusicType { |
938
|
2
|
|
|
2
|
|
1160
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
8
|
|
939
|
|
|
|
|
|
|
has; |
940
|
|
|
|
|
|
|
}; |
941
|
|
|
|
|
|
|
|
942
|
|
|
|
|
|
|
package SDL2::Mixer::Music { |
943
|
2
|
|
|
2
|
|
1056
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
8
|
|
944
|
|
|
|
|
|
|
has; |
945
|
|
|
|
|
|
|
}; |
946
|
|
|
|
|
|
|
|
947
|
|
|
|
|
|
|
package SDL2::Image { |
948
|
2
|
|
|
2
|
|
1041
|
use SDL2::Utils; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
10
|
|
949
|
|
|
|
|
|
|
has; |
950
|
|
|
|
|
|
|
}; |
951
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
package SDL2::iconv_t { |
953
|
2
|
|
|
2
|
|
1007
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
954
|
|
|
|
|
|
|
has; |
955
|
|
|
|
|
|
|
}; # int ptr |
956
|
|
|
|
|
|
|
|
957
|
|
|
|
|
|
|
package SDL2::WindowShapeMode { |
958
|
2
|
|
|
2
|
|
983
|
use SDL2::Utils; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
959
|
|
|
|
|
|
|
has; |
960
|
|
|
|
|
|
|
}; |
961
|
|
|
|
|
|
|
|
962
|
|
|
|
|
|
|
package SDL2::WindowShapeParams { |
963
|
2
|
|
|
2
|
|
995
|
use SDL2::Utils; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
10
|
|
964
|
|
|
|
|
|
|
has; |
965
|
|
|
|
|
|
|
}; # union |
966
|
|
|
|
|
|
|
|
967
|
|
|
|
|
|
|
package SDL2::TTF { |
968
|
2
|
|
|
2
|
|
1067
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
969
|
|
|
|
|
|
|
has; |
970
|
|
|
|
|
|
|
}; |
971
|
|
|
|
|
|
|
|
972
|
|
|
|
|
|
|
package SDL2::TTF::Image { |
973
|
2
|
|
|
2
|
|
1116
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
974
|
|
|
|
|
|
|
has; |
975
|
|
|
|
|
|
|
}; |
976
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
package SDL2::TTF::Font { |
978
|
2
|
|
|
2
|
|
1007
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
979
|
|
|
|
|
|
|
has; |
980
|
|
|
|
|
|
|
}; |
981
|
|
|
|
|
|
|
|
982
|
|
|
|
|
|
|
package SDL2::TTF::PosBuf { |
983
|
2
|
|
|
2
|
|
974
|
use SDL2::Utils; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
11
|
|
984
|
|
|
|
|
|
|
has; |
985
|
|
|
|
|
|
|
}; |
986
|
|
|
|
|
|
|
|
987
|
|
|
|
|
|
|
package SDL2::Net { |
988
|
2
|
|
|
2
|
|
3183
|
use SDL2::Utils; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
19
|
|
989
|
|
|
|
|
|
|
has; |
990
|
|
|
|
|
|
|
}; |
991
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
package SDL2::RTF { |
993
|
2
|
|
|
2
|
|
1027
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
7
|
|
994
|
|
|
|
|
|
|
has; |
995
|
|
|
|
|
|
|
}; |
996
|
|
|
|
|
|
|
|
997
|
|
|
|
|
|
|
package SDL2::RTF::Context { |
998
|
2
|
|
|
2
|
|
992
|
use SDL2::Utils; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
8
|
|
999
|
|
|
|
|
|
|
has; |
1000
|
|
|
|
|
|
|
}; |
1001
|
|
|
|
|
|
|
|
1002
|
|
|
|
|
|
|
package SDL2::RTF::FontEngine { |
1003
|
2
|
|
|
2
|
|
1043
|
use SDL2::Utils; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
8
|
|
1004
|
|
|
|
|
|
|
has; |
1005
|
|
|
|
|
|
|
}; |
1006
|
|
|
|
|
|
|
|
1007
|
|
|
|
|
|
|
package SDL2::Thread { |
1008
|
2
|
|
|
2
|
|
996
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
19
|
|
1009
|
|
|
|
|
|
|
has(); |
1010
|
|
|
|
|
|
|
} |
1011
|
|
|
|
|
|
|
|
1012
|
|
|
|
|
|
|
package SDL2::ShapeDriver { }; |
1013
|
|
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
package SDL2::VideoDisplay { |
1015
|
2
|
|
|
2
|
|
1088
|
use SDL2::Utils; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
6
|
|
1016
|
|
|
|
|
|
|
has name => 'opaque', # string |
1017
|
|
|
|
|
|
|
max_display_modes => 'int', |
1018
|
|
|
|
|
|
|
num_display_modes => 'int', |
1019
|
|
|
|
|
|
|
display_modes => 'opaque', # SDL_DisplayMode |
1020
|
|
|
|
|
|
|
desktop_mode => 'opaque', # SDL_DisplayMode |
1021
|
|
|
|
|
|
|
orientation => 'opaque', # SDL_DisplayOrientation |
1022
|
|
|
|
|
|
|
fullscreen_window => 'opaque', # SDL_Window |
1023
|
|
|
|
|
|
|
device => 'opaque', # SDL_VideoDevice |
1024
|
|
|
|
|
|
|
driverdata => 'opaque'; # void * |
1025
|
|
|
|
|
|
|
}; |
1026
|
|
|
|
|
|
|
|
1027
|
|
|
|
|
|
|
package SDL2::VideoDevice { |
1028
|
2
|
|
|
2
|
|
1141
|
use SDL2::Utils; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
1029
|
|
|
|
|
|
|
has; |
1030
|
|
|
|
|
|
|
}; |
1031
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
package SDL2::WindowUserData { |
1033
|
2
|
|
|
2
|
|
998
|
use SDL2::Utils; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
9
|
|
1034
|
|
|
|
|
|
|
has name => 'opaque', # string |
1035
|
|
|
|
|
|
|
data => 'opaque', # void * |
1036
|
|
|
|
|
|
|
next => 'opaque'; # SDL_WindowUserData |
1037
|
|
|
|
|
|
|
}; |
1038
|
|
|
|
|
|
|
|
1039
|
|
|
|
|
|
|
package SDL2::SysWMinfo { |
1040
|
2
|
|
|
2
|
|
1123
|
use SDL2::Utils; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
9
|
|
1041
|
|
|
|
|
|
|
has; |
1042
|
|
|
|
|
|
|
}; |
1043
|
|
|
|
|
|
|
|
1044
|
|
|
|
|
|
|
package SDL2::VideoBootStrap { |
1045
|
2
|
|
|
2
|
|
1025
|
use SDL2::Utils; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
9
|
|
1046
|
|
|
|
|
|
|
has; |
1047
|
|
|
|
|
|
|
}; |
1048
|
|
|
|
|
|
|
|
1049
|
|
|
|
|
|
|
package SDL2::SpinLock { |
1050
|
2
|
|
|
2
|
|
1422
|
use SDL2::Utils; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
9
|
|
1051
|
|
|
|
|
|
|
has; |
1052
|
|
|
|
|
|
|
}; |
1053
|
|
|
|
|
|
|
|
1054
|
|
|
|
|
|
|
package SDL2::AtomicLock { |
1055
|
2
|
|
|
2
|
|
991
|
use SDL2::Utils; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
7
|
|
1056
|
|
|
|
|
|
|
has; |
1057
|
|
|
|
|
|
|
}; |
1058
|
|
|
|
|
|
|
|
1059
|
|
|
|
|
|
|
#warn SDL2::SDLK_UP(); |
1060
|
|
|
|
|
|
|
#warn SDL2::SDLK_DOWN(); |
1061
|
|
|
|
|
|
|
# https://github.com/libsdl-org/SDL/blob/main/include/SDL_hints.h |
1062
|
|
|
|
|
|
|
# Export symbols! |
1063
|
|
|
|
|
|
|
our @EXPORT_OK = map {@$_} values %EXPORT_TAGS; |
1064
|
|
|
|
|
|
|
|
1065
|
|
|
|
|
|
|
#$EXPORT_TAGS{default} = []; # Export nothing by default |
1066
|
|
|
|
|
|
|
$EXPORT_TAGS{all} = \@EXPORT_OK; # Export everything with :all tag |
1067
|
|
|
|
|
|
|
|
1068
|
|
|
|
|
|
|
#use Data::Dump; |
1069
|
|
|
|
|
|
|
#ddx \%EXPORT_TAGS; |
1070
|
|
|
|
|
|
|
#ddx \%SDL2::; |
1071
|
|
|
|
|
|
|
# plan for the future |
1072
|
|
|
|
|
|
|
package SDL3 { }; |
1073
|
|
|
|
|
|
|
}; |
1074
|
|
|
|
|
|
|
1; |
1075
|
|
|
|
|
|
|
|
1076
|
|
|
|
|
|
|
=encoding utf-8 |
1077
|
|
|
|
|
|
|
|
1078
|
|
|
|
|
|
|
=head1 NAME |
1079
|
|
|
|
|
|
|
|
1080
|
|
|
|
|
|
|
SDL2::FFI - FFI Wrapper for SDL (Simple DirectMedia Layer) Development Library |
1081
|
|
|
|
|
|
|
|
1082
|
|
|
|
|
|
|
=head1 SYNOPSIS |
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
use SDL2::FFI qw[:all]; |
1085
|
|
|
|
|
|
|
die 'Error initializing SDL: ' . SDL_GetError() unless SDL_Init(SDL_INIT_VIDEO) == 0; |
1086
|
|
|
|
|
|
|
my $win = SDL_CreateWindow( 'Example window!', |
1087
|
|
|
|
|
|
|
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE ); |
1088
|
|
|
|
|
|
|
die 'Could not create window: ' . SDL_GetError() unless $win; |
1089
|
|
|
|
|
|
|
my $event = SDL2::Event->new; |
1090
|
|
|
|
|
|
|
SDL_Init(SDL_INIT_VIDEO); |
1091
|
|
|
|
|
|
|
my $renderer = SDL_CreateRenderer( $win, -1, 0 ); |
1092
|
|
|
|
|
|
|
SDL_SetRenderDrawColor( $renderer, 242, 242, 242, 255 ); |
1093
|
|
|
|
|
|
|
do { |
1094
|
|
|
|
|
|
|
SDL_WaitEventTimeout( $event, 10 ); |
1095
|
|
|
|
|
|
|
SDL_RenderClear($renderer); |
1096
|
|
|
|
|
|
|
SDL_RenderPresent($renderer); |
1097
|
|
|
|
|
|
|
} until $event->type == SDL_QUIT; |
1098
|
|
|
|
|
|
|
SDL_DestroyRenderer($renderer); |
1099
|
|
|
|
|
|
|
SDL_DestroyWindow($win); |
1100
|
|
|
|
|
|
|
SDL_Quit(); |
1101
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
=head1 DESCRIPTION |
1103
|
|
|
|
|
|
|
|
1104
|
|
|
|
|
|
|
SDL2::FFI is an L backed bindings to the Bimple |
1105
|
|
|
|
|
|
|
BirectMedia Bayer - a cross-platform development library designed to |
1106
|
|
|
|
|
|
|
provide low level access to audio, keyboard, mouse, joystick, and graphics |
1107
|
|
|
|
|
|
|
hardware. |
1108
|
|
|
|
|
|
|
|
1109
|
|
|
|
|
|
|
=head1 Initialization and Shutdown |
1110
|
|
|
|
|
|
|
|
1111
|
|
|
|
|
|
|
The functions in this category are used to set SDL up for use and generally |
1112
|
|
|
|
|
|
|
have global effects in your program. These functions may be imported with the |
1113
|
|
|
|
|
|
|
C<:init> or C<:default> tag. |
1114
|
|
|
|
|
|
|
|
1115
|
|
|
|
|
|
|
=head2 C |
1116
|
|
|
|
|
|
|
|
1117
|
|
|
|
|
|
|
Initializes the SDL library. This must be called before using most other SDL |
1118
|
|
|
|
|
|
|
functions. |
1119
|
|
|
|
|
|
|
|
1120
|
|
|
|
|
|
|
SDL_Init( SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_EVENTS ); |
1121
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
C simply forwards to calling L<< C
|
1123
|
|
|
|
|
|
|
)>|/C >>. Therefore, the two may be used |
1124
|
|
|
|
|
|
|
interchangeably. Though for readability of your code L<< C
|
1125
|
|
|
|
|
|
|
... )>|/C >> might be preferred. |
1126
|
|
|
|
|
|
|
|
1127
|
|
|
|
|
|
|
The file I/O (for example: L<< C|/C
|
1128
|
|
|
|
|
|
|
)> >>) and threading (L<< C|/C
|
1129
|
|
|
|
|
|
|
)> >>) subsystems are initialized by default. Message boxes ( L<< |
1130
|
|
|
|
|
|
|
C|/C >> ) |
1131
|
|
|
|
|
|
|
also attempt to work without initializing the video subsystem, in hopes of |
1132
|
|
|
|
|
|
|
being useful in showing an error dialog when SDL_Init fails. You must |
1133
|
|
|
|
|
|
|
specifically initialize other subsystems if you use them in your application. |
1134
|
|
|
|
|
|
|
|
1135
|
|
|
|
|
|
|
Logging (such as L<< C|/C >> ) works without |
1136
|
|
|
|
|
|
|
initialization, too. |
1137
|
|
|
|
|
|
|
|
1138
|
|
|
|
|
|
|
Expected parameters include: |
1139
|
|
|
|
|
|
|
|
1140
|
|
|
|
|
|
|
=over |
1141
|
|
|
|
|
|
|
|
1142
|
|
|
|
|
|
|
=item C which may be any be imported with the L<< C<:init>|SDL2::Enum/C<:init> >> tag and may be OR'd together |
1143
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
=back |
1145
|
|
|
|
|
|
|
|
1146
|
|
|
|
|
|
|
Subsystem initialization is ref-counted, you must call L<< C
|
1147
|
|
|
|
|
|
|
... )>|/C >> for each L<< C
|
1148
|
|
|
|
|
|
|
)>|/C >> to correctly shutdown a subsystem manually |
1149
|
|
|
|
|
|
|
(or call L<< C|/C >> to force shutdown). If a |
1150
|
|
|
|
|
|
|
subsystem is already loaded then this call will increase the ref-count and |
1151
|
|
|
|
|
|
|
return. |
1152
|
|
|
|
|
|
|
|
1153
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
1154
|
|
|
|
|
|
|
C|/C >> for more information. |
1155
|
|
|
|
|
|
|
|
1156
|
|
|
|
|
|
|
=head2 C |
1157
|
|
|
|
|
|
|
|
1158
|
|
|
|
|
|
|
Compatibility function to initialize the SDL library. |
1159
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
In SDL2, this function and L<< C|/C >> are |
1161
|
|
|
|
|
|
|
interchangeable. |
1162
|
|
|
|
|
|
|
|
1163
|
|
|
|
|
|
|
SDL_InitSubSystem( SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_EVENTS ); |
1164
|
|
|
|
|
|
|
|
1165
|
|
|
|
|
|
|
Expected parameters include: |
1166
|
|
|
|
|
|
|
|
1167
|
|
|
|
|
|
|
=over |
1168
|
|
|
|
|
|
|
|
1169
|
|
|
|
|
|
|
=item C which may be any be imported with the L<< C<:init>|SDL2::Enum/C<:init> >> tag and may be OR'd together. |
1170
|
|
|
|
|
|
|
|
1171
|
|
|
|
|
|
|
=back |
1172
|
|
|
|
|
|
|
|
1173
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
1174
|
|
|
|
|
|
|
C|/C >> for more information. |
1175
|
|
|
|
|
|
|
|
1176
|
|
|
|
|
|
|
=head2 C |
1177
|
|
|
|
|
|
|
|
1178
|
|
|
|
|
|
|
Clean up all initialized subsystems. |
1179
|
|
|
|
|
|
|
|
1180
|
|
|
|
|
|
|
SDL_Quit( ); |
1181
|
|
|
|
|
|
|
|
1182
|
|
|
|
|
|
|
You should call this function even if you have already shutdown each |
1183
|
|
|
|
|
|
|
initialized subsystem with L<< C|/C |
1184
|
|
|
|
|
|
|
>>. It is safe to call this function even in the case of errors in |
1185
|
|
|
|
|
|
|
initialization. |
1186
|
|
|
|
|
|
|
|
1187
|
|
|
|
|
|
|
If you start a subsystem using a call to that subsystem's init function (for |
1188
|
|
|
|
|
|
|
example L<< C|/C >>) instead of L<< |
1189
|
|
|
|
|
|
|
C|/C >> or L<< C
|
1190
|
|
|
|
|
|
|
)>|/C >>, then you must use that subsystem's quit |
1191
|
|
|
|
|
|
|
function (L<< C|/C >>) to shut it down |
1192
|
|
|
|
|
|
|
before calling C. But generally, you should not be using those |
1193
|
|
|
|
|
|
|
functions directly anyhow; use L<< C|/C >> |
1194
|
|
|
|
|
|
|
instead. |
1195
|
|
|
|
|
|
|
|
1196
|
|
|
|
|
|
|
You can use this function in an C block to ensure that it is run |
1197
|
|
|
|
|
|
|
when your application is shutdown. |
1198
|
|
|
|
|
|
|
|
1199
|
|
|
|
|
|
|
=head2 C |
1200
|
|
|
|
|
|
|
|
1201
|
|
|
|
|
|
|
Shut down specific SDL subsystems. |
1202
|
|
|
|
|
|
|
|
1203
|
|
|
|
|
|
|
SDL_QuitSubSystem( SDL_INIT_VIDEO ); |
1204
|
|
|
|
|
|
|
|
1205
|
|
|
|
|
|
|
If you start a subsystem using a call to that subsystem's init function (for |
1206
|
|
|
|
|
|
|
example L<< C |/C >>) instead of L<< |
1207
|
|
|
|
|
|
|
C|/C >> or L<< C
|
1208
|
|
|
|
|
|
|
)>|/C >>, L<< C
|
1209
|
|
|
|
|
|
|
)>|/C >> and L<< C
|
1210
|
|
|
|
|
|
|
)>|/C >> will not work. You will need to use that |
1211
|
|
|
|
|
|
|
subsystem's quit function ( L<< C|/C >> |
1212
|
|
|
|
|
|
|
directly instead. But generally, you should not be using those functions |
1213
|
|
|
|
|
|
|
directly anyhow; use L<< C|/C >> instead. |
1214
|
|
|
|
|
|
|
|
1215
|
|
|
|
|
|
|
You still need to call L<< C|/C >> even if you close |
1216
|
|
|
|
|
|
|
all open subsystems with L<< C|/C
|
1217
|
|
|
|
|
|
|
... )> >>. |
1218
|
|
|
|
|
|
|
|
1219
|
|
|
|
|
|
|
Expected parameters include: |
1220
|
|
|
|
|
|
|
|
1221
|
|
|
|
|
|
|
=over |
1222
|
|
|
|
|
|
|
|
1223
|
|
|
|
|
|
|
=item C which may be any be imported with the L<< C<:init>|SDL2::Enum/C<:init> >> tag and may be OR'd together. |
1224
|
|
|
|
|
|
|
|
1225
|
|
|
|
|
|
|
=back |
1226
|
|
|
|
|
|
|
|
1227
|
|
|
|
|
|
|
=head2 C |
1228
|
|
|
|
|
|
|
|
1229
|
|
|
|
|
|
|
Get a mask of the specified subsystems which are currently initialized. |
1230
|
|
|
|
|
|
|
|
1231
|
|
|
|
|
|
|
SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO ); |
1232
|
|
|
|
|
|
|
warn SDL_WasInit( SDL_INIT_TIMER ); # false |
1233
|
|
|
|
|
|
|
warn SDL_WasInit( SDL_INIT_VIDEO ); # true (32 == SDL_INIT_VIDEO) |
1234
|
|
|
|
|
|
|
my $mask = SDL_WasInit( ); |
1235
|
|
|
|
|
|
|
warn 'video init!' if ($mask & SDL_INIT_VIDEO); # yep |
1236
|
|
|
|
|
|
|
warn 'video timer!' if ($mask & SDL_INIT_TIMER); # nope |
1237
|
|
|
|
|
|
|
|
1238
|
|
|
|
|
|
|
Expected parameters include: |
1239
|
|
|
|
|
|
|
|
1240
|
|
|
|
|
|
|
=over |
1241
|
|
|
|
|
|
|
|
1242
|
|
|
|
|
|
|
=item C which may be any be imported with the L<< C<:init>|SDL2::Enum/C<:init> >> tag and may be OR'd together. |
1243
|
|
|
|
|
|
|
|
1244
|
|
|
|
|
|
|
=back |
1245
|
|
|
|
|
|
|
|
1246
|
|
|
|
|
|
|
If C is C<0>, it returns a mask of all initialized subsystems, otherwise |
1247
|
|
|
|
|
|
|
it returns the initialization status of the specified subsystems. |
1248
|
|
|
|
|
|
|
|
1249
|
|
|
|
|
|
|
The return value does not include C. |
1250
|
|
|
|
|
|
|
|
1251
|
|
|
|
|
|
|
=head1 Configuration Variables |
1252
|
|
|
|
|
|
|
|
1253
|
|
|
|
|
|
|
This category contains functions to set and get configuration hints, as well as |
1254
|
|
|
|
|
|
|
listing each of them alphabetically. |
1255
|
|
|
|
|
|
|
|
1256
|
|
|
|
|
|
|
The convention for naming hints is C, where C is the |
1257
|
|
|
|
|
|
|
environment variable that can be used to override the default. You may import |
1258
|
|
|
|
|
|
|
those recognised by SDL2 with the L<< C<:hints>|SDL2::Enum/C<:hints> >> tag. |
1259
|
|
|
|
|
|
|
|
1260
|
|
|
|
|
|
|
In general these hints are just that - they may or may not be supported or |
1261
|
|
|
|
|
|
|
applicable on any given platform, but they provide a way for an application or |
1262
|
|
|
|
|
|
|
user to give the library a hint as to how they would like the library to work. |
1263
|
|
|
|
|
|
|
|
1264
|
|
|
|
|
|
|
=head2 C |
1265
|
|
|
|
|
|
|
|
1266
|
|
|
|
|
|
|
Set a hint with a specific priority. |
1267
|
|
|
|
|
|
|
|
1268
|
|
|
|
|
|
|
SDL_SetHintWithPriority( SDL_EVENT_LOGGING, 2, SDL_HINT_OVERRIDE ); |
1269
|
|
|
|
|
|
|
|
1270
|
|
|
|
|
|
|
The priority controls the behavior when setting a hint that already has a |
1271
|
|
|
|
|
|
|
value. Hints will replace existing hints of their priority and lower. |
1272
|
|
|
|
|
|
|
Environment variables are considered to have override priority. |
1273
|
|
|
|
|
|
|
|
1274
|
|
|
|
|
|
|
Expected parameters include: |
1275
|
|
|
|
|
|
|
|
1276
|
|
|
|
|
|
|
=over |
1277
|
|
|
|
|
|
|
|
1278
|
|
|
|
|
|
|
=item C |
1279
|
|
|
|
|
|
|
|
1280
|
|
|
|
|
|
|
the hint to set |
1281
|
|
|
|
|
|
|
|
1282
|
|
|
|
|
|
|
=item C |
1283
|
|
|
|
|
|
|
|
1284
|
|
|
|
|
|
|
the value of the hint variable |
1285
|
|
|
|
|
|
|
|
1286
|
|
|
|
|
|
|
=item C |
1287
|
|
|
|
|
|
|
|
1288
|
|
|
|
|
|
|
the priority level for the hint |
1289
|
|
|
|
|
|
|
|
1290
|
|
|
|
|
|
|
=back |
1291
|
|
|
|
|
|
|
|
1292
|
|
|
|
|
|
|
Returns a true if the hint was set, untrue otherwise. |
1293
|
|
|
|
|
|
|
|
1294
|
|
|
|
|
|
|
=head2 C |
1295
|
|
|
|
|
|
|
|
1296
|
|
|
|
|
|
|
Set a hint with normal priority. |
1297
|
|
|
|
|
|
|
|
1298
|
|
|
|
|
|
|
SDL_SetHint( SDL_HINT_XINPUT_ENABLED, 1 ); |
1299
|
|
|
|
|
|
|
|
1300
|
|
|
|
|
|
|
Hints will not be set if there is an existing override hint or environment |
1301
|
|
|
|
|
|
|
variable that takes precedence. You can use SDL_SetHintWithPriority( ) to set |
1302
|
|
|
|
|
|
|
the hint with override priority instead. |
1303
|
|
|
|
|
|
|
|
1304
|
|
|
|
|
|
|
Expected parameters: |
1305
|
|
|
|
|
|
|
|
1306
|
|
|
|
|
|
|
=over |
1307
|
|
|
|
|
|
|
|
1308
|
|
|
|
|
|
|
=item C |
1309
|
|
|
|
|
|
|
|
1310
|
|
|
|
|
|
|
the hint to set |
1311
|
|
|
|
|
|
|
|
1312
|
|
|
|
|
|
|
=item C |
1313
|
|
|
|
|
|
|
|
1314
|
|
|
|
|
|
|
the value of the hint variable |
1315
|
|
|
|
|
|
|
|
1316
|
|
|
|
|
|
|
=back |
1317
|
|
|
|
|
|
|
|
1318
|
|
|
|
|
|
|
Returns a true value if the hint was set, untrue otherwise. |
1319
|
|
|
|
|
|
|
|
1320
|
|
|
|
|
|
|
=head2 C |
1321
|
|
|
|
|
|
|
|
1322
|
|
|
|
|
|
|
Get the value of a hint. |
1323
|
|
|
|
|
|
|
|
1324
|
|
|
|
|
|
|
SDL_GetHint( SDL_HINT_XINPUT_ENABLED ); |
1325
|
|
|
|
|
|
|
|
1326
|
|
|
|
|
|
|
Expected parameters: |
1327
|
|
|
|
|
|
|
|
1328
|
|
|
|
|
|
|
=over |
1329
|
|
|
|
|
|
|
|
1330
|
|
|
|
|
|
|
=item C |
1331
|
|
|
|
|
|
|
|
1332
|
|
|
|
|
|
|
the hint to query |
1333
|
|
|
|
|
|
|
|
1334
|
|
|
|
|
|
|
=back |
1335
|
|
|
|
|
|
|
|
1336
|
|
|
|
|
|
|
Returns the string value of a hint or an undefined value if the hint isn't set. |
1337
|
|
|
|
|
|
|
|
1338
|
|
|
|
|
|
|
=head2 C |
1339
|
|
|
|
|
|
|
|
1340
|
|
|
|
|
|
|
Get the boolean value of a hint variable. |
1341
|
|
|
|
|
|
|
|
1342
|
|
|
|
|
|
|
SDL_GetHintBoolean( SDL_HINT_XINPUT_ENABLED, 0); |
1343
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
Expected parameters: |
1345
|
|
|
|
|
|
|
|
1346
|
|
|
|
|
|
|
=over |
1347
|
|
|
|
|
|
|
|
1348
|
|
|
|
|
|
|
=item C |
1349
|
|
|
|
|
|
|
|
1350
|
|
|
|
|
|
|
the name of the hint to get the boolean value from |
1351
|
|
|
|
|
|
|
|
1352
|
|
|
|
|
|
|
=item C |
1353
|
|
|
|
|
|
|
|
1354
|
|
|
|
|
|
|
the value to return if the hint does not exist |
1355
|
|
|
|
|
|
|
|
1356
|
|
|
|
|
|
|
=back |
1357
|
|
|
|
|
|
|
|
1358
|
|
|
|
|
|
|
Returns the boolean value of a hint or the provided default value if the hint |
1359
|
|
|
|
|
|
|
does not exist. |
1360
|
|
|
|
|
|
|
|
1361
|
|
|
|
|
|
|
=head2 C |
1362
|
|
|
|
|
|
|
|
1363
|
|
|
|
|
|
|
Add a function to watch a particular hint. |
1364
|
|
|
|
|
|
|
|
1365
|
|
|
|
|
|
|
my $cb = SDL_AddHintCallback( |
1366
|
|
|
|
|
|
|
SDL_HINT_XINPUT_ENABLED, |
1367
|
|
|
|
|
|
|
sub { |
1368
|
|
|
|
|
|
|
my ($userdata, $name, $oldvalue, $newvalue) = @_; |
1369
|
|
|
|
|
|
|
...; |
1370
|
|
|
|
|
|
|
}, |
1371
|
|
|
|
|
|
|
{ time => time( ), clicks => 3 } |
1372
|
|
|
|
|
|
|
); |
1373
|
|
|
|
|
|
|
|
1374
|
|
|
|
|
|
|
Expected parameters: |
1375
|
|
|
|
|
|
|
|
1376
|
|
|
|
|
|
|
=over |
1377
|
|
|
|
|
|
|
|
1378
|
|
|
|
|
|
|
=item C |
1379
|
|
|
|
|
|
|
|
1380
|
|
|
|
|
|
|
the hint to watch |
1381
|
|
|
|
|
|
|
|
1382
|
|
|
|
|
|
|
=item C |
1383
|
|
|
|
|
|
|
|
1384
|
|
|
|
|
|
|
a code reference that will be called when the hint value changes |
1385
|
|
|
|
|
|
|
|
1386
|
|
|
|
|
|
|
=item C |
1387
|
|
|
|
|
|
|
|
1388
|
|
|
|
|
|
|
a pointer to pass to the callback function |
1389
|
|
|
|
|
|
|
|
1390
|
|
|
|
|
|
|
=back |
1391
|
|
|
|
|
|
|
|
1392
|
|
|
|
|
|
|
Returns a pointer to a L which you may pass to L<< |
1393
|
|
|
|
|
|
|
C|/C >>. |
1394
|
|
|
|
|
|
|
|
1395
|
|
|
|
|
|
|
=head2 C |
1396
|
|
|
|
|
|
|
|
1397
|
|
|
|
|
|
|
Remove a callback watching a particular hint. |
1398
|
|
|
|
|
|
|
|
1399
|
|
|
|
|
|
|
SDL_AddHintCallback( |
1400
|
|
|
|
|
|
|
SDL_HINT_XINPUT_ENABLED, |
1401
|
|
|
|
|
|
|
$cb, |
1402
|
|
|
|
|
|
|
{ time => time( ), clicks => 3 } |
1403
|
|
|
|
|
|
|
); |
1404
|
|
|
|
|
|
|
|
1405
|
|
|
|
|
|
|
Expected parameters: |
1406
|
|
|
|
|
|
|
|
1407
|
|
|
|
|
|
|
=over |
1408
|
|
|
|
|
|
|
|
1409
|
|
|
|
|
|
|
=item C |
1410
|
|
|
|
|
|
|
|
1411
|
|
|
|
|
|
|
the hint to watch |
1412
|
|
|
|
|
|
|
|
1413
|
|
|
|
|
|
|
=item C |
1414
|
|
|
|
|
|
|
|
1415
|
|
|
|
|
|
|
L object returned by L<< C
|
1416
|
|
|
|
|
|
|
)>|/C >> |
1417
|
|
|
|
|
|
|
|
1418
|
|
|
|
|
|
|
=item C |
1419
|
|
|
|
|
|
|
|
1420
|
|
|
|
|
|
|
a pointer to pass to the callback function |
1421
|
|
|
|
|
|
|
|
1422
|
|
|
|
|
|
|
=back |
1423
|
|
|
|
|
|
|
|
1424
|
|
|
|
|
|
|
=head2 C |
1425
|
|
|
|
|
|
|
|
1426
|
|
|
|
|
|
|
Clear all hints. |
1427
|
|
|
|
|
|
|
|
1428
|
|
|
|
|
|
|
SDL_ClearHints( ); |
1429
|
|
|
|
|
|
|
|
1430
|
|
|
|
|
|
|
This function is automatically called during L<< C|/C |
1431
|
|
|
|
|
|
|
>>. |
1432
|
|
|
|
|
|
|
|
1433
|
|
|
|
|
|
|
=head1 Error Handling |
1434
|
|
|
|
|
|
|
|
1435
|
|
|
|
|
|
|
Functions in this category provide simple error message routines for SDL. L<< |
1436
|
|
|
|
|
|
|
C|/C >> can be called for almost all SDL |
1437
|
|
|
|
|
|
|
functions to determine what problems are occurring. Check the wiki page of each |
1438
|
|
|
|
|
|
|
specific SDL function to see whether L<< C|/C |
1439
|
|
|
|
|
|
|
>> is meaningful for them or not. These functions may be imported with the |
1440
|
|
|
|
|
|
|
C<:error> tag. |
1441
|
|
|
|
|
|
|
|
1442
|
|
|
|
|
|
|
The SDL error messages are in English. |
1443
|
|
|
|
|
|
|
|
1444
|
|
|
|
|
|
|
=head2 C |
1445
|
|
|
|
|
|
|
|
1446
|
|
|
|
|
|
|
Set the SDL error message for the current thread. |
1447
|
|
|
|
|
|
|
|
1448
|
|
|
|
|
|
|
Calling this function will replace any previous error message that was set. |
1449
|
|
|
|
|
|
|
|
1450
|
|
|
|
|
|
|
This function always returns C<-1>, since SDL frequently uses C<-1> to signify |
1451
|
|
|
|
|
|
|
an failing result, leading to this idiom: |
1452
|
|
|
|
|
|
|
|
1453
|
|
|
|
|
|
|
if ($error_code) { |
1454
|
|
|
|
|
|
|
return SDL_SetError( 'This operation has failed: %d', $error_code ); |
1455
|
|
|
|
|
|
|
} |
1456
|
|
|
|
|
|
|
|
1457
|
|
|
|
|
|
|
Expected parameters: |
1458
|
|
|
|
|
|
|
|
1459
|
|
|
|
|
|
|
=over |
1460
|
|
|
|
|
|
|
|
1461
|
|
|
|
|
|
|
=item C |
1462
|
|
|
|
|
|
|
|
1463
|
|
|
|
|
|
|
a C-style message format string |
1464
|
|
|
|
|
|
|
|
1465
|
|
|
|
|
|
|
=item C<@params> |
1466
|
|
|
|
|
|
|
|
1467
|
|
|
|
|
|
|
additional parameters matching % tokens in the C string, if any |
1468
|
|
|
|
|
|
|
|
1469
|
|
|
|
|
|
|
=back |
1470
|
|
|
|
|
|
|
|
1471
|
|
|
|
|
|
|
=head2 C |
1472
|
|
|
|
|
|
|
|
1473
|
|
|
|
|
|
|
Retrieve a message about the last error that occurred on the current thread. |
1474
|
|
|
|
|
|
|
|
1475
|
|
|
|
|
|
|
warn SDL_GetError( ); |
1476
|
|
|
|
|
|
|
|
1477
|
|
|
|
|
|
|
It is possible for multiple errors to occur before calling C. |
1478
|
|
|
|
|
|
|
Only the last error is returned. |
1479
|
|
|
|
|
|
|
|
1480
|
|
|
|
|
|
|
The message is only applicable when an SDL function has signaled an error. You |
1481
|
|
|
|
|
|
|
must check the return values of SDL function calls to determine when to |
1482
|
|
|
|
|
|
|
appropriately call C. You should B use the results of |
1483
|
|
|
|
|
|
|
C to decide if an error has occurred! Sometimes SDL will set |
1484
|
|
|
|
|
|
|
an error string even when reporting success. |
1485
|
|
|
|
|
|
|
|
1486
|
|
|
|
|
|
|
SDL will B clear the error string for successful API calls. You B |
1487
|
|
|
|
|
|
|
check return values for failure cases before you can assume the error string |
1488
|
|
|
|
|
|
|
applies. |
1489
|
|
|
|
|
|
|
|
1490
|
|
|
|
|
|
|
Error strings are set per-thread, so an error set in a different thread will |
1491
|
|
|
|
|
|
|
not interfere with the current thread's operation. |
1492
|
|
|
|
|
|
|
|
1493
|
|
|
|
|
|
|
The returned string is internally allocated and must not be freed by the |
1494
|
|
|
|
|
|
|
application. |
1495
|
|
|
|
|
|
|
|
1496
|
|
|
|
|
|
|
Returns a message with information about the specific error that occurred, or |
1497
|
|
|
|
|
|
|
an empty string if there hasn't been an error message set since the last call |
1498
|
|
|
|
|
|
|
to L<< C|/C >>. The message is only |
1499
|
|
|
|
|
|
|
applicable when an SDL function has signaled an error. You must check the |
1500
|
|
|
|
|
|
|
return values of SDL function calls to determine when to appropriately call |
1501
|
|
|
|
|
|
|
C. |
1502
|
|
|
|
|
|
|
|
1503
|
|
|
|
|
|
|
=head2 C |
1504
|
|
|
|
|
|
|
|
1505
|
|
|
|
|
|
|
Get the last error message that was set for the current thread. |
1506
|
|
|
|
|
|
|
|
1507
|
|
|
|
|
|
|
my $x; |
1508
|
|
|
|
|
|
|
warn SDL_GetErrorMsg($x, 300); |
1509
|
|
|
|
|
|
|
|
1510
|
|
|
|
|
|
|
This allows the caller to copy the error string into a provided buffer, but |
1511
|
|
|
|
|
|
|
otherwise operates exactly the same as L<< C|/C
|
1512
|
|
|
|
|
|
|
)> >>. |
1513
|
|
|
|
|
|
|
|
1514
|
|
|
|
|
|
|
=over |
1515
|
|
|
|
|
|
|
|
1516
|
|
|
|
|
|
|
=item C |
1517
|
|
|
|
|
|
|
|
1518
|
|
|
|
|
|
|
A buffer to fill with the last error message that was set for the current |
1519
|
|
|
|
|
|
|
thread |
1520
|
|
|
|
|
|
|
|
1521
|
|
|
|
|
|
|
=item C |
1522
|
|
|
|
|
|
|
|
1523
|
|
|
|
|
|
|
The size of the buffer pointed to by the errstr parameter |
1524
|
|
|
|
|
|
|
|
1525
|
|
|
|
|
|
|
=back |
1526
|
|
|
|
|
|
|
|
1527
|
|
|
|
|
|
|
Returns the pointer passed in as the C parameter. |
1528
|
|
|
|
|
|
|
|
1529
|
|
|
|
|
|
|
=head2 C |
1530
|
|
|
|
|
|
|
|
1531
|
|
|
|
|
|
|
Clear any previous error message for this thread. |
1532
|
|
|
|
|
|
|
|
1533
|
|
|
|
|
|
|
=head1 Log Handling |
1534
|
|
|
|
|
|
|
|
1535
|
|
|
|
|
|
|
Simple log messages with categories and priorities. These functions may be |
1536
|
|
|
|
|
|
|
imported with the C<:logging> tag. |
1537
|
|
|
|
|
|
|
|
1538
|
|
|
|
|
|
|
By default, logs are quiet but if you're debugging SDL you might want: |
1539
|
|
|
|
|
|
|
|
1540
|
|
|
|
|
|
|
SDL_LogSetAllPriority( SDL_LOG_PRIORITY_WARN ); |
1541
|
|
|
|
|
|
|
|
1542
|
|
|
|
|
|
|
Here's where the messages go on different platforms: |
1543
|
|
|
|
|
|
|
|
1544
|
|
|
|
|
|
|
Windows debug output stream |
1545
|
|
|
|
|
|
|
Android log output |
1546
|
|
|
|
|
|
|
Others standard error output (STDERR) |
1547
|
|
|
|
|
|
|
|
1548
|
|
|
|
|
|
|
Messages longer than the maximum size (4096 bytes) will be truncated. |
1549
|
|
|
|
|
|
|
|
1550
|
|
|
|
|
|
|
=head2 C |
1551
|
|
|
|
|
|
|
|
1552
|
|
|
|
|
|
|
Set the priority of all log categories. |
1553
|
|
|
|
|
|
|
|
1554
|
|
|
|
|
|
|
SDL_LogSetAllPriority( SDL_LOG_PRIORITY_WARN ); |
1555
|
|
|
|
|
|
|
|
1556
|
|
|
|
|
|
|
Expected parameters: |
1557
|
|
|
|
|
|
|
|
1558
|
|
|
|
|
|
|
=over |
1559
|
|
|
|
|
|
|
|
1560
|
|
|
|
|
|
|
=item C |
1561
|
|
|
|
|
|
|
|
1562
|
|
|
|
|
|
|
The SDL_LogPriority to assign. These may be imported with the L<< |
1563
|
|
|
|
|
|
|
C<:logpriority>|/C<:logpriority> >> tag. |
1564
|
|
|
|
|
|
|
|
1565
|
|
|
|
|
|
|
=back |
1566
|
|
|
|
|
|
|
|
1567
|
|
|
|
|
|
|
=head2 C |
1568
|
|
|
|
|
|
|
|
1569
|
|
|
|
|
|
|
Set the priority of all log categories. |
1570
|
|
|
|
|
|
|
|
1571
|
|
|
|
|
|
|
SDL_LogSetPriority( SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN ); |
1572
|
|
|
|
|
|
|
|
1573
|
|
|
|
|
|
|
Expected parameters: |
1574
|
|
|
|
|
|
|
|
1575
|
|
|
|
|
|
|
=over |
1576
|
|
|
|
|
|
|
|
1577
|
|
|
|
|
|
|
=item C |
1578
|
|
|
|
|
|
|
|
1579
|
|
|
|
|
|
|
The category to assign a priority to. These may be imported with the L<< |
1580
|
|
|
|
|
|
|
C<:logcategory>|/C<:logcategory> >> tag. |
1581
|
|
|
|
|
|
|
|
1582
|
|
|
|
|
|
|
=item C |
1583
|
|
|
|
|
|
|
|
1584
|
|
|
|
|
|
|
The SDL_LogPriority to assign. These may be imported with the L<< |
1585
|
|
|
|
|
|
|
C<:logpriority>|/C<:logpriority> >> tag. |
1586
|
|
|
|
|
|
|
|
1587
|
|
|
|
|
|
|
=back |
1588
|
|
|
|
|
|
|
|
1589
|
|
|
|
|
|
|
=head2 C |
1590
|
|
|
|
|
|
|
|
1591
|
|
|
|
|
|
|
Get the priority of a particular log category. |
1592
|
|
|
|
|
|
|
|
1593
|
|
|
|
|
|
|
SDL_LogGetPriority( SDL_LOG_CATEGORY_ERROR ); |
1594
|
|
|
|
|
|
|
|
1595
|
|
|
|
|
|
|
Expected parameters: |
1596
|
|
|
|
|
|
|
|
1597
|
|
|
|
|
|
|
=over |
1598
|
|
|
|
|
|
|
|
1599
|
|
|
|
|
|
|
=item C |
1600
|
|
|
|
|
|
|
|
1601
|
|
|
|
|
|
|
The SDL_LogCategory to query. These may be imported with the L<< |
1602
|
|
|
|
|
|
|
C<:logcategory>|/C<:logcategory> >> tag. |
1603
|
|
|
|
|
|
|
|
1604
|
|
|
|
|
|
|
=back |
1605
|
|
|
|
|
|
|
|
1606
|
|
|
|
|
|
|
=head2 C |
1607
|
|
|
|
|
|
|
|
1608
|
|
|
|
|
|
|
Get the priority of a particular log category. |
1609
|
|
|
|
|
|
|
|
1610
|
|
|
|
|
|
|
SDL_LogGetPriority( SDL_LOG_CATEGORY_ERROR ); |
1611
|
|
|
|
|
|
|
|
1612
|
|
|
|
|
|
|
Expected parameters: |
1613
|
|
|
|
|
|
|
|
1614
|
|
|
|
|
|
|
=over |
1615
|
|
|
|
|
|
|
|
1616
|
|
|
|
|
|
|
=item C |
1617
|
|
|
|
|
|
|
|
1618
|
|
|
|
|
|
|
The SDL_LogCategory to query. These may be imported with the L<< |
1619
|
|
|
|
|
|
|
C<:logcategory>|/C<:logcategory> >> tag. |
1620
|
|
|
|
|
|
|
|
1621
|
|
|
|
|
|
|
=back |
1622
|
|
|
|
|
|
|
|
1623
|
|
|
|
|
|
|
=head2 C |
1624
|
|
|
|
|
|
|
|
1625
|
|
|
|
|
|
|
Reset all priorities to default. |
1626
|
|
|
|
|
|
|
|
1627
|
|
|
|
|
|
|
SDL_LogResetPriorities( ); |
1628
|
|
|
|
|
|
|
|
1629
|
|
|
|
|
|
|
This is called by L<< C|/C >>. |
1630
|
|
|
|
|
|
|
|
1631
|
|
|
|
|
|
|
=head2 C |
1632
|
|
|
|
|
|
|
|
1633
|
|
|
|
|
|
|
Log a message with C and |
1634
|
|
|
|
|
|
|
C. |
1635
|
|
|
|
|
|
|
|
1636
|
|
|
|
|
|
|
SDL_Log( 'HTTP Status: %s', $http->status ); |
1637
|
|
|
|
|
|
|
|
1638
|
|
|
|
|
|
|
Expected parameters: |
1639
|
|
|
|
|
|
|
|
1640
|
|
|
|
|
|
|
=over |
1641
|
|
|
|
|
|
|
|
1642
|
|
|
|
|
|
|
=item C |
1643
|
|
|
|
|
|
|
|
1644
|
|
|
|
|
|
|
A C style message format string. |
1645
|
|
|
|
|
|
|
|
1646
|
|
|
|
|
|
|
=item C<...> |
1647
|
|
|
|
|
|
|
|
1648
|
|
|
|
|
|
|
Any additional parameters matching C<%> tokens in the C string, if any. |
1649
|
|
|
|
|
|
|
|
1650
|
|
|
|
|
|
|
=back |
1651
|
|
|
|
|
|
|
|
1652
|
|
|
|
|
|
|
=head2 C |
1653
|
|
|
|
|
|
|
|
1654
|
|
|
|
|
|
|
Log a message with C. |
1655
|
|
|
|
|
|
|
|
1656
|
|
|
|
|
|
|
SDL_LogVerbose( 'Current time: %s [%ds exec]', +localtime( ), time - $^T ); |
1657
|
|
|
|
|
|
|
|
1658
|
|
|
|
|
|
|
Expected parameters: |
1659
|
|
|
|
|
|
|
|
1660
|
|
|
|
|
|
|
=over |
1661
|
|
|
|
|
|
|
|
1662
|
|
|
|
|
|
|
=item C |
1663
|
|
|
|
|
|
|
|
1664
|
|
|
|
|
|
|
The category of the message. |
1665
|
|
|
|
|
|
|
|
1666
|
|
|
|
|
|
|
=item C |
1667
|
|
|
|
|
|
|
|
1668
|
|
|
|
|
|
|
A C style message format string. |
1669
|
|
|
|
|
|
|
|
1670
|
|
|
|
|
|
|
=item C<...> |
1671
|
|
|
|
|
|
|
|
1672
|
|
|
|
|
|
|
Additional parameters matching C<%> tokens in the C string, if any. |
1673
|
|
|
|
|
|
|
|
1674
|
|
|
|
|
|
|
=back |
1675
|
|
|
|
|
|
|
|
1676
|
|
|
|
|
|
|
=head2 C |
1677
|
|
|
|
|
|
|
|
1678
|
|
|
|
|
|
|
Log a message with C. |
1679
|
|
|
|
|
|
|
|
1680
|
|
|
|
|
|
|
SDL_LogDebug( 'Current time: %s [%ds exec]', +localtime( ), time - $^T ); |
1681
|
|
|
|
|
|
|
|
1682
|
|
|
|
|
|
|
Expected parameters: |
1683
|
|
|
|
|
|
|
|
1684
|
|
|
|
|
|
|
=over |
1685
|
|
|
|
|
|
|
|
1686
|
|
|
|
|
|
|
=item C |
1687
|
|
|
|
|
|
|
|
1688
|
|
|
|
|
|
|
The category of the message. |
1689
|
|
|
|
|
|
|
|
1690
|
|
|
|
|
|
|
=item C |
1691
|
|
|
|
|
|
|
|
1692
|
|
|
|
|
|
|
A C style message format string. |
1693
|
|
|
|
|
|
|
|
1694
|
|
|
|
|
|
|
=item C<...> |
1695
|
|
|
|
|
|
|
|
1696
|
|
|
|
|
|
|
Additional parameters matching C<%> tokens in the C string, if any. |
1697
|
|
|
|
|
|
|
|
1698
|
|
|
|
|
|
|
=back |
1699
|
|
|
|
|
|
|
|
1700
|
|
|
|
|
|
|
=head2 C |
1701
|
|
|
|
|
|
|
|
1702
|
|
|
|
|
|
|
Log a message with C. |
1703
|
|
|
|
|
|
|
|
1704
|
|
|
|
|
|
|
SDL_LogInfo( 'Current time: %s [%ds exec]', +localtime( ), time - $^T ); |
1705
|
|
|
|
|
|
|
|
1706
|
|
|
|
|
|
|
Expected parameters: |
1707
|
|
|
|
|
|
|
|
1708
|
|
|
|
|
|
|
=over |
1709
|
|
|
|
|
|
|
|
1710
|
|
|
|
|
|
|
=item C |
1711
|
|
|
|
|
|
|
|
1712
|
|
|
|
|
|
|
The category of the message. |
1713
|
|
|
|
|
|
|
|
1714
|
|
|
|
|
|
|
=item C |
1715
|
|
|
|
|
|
|
|
1716
|
|
|
|
|
|
|
A C style message format string. |
1717
|
|
|
|
|
|
|
|
1718
|
|
|
|
|
|
|
=item C<...> |
1719
|
|
|
|
|
|
|
|
1720
|
|
|
|
|
|
|
Additional parameters matching C<%> tokens in the C string, if any. |
1721
|
|
|
|
|
|
|
|
1722
|
|
|
|
|
|
|
=back |
1723
|
|
|
|
|
|
|
|
1724
|
|
|
|
|
|
|
=head2 C |
1725
|
|
|
|
|
|
|
|
1726
|
|
|
|
|
|
|
Log a message with C. |
1727
|
|
|
|
|
|
|
|
1728
|
|
|
|
|
|
|
SDL_LogWarn( 'Current time: %s [%ds exec]', +localtime( ), time - $^T ); |
1729
|
|
|
|
|
|
|
|
1730
|
|
|
|
|
|
|
Expected parameters: |
1731
|
|
|
|
|
|
|
|
1732
|
|
|
|
|
|
|
=over |
1733
|
|
|
|
|
|
|
|
1734
|
|
|
|
|
|
|
=item C |
1735
|
|
|
|
|
|
|
|
1736
|
|
|
|
|
|
|
The category of the message. |
1737
|
|
|
|
|
|
|
|
1738
|
|
|
|
|
|
|
=item C |
1739
|
|
|
|
|
|
|
|
1740
|
|
|
|
|
|
|
A C style message format string. |
1741
|
|
|
|
|
|
|
|
1742
|
|
|
|
|
|
|
=item C<...> |
1743
|
|
|
|
|
|
|
|
1744
|
|
|
|
|
|
|
Additional parameters matching C<%> tokens in the C string, if any. |
1745
|
|
|
|
|
|
|
|
1746
|
|
|
|
|
|
|
=back |
1747
|
|
|
|
|
|
|
|
1748
|
|
|
|
|
|
|
=head2 C |
1749
|
|
|
|
|
|
|
|
1750
|
|
|
|
|
|
|
Log a message with C. |
1751
|
|
|
|
|
|
|
|
1752
|
|
|
|
|
|
|
SDL_LogError( 'Current time: %s [%ds exec]', +localtime( ), time - $^T ); |
1753
|
|
|
|
|
|
|
|
1754
|
|
|
|
|
|
|
Expected parameters: |
1755
|
|
|
|
|
|
|
|
1756
|
|
|
|
|
|
|
=over |
1757
|
|
|
|
|
|
|
|
1758
|
|
|
|
|
|
|
=item C |
1759
|
|
|
|
|
|
|
|
1760
|
|
|
|
|
|
|
The category of the message. |
1761
|
|
|
|
|
|
|
|
1762
|
|
|
|
|
|
|
=item C |
1763
|
|
|
|
|
|
|
|
1764
|
|
|
|
|
|
|
A C style message format string. |
1765
|
|
|
|
|
|
|
|
1766
|
|
|
|
|
|
|
=item C<...> |
1767
|
|
|
|
|
|
|
|
1768
|
|
|
|
|
|
|
Additional parameters matching C<%> tokens in the C string, if any. |
1769
|
|
|
|
|
|
|
|
1770
|
|
|
|
|
|
|
=back |
1771
|
|
|
|
|
|
|
|
1772
|
|
|
|
|
|
|
=head2 C |
1773
|
|
|
|
|
|
|
|
1774
|
|
|
|
|
|
|
Log a message with C. |
1775
|
|
|
|
|
|
|
|
1776
|
|
|
|
|
|
|
SDL_LogCritical( 'Current time: %s [%ds exec]', +localtime( ), time - $^T ); |
1777
|
|
|
|
|
|
|
|
1778
|
|
|
|
|
|
|
Expected parameters: |
1779
|
|
|
|
|
|
|
|
1780
|
|
|
|
|
|
|
=over |
1781
|
|
|
|
|
|
|
|
1782
|
|
|
|
|
|
|
=item C |
1783
|
|
|
|
|
|
|
|
1784
|
|
|
|
|
|
|
The category of the message. |
1785
|
|
|
|
|
|
|
|
1786
|
|
|
|
|
|
|
=item C |
1787
|
|
|
|
|
|
|
|
1788
|
|
|
|
|
|
|
A C style message format string. |
1789
|
|
|
|
|
|
|
|
1790
|
|
|
|
|
|
|
=item C<...> |
1791
|
|
|
|
|
|
|
|
1792
|
|
|
|
|
|
|
Additional parameters matching C<%> tokens in the C string, if any. |
1793
|
|
|
|
|
|
|
|
1794
|
|
|
|
|
|
|
=back |
1795
|
|
|
|
|
|
|
|
1796
|
|
|
|
|
|
|
=head2 C |
1797
|
|
|
|
|
|
|
|
1798
|
|
|
|
|
|
|
Log a message with the specified category and priority. |
1799
|
|
|
|
|
|
|
|
1800
|
|
|
|
|
|
|
SDL_LogMessage( SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_CRITICAL, |
1801
|
|
|
|
|
|
|
'Current time: %s [%ds exec]', +localtime( ), time - $^T ); |
1802
|
|
|
|
|
|
|
|
1803
|
|
|
|
|
|
|
Expected parameters: |
1804
|
|
|
|
|
|
|
|
1805
|
|
|
|
|
|
|
=over |
1806
|
|
|
|
|
|
|
|
1807
|
|
|
|
|
|
|
=item C |
1808
|
|
|
|
|
|
|
|
1809
|
|
|
|
|
|
|
The category of the message. |
1810
|
|
|
|
|
|
|
|
1811
|
|
|
|
|
|
|
=item C |
1812
|
|
|
|
|
|
|
|
1813
|
|
|
|
|
|
|
The priority of the message. |
1814
|
|
|
|
|
|
|
|
1815
|
|
|
|
|
|
|
=item C |
1816
|
|
|
|
|
|
|
|
1817
|
|
|
|
|
|
|
A C style message format string. |
1818
|
|
|
|
|
|
|
|
1819
|
|
|
|
|
|
|
=item C<...> |
1820
|
|
|
|
|
|
|
|
1821
|
|
|
|
|
|
|
Additional parameters matching C<%> tokens in the C string, if any. |
1822
|
|
|
|
|
|
|
|
1823
|
|
|
|
|
|
|
=back |
1824
|
|
|
|
|
|
|
|
1825
|
|
|
|
|
|
|
=head2 C |
1826
|
|
|
|
|
|
|
|
1827
|
|
|
|
|
|
|
Replace the default log output function with one of your own. |
1828
|
|
|
|
|
|
|
|
1829
|
|
|
|
|
|
|
my $cb = SDL_LogSetOutputFunction( sub { ... }, {} ); |
1830
|
|
|
|
|
|
|
|
1831
|
|
|
|
|
|
|
Expected parameters: |
1832
|
|
|
|
|
|
|
|
1833
|
|
|
|
|
|
|
=over |
1834
|
|
|
|
|
|
|
|
1835
|
|
|
|
|
|
|
=item C |
1836
|
|
|
|
|
|
|
|
1837
|
|
|
|
|
|
|
A coderef to call instead of the default callback. |
1838
|
|
|
|
|
|
|
|
1839
|
|
|
|
|
|
|
This coderef should expect the following parameters: |
1840
|
|
|
|
|
|
|
|
1841
|
|
|
|
|
|
|
=over |
1842
|
|
|
|
|
|
|
|
1843
|
|
|
|
|
|
|
=item C |
1844
|
|
|
|
|
|
|
|
1845
|
|
|
|
|
|
|
What was passed as C to C. |
1846
|
|
|
|
|
|
|
|
1847
|
|
|
|
|
|
|
=item C |
1848
|
|
|
|
|
|
|
|
1849
|
|
|
|
|
|
|
The category of the message. |
1850
|
|
|
|
|
|
|
|
1851
|
|
|
|
|
|
|
=item C |
1852
|
|
|
|
|
|
|
|
1853
|
|
|
|
|
|
|
The priority of the message. |
1854
|
|
|
|
|
|
|
|
1855
|
|
|
|
|
|
|
=item C |
1856
|
|
|
|
|
|
|
|
1857
|
|
|
|
|
|
|
The message being output. |
1858
|
|
|
|
|
|
|
|
1859
|
|
|
|
|
|
|
=back |
1860
|
|
|
|
|
|
|
|
1861
|
|
|
|
|
|
|
=item C |
1862
|
|
|
|
|
|
|
|
1863
|
|
|
|
|
|
|
Data passed to the C. |
1864
|
|
|
|
|
|
|
|
1865
|
|
|
|
|
|
|
=back |
1866
|
|
|
|
|
|
|
|
1867
|
|
|
|
|
|
|
=head1 Querying SDL Version |
1868
|
|
|
|
|
|
|
|
1869
|
|
|
|
|
|
|
These functions are used to collect or display information about the version of |
1870
|
|
|
|
|
|
|
SDL that is currently being used by the program or that it was compiled |
1871
|
|
|
|
|
|
|
against. |
1872
|
|
|
|
|
|
|
|
1873
|
|
|
|
|
|
|
The version consists of three segments (C) |
1874
|
|
|
|
|
|
|
|
1875
|
|
|
|
|
|
|
=over |
1876
|
|
|
|
|
|
|
|
1877
|
|
|
|
|
|
|
=item X - Major Version, which increments with massive changes, additions, and enhancements |
1878
|
|
|
|
|
|
|
|
1879
|
|
|
|
|
|
|
=item Y - Minor Version, which increments with backwards-compatible changes to the major revision |
1880
|
|
|
|
|
|
|
|
1881
|
|
|
|
|
|
|
=item Z - Patchlevel, which increments with fixes to the minor revision |
1882
|
|
|
|
|
|
|
|
1883
|
|
|
|
|
|
|
=back |
1884
|
|
|
|
|
|
|
|
1885
|
|
|
|
|
|
|
Example: The first version of SDL 2 was 2.0.0 |
1886
|
|
|
|
|
|
|
|
1887
|
|
|
|
|
|
|
The version may also be reported as a 4-digit numeric value where the thousands |
1888
|
|
|
|
|
|
|
place represents the major version, the hundreds place represents the minor |
1889
|
|
|
|
|
|
|
version, and the tens and ones places represent the patchlevel (update |
1890
|
|
|
|
|
|
|
version). |
1891
|
|
|
|
|
|
|
|
1892
|
|
|
|
|
|
|
Example: The first version number of SDL 2 was 2000 |
1893
|
|
|
|
|
|
|
|
1894
|
|
|
|
|
|
|
=head2 C |
1895
|
|
|
|
|
|
|
|
1896
|
|
|
|
|
|
|
Get the version of SDL that is linked against your program. |
1897
|
|
|
|
|
|
|
|
1898
|
|
|
|
|
|
|
my $ver = SDL2::Version->new; |
1899
|
|
|
|
|
|
|
SDL_GetVersion( $ver ); |
1900
|
|
|
|
|
|
|
|
1901
|
|
|
|
|
|
|
This function may be called safely at any time, even before L<< C
|
1902
|
|
|
|
|
|
|
)>|/C >>. |
1903
|
|
|
|
|
|
|
|
1904
|
|
|
|
|
|
|
Expected parameters include: |
1905
|
|
|
|
|
|
|
|
1906
|
|
|
|
|
|
|
=over |
1907
|
|
|
|
|
|
|
|
1908
|
|
|
|
|
|
|
=item C - An SDL2::Version object which will be filled with the proper values |
1909
|
|
|
|
|
|
|
|
1910
|
|
|
|
|
|
|
=back |
1911
|
|
|
|
|
|
|
|
1912
|
|
|
|
|
|
|
=head1 Display and Window Management |
1913
|
|
|
|
|
|
|
|
1914
|
|
|
|
|
|
|
This category contains functions for handling display and window actions. |
1915
|
|
|
|
|
|
|
|
1916
|
|
|
|
|
|
|
These functions may be imported with the C<:video> tag. |
1917
|
|
|
|
|
|
|
|
1918
|
|
|
|
|
|
|
=head2 C |
1919
|
|
|
|
|
|
|
|
1920
|
|
|
|
|
|
|
my $num = SDL_GetNumVideoDrivers( ); |
1921
|
|
|
|
|
|
|
|
1922
|
|
|
|
|
|
|
Get the number of video drivers compiled into SDL. |
1923
|
|
|
|
|
|
|
|
1924
|
|
|
|
|
|
|
Returns a number >= 1 on success or a negative error code on failure; call L<< |
1925
|
|
|
|
|
|
|
C|/C >> for more information. |
1926
|
|
|
|
|
|
|
|
1927
|
|
|
|
|
|
|
=head2 C |
1928
|
|
|
|
|
|
|
|
1929
|
|
|
|
|
|
|
Get the name of a built in video driver. |
1930
|
|
|
|
|
|
|
|
1931
|
|
|
|
|
|
|
CORE::say SDL_GetVideoDriver($_) for 0 .. SDL_GetNumVideoDrivers( ) - 1; |
1932
|
|
|
|
|
|
|
|
1933
|
|
|
|
|
|
|
The video drivers are presented in the order in which they are normally checked |
1934
|
|
|
|
|
|
|
during initialization. |
1935
|
|
|
|
|
|
|
|
1936
|
|
|
|
|
|
|
Expected parameters include: |
1937
|
|
|
|
|
|
|
|
1938
|
|
|
|
|
|
|
=over |
1939
|
|
|
|
|
|
|
|
1940
|
|
|
|
|
|
|
=item C - the index of a video driver |
1941
|
|
|
|
|
|
|
|
1942
|
|
|
|
|
|
|
=back |
1943
|
|
|
|
|
|
|
|
1944
|
|
|
|
|
|
|
Returns the name of the video driver with the given C. |
1945
|
|
|
|
|
|
|
|
1946
|
|
|
|
|
|
|
=cut |
1947
|
|
|
|
|
|
|
|
1948
|
|
|
|
|
|
|
=head2 C |
1949
|
|
|
|
|
|
|
|
1950
|
|
|
|
|
|
|
Initialize the video subsystem, optionally specifying a video driver. |
1951
|
|
|
|
|
|
|
|
1952
|
|
|
|
|
|
|
SDL_VideoInit( 'x11' ); |
1953
|
|
|
|
|
|
|
|
1954
|
|
|
|
|
|
|
This function initializes the video subsystem, setting up a connection to the |
1955
|
|
|
|
|
|
|
window manager, etc, and determines the available display modes and pixel |
1956
|
|
|
|
|
|
|
formats, but does not initialize a window or graphics mode. |
1957
|
|
|
|
|
|
|
|
1958
|
|
|
|
|
|
|
If you use this function and you haven't used the SDL_INIT_VIDEO flag with |
1959
|
|
|
|
|
|
|
either SDL_Init( ) or SDL_InitSubSystem( ), you should call SDL_VideoQuit( ) |
1960
|
|
|
|
|
|
|
before calling SDL_Quit( ). |
1961
|
|
|
|
|
|
|
|
1962
|
|
|
|
|
|
|
It is safe to call this function multiple times. SDL_VideoInit( ) will call |
1963
|
|
|
|
|
|
|
SDL_VideoQuit( ) itself if the video subsystem has already been initialized. |
1964
|
|
|
|
|
|
|
|
1965
|
|
|
|
|
|
|
You can use SDL_GetNumVideoDrivers( ) and SDL_GetVideoDriver( ) to find a |
1966
|
|
|
|
|
|
|
specific `driver_name`. |
1967
|
|
|
|
|
|
|
|
1968
|
|
|
|
|
|
|
Expected parameters include: |
1969
|
|
|
|
|
|
|
|
1970
|
|
|
|
|
|
|
=over |
1971
|
|
|
|
|
|
|
|
1972
|
|
|
|
|
|
|
=item C - the name of a video driver to initialize, or undef for the default driver |
1973
|
|
|
|
|
|
|
|
1974
|
|
|
|
|
|
|
=back |
1975
|
|
|
|
|
|
|
|
1976
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
1977
|
|
|
|
|
|
|
C|/C >> for more information. |
1978
|
|
|
|
|
|
|
|
1979
|
|
|
|
|
|
|
=head2 C |
1980
|
|
|
|
|
|
|
|
1981
|
|
|
|
|
|
|
Shut down the video subsystem, if initialized with L<< C
|
1982
|
|
|
|
|
|
|
)>|/C >>. |
1983
|
|
|
|
|
|
|
|
1984
|
|
|
|
|
|
|
SDL_VideoQuit( ); |
1985
|
|
|
|
|
|
|
|
1986
|
|
|
|
|
|
|
This function closes all windows, and restores the original video mode. |
1987
|
|
|
|
|
|
|
|
1988
|
|
|
|
|
|
|
=head2 C |
1989
|
|
|
|
|
|
|
|
1990
|
|
|
|
|
|
|
Get the name of the currently initialized video driver. |
1991
|
|
|
|
|
|
|
|
1992
|
|
|
|
|
|
|
my $driver = SDL_GetCurrentVideoDriver( ); |
1993
|
|
|
|
|
|
|
|
1994
|
|
|
|
|
|
|
Returns the name of the current video driver or NULL if no driver has been |
1995
|
|
|
|
|
|
|
initialized. |
1996
|
|
|
|
|
|
|
|
1997
|
|
|
|
|
|
|
=head2 C |
1998
|
|
|
|
|
|
|
|
1999
|
|
|
|
|
|
|
Get the number of available video displays. |
2000
|
|
|
|
|
|
|
|
2001
|
|
|
|
|
|
|
my $screens = SDL_GetNumVideoDisplays( ); |
2002
|
|
|
|
|
|
|
|
2003
|
|
|
|
|
|
|
Returns a number >= 1 or a negative error code on failure; call L<< |
2004
|
|
|
|
|
|
|
C|/C >> for more information. |
2005
|
|
|
|
|
|
|
|
2006
|
|
|
|
|
|
|
=head2 C |
2007
|
|
|
|
|
|
|
|
2008
|
|
|
|
|
|
|
|
2009
|
|
|
|
|
|
|
Get the name of a display in UTF-8 encoding. |
2010
|
|
|
|
|
|
|
|
2011
|
|
|
|
|
|
|
my $screen = SDL_GetDisplayName( 0 ); |
2012
|
|
|
|
|
|
|
|
2013
|
|
|
|
|
|
|
Expected parameters include: |
2014
|
|
|
|
|
|
|
|
2015
|
|
|
|
|
|
|
=over |
2016
|
|
|
|
|
|
|
|
2017
|
|
|
|
|
|
|
=item C - the index of display from which the name should be queried |
2018
|
|
|
|
|
|
|
|
2019
|
|
|
|
|
|
|
=back |
2020
|
|
|
|
|
|
|
|
2021
|
|
|
|
|
|
|
Returns the name of a display or undefined for an invalid display index or |
2022
|
|
|
|
|
|
|
failure; call L<< C|/C >> for more |
2023
|
|
|
|
|
|
|
information. |
2024
|
|
|
|
|
|
|
|
2025
|
|
|
|
|
|
|
=head2 C |
2026
|
|
|
|
|
|
|
|
2027
|
|
|
|
|
|
|
Get the desktop area represented by a display. |
2028
|
|
|
|
|
|
|
|
2029
|
|
|
|
|
|
|
my $rect = SDL_GetDisplayBounds( 0 ); |
2030
|
|
|
|
|
|
|
|
2031
|
|
|
|
|
|
|
The primary display (C) is always located at 0,0. |
2032
|
|
|
|
|
|
|
|
2033
|
|
|
|
|
|
|
Expected parameters include: |
2034
|
|
|
|
|
|
|
|
2035
|
|
|
|
|
|
|
=over |
2036
|
|
|
|
|
|
|
|
2037
|
|
|
|
|
|
|
=item C - the index of the display to query |
2038
|
|
|
|
|
|
|
|
2039
|
|
|
|
|
|
|
=back |
2040
|
|
|
|
|
|
|
|
2041
|
|
|
|
|
|
|
Returns the SDL2::Rect structure filled in with the display bounds on success |
2042
|
|
|
|
|
|
|
or a negative error code on failure; call L<< C
|
2043
|
|
|
|
|
|
|
)>|/C >> for more information. |
2044
|
|
|
|
|
|
|
|
2045
|
|
|
|
|
|
|
|
2046
|
|
|
|
|
|
|
=head2 C |
2047
|
|
|
|
|
|
|
|
2048
|
|
|
|
|
|
|
Get the usable desktop area represented by a display. |
2049
|
|
|
|
|
|
|
|
2050
|
|
|
|
|
|
|
my $rect = SDL_GetDisplayUsableBounds( 0 ); |
2051
|
|
|
|
|
|
|
|
2052
|
|
|
|
|
|
|
The primary display (C) is always located at 0,0. |
2053
|
|
|
|
|
|
|
|
2054
|
|
|
|
|
|
|
This is the same area as L<< C
|
2055
|
|
|
|
|
|
|
)>|/C >> reports, but with portions reserved by |
2056
|
|
|
|
|
|
|
the system removed. For example, on Apple's macOS, this subtracts the area |
2057
|
|
|
|
|
|
|
occupied by the menu bar and dock. |
2058
|
|
|
|
|
|
|
|
2059
|
|
|
|
|
|
|
Setting a window to be fullscreen generally bypasses these unusable areas, so |
2060
|
|
|
|
|
|
|
these are good guidelines for the maximum space available to a non-fullscreen |
2061
|
|
|
|
|
|
|
window. |
2062
|
|
|
|
|
|
|
|
2063
|
|
|
|
|
|
|
Expected parameters include: |
2064
|
|
|
|
|
|
|
|
2065
|
|
|
|
|
|
|
=over |
2066
|
|
|
|
|
|
|
|
2067
|
|
|
|
|
|
|
=item C - the index of the display to query |
2068
|
|
|
|
|
|
|
|
2069
|
|
|
|
|
|
|
=back |
2070
|
|
|
|
|
|
|
|
2071
|
|
|
|
|
|
|
Returns the SDL2::Rect structure filled in with the display bounds on success |
2072
|
|
|
|
|
|
|
or a negative error code on failure; call L<< C
|
2073
|
|
|
|
|
|
|
)>|/C >> for more information. This function also returns |
2074
|
|
|
|
|
|
|
C<-1> if the parameter C is out of range. |
2075
|
|
|
|
|
|
|
|
2076
|
|
|
|
|
|
|
=head2 C |
2077
|
|
|
|
|
|
|
|
2078
|
|
|
|
|
|
|
Get the dots/pixels-per-inch for a display. |
2079
|
|
|
|
|
|
|
|
2080
|
|
|
|
|
|
|
my ( $ddpi, $hdpi, $vdpi ) = SDL_GetDisplayDPI( 0 ); |
2081
|
|
|
|
|
|
|
|
2082
|
|
|
|
|
|
|
Diagonal, horizontal and vertical DPI can all be optionally returned if the |
2083
|
|
|
|
|
|
|
appropriate parameter is non-NULL. |
2084
|
|
|
|
|
|
|
|
2085
|
|
|
|
|
|
|
A failure of this function usually means that either no DPI information is |
2086
|
|
|
|
|
|
|
available or the C is out of range. |
2087
|
|
|
|
|
|
|
|
2088
|
|
|
|
|
|
|
Expected parameters include: |
2089
|
|
|
|
|
|
|
|
2090
|
|
|
|
|
|
|
=over |
2091
|
|
|
|
|
|
|
|
2092
|
|
|
|
|
|
|
=item C - the index of the display from which DPI information should be queried |
2093
|
|
|
|
|
|
|
|
2094
|
|
|
|
|
|
|
=back |
2095
|
|
|
|
|
|
|
|
2096
|
|
|
|
|
|
|
Returns C<[ddpi, hdpi, vdip]> on success or a negative error code on failure; |
2097
|
|
|
|
|
|
|
call L<< C|/C >> for more information. |
2098
|
|
|
|
|
|
|
|
2099
|
|
|
|
|
|
|
C is the diagonal DPI of the display, C is the horizontal DPI of |
2100
|
|
|
|
|
|
|
the display, C is the vertical DPI of the display. |
2101
|
|
|
|
|
|
|
|
2102
|
|
|
|
|
|
|
=head2 C |
2103
|
|
|
|
|
|
|
|
2104
|
|
|
|
|
|
|
Get the orientation of a display. |
2105
|
|
|
|
|
|
|
|
2106
|
|
|
|
|
|
|
my $orientation = SDL_GetDisplayOrientation( 0 ); |
2107
|
|
|
|
|
|
|
|
2108
|
|
|
|
|
|
|
Expected parameters include: |
2109
|
|
|
|
|
|
|
|
2110
|
|
|
|
|
|
|
=over |
2111
|
|
|
|
|
|
|
|
2112
|
|
|
|
|
|
|
=item C - the index of the display to query |
2113
|
|
|
|
|
|
|
|
2114
|
|
|
|
|
|
|
=back |
2115
|
|
|
|
|
|
|
|
2116
|
|
|
|
|
|
|
Returns a value which may be imported with C<:displayOrientation> or |
2117
|
|
|
|
|
|
|
C if it isn't available. |
2118
|
|
|
|
|
|
|
|
2119
|
|
|
|
|
|
|
=head2 C |
2120
|
|
|
|
|
|
|
|
2121
|
|
|
|
|
|
|
Get the number of available display modes. |
2122
|
|
|
|
|
|
|
|
2123
|
|
|
|
|
|
|
my $modes = SDL_GetNumDisplayModes( 0 ); |
2124
|
|
|
|
|
|
|
|
2125
|
|
|
|
|
|
|
The C needs to be in the range from C<0> to |
2126
|
|
|
|
|
|
|
C. |
2127
|
|
|
|
|
|
|
|
2128
|
|
|
|
|
|
|
Expected parameters include: |
2129
|
|
|
|
|
|
|
|
2130
|
|
|
|
|
|
|
=over |
2131
|
|
|
|
|
|
|
|
2132
|
|
|
|
|
|
|
=item C - the index of the display to query |
2133
|
|
|
|
|
|
|
|
2134
|
|
|
|
|
|
|
=back |
2135
|
|
|
|
|
|
|
|
2136
|
|
|
|
|
|
|
Returns a number >= 1 on success or a negative error code on failure; call L<< |
2137
|
|
|
|
|
|
|
C|/C >> for more information. |
2138
|
|
|
|
|
|
|
|
2139
|
|
|
|
|
|
|
|
2140
|
|
|
|
|
|
|
=head2 C |
2141
|
|
|
|
|
|
|
|
2142
|
|
|
|
|
|
|
Get information about a specific display mode. |
2143
|
|
|
|
|
|
|
|
2144
|
|
|
|
|
|
|
my $mode = SDL_GetDisplayMode( 0, 0 ); |
2145
|
|
|
|
|
|
|
|
2146
|
|
|
|
|
|
|
The display modes are sorted in this priority: |
2147
|
|
|
|
|
|
|
|
2148
|
|
|
|
|
|
|
=over |
2149
|
|
|
|
|
|
|
|
2150
|
|
|
|
|
|
|
=item width - largest to smallest |
2151
|
|
|
|
|
|
|
|
2152
|
|
|
|
|
|
|
=item height - largest to smallest |
2153
|
|
|
|
|
|
|
|
2154
|
|
|
|
|
|
|
=item bits per pixel - more colors to fewer colors |
2155
|
|
|
|
|
|
|
|
2156
|
|
|
|
|
|
|
=item packed pixel layout - largest to smallest |
2157
|
|
|
|
|
|
|
|
2158
|
|
|
|
|
|
|
=item refresh rate - highest to lowest |
2159
|
|
|
|
|
|
|
|
2160
|
|
|
|
|
|
|
=back |
2161
|
|
|
|
|
|
|
|
2162
|
|
|
|
|
|
|
Expected parameters include: |
2163
|
|
|
|
|
|
|
|
2164
|
|
|
|
|
|
|
=over |
2165
|
|
|
|
|
|
|
|
2166
|
|
|
|
|
|
|
=item C - the index of the display to query |
2167
|
|
|
|
|
|
|
|
2168
|
|
|
|
|
|
|
=item C - the index of the display mode to query |
2169
|
|
|
|
|
|
|
|
2170
|
|
|
|
|
|
|
=back |
2171
|
|
|
|
|
|
|
|
2172
|
|
|
|
|
|
|
Returns an L structure filled in with the mode at |
2173
|
|
|
|
|
|
|
C on success or a negative error code on failure; call L<< |
2174
|
|
|
|
|
|
|
C|/C >> for more information. |
2175
|
|
|
|
|
|
|
|
2176
|
|
|
|
|
|
|
=head2 C |
2177
|
|
|
|
|
|
|
|
2178
|
|
|
|
|
|
|
Get information about the desktop's display mode. |
2179
|
|
|
|
|
|
|
|
2180
|
|
|
|
|
|
|
my $mode = SDL_GetDesktopDisplayMode( 0 ); |
2181
|
|
|
|
|
|
|
|
2182
|
|
|
|
|
|
|
There's a difference between this function and L<< C
|
2183
|
|
|
|
|
|
|
... )>|/C >> when SDL runs fullscreen and has |
2184
|
|
|
|
|
|
|
changed the resolution. In that case this function will return the previous |
2185
|
|
|
|
|
|
|
native display mode, and not the current display mode. |
2186
|
|
|
|
|
|
|
|
2187
|
|
|
|
|
|
|
Expected parameters include: |
2188
|
|
|
|
|
|
|
|
2189
|
|
|
|
|
|
|
=over |
2190
|
|
|
|
|
|
|
|
2191
|
|
|
|
|
|
|
=item C - the index of the display to query |
2192
|
|
|
|
|
|
|
|
2193
|
|
|
|
|
|
|
=back |
2194
|
|
|
|
|
|
|
|
2195
|
|
|
|
|
|
|
Returns an L structure filled in with the current display |
2196
|
|
|
|
|
|
|
mode on success or a negative error code on failure; call L<< C
|
2197
|
|
|
|
|
|
|
)>|/C >> for more information. |
2198
|
|
|
|
|
|
|
|
2199
|
|
|
|
|
|
|
=head2 C |
2200
|
|
|
|
|
|
|
|
2201
|
|
|
|
|
|
|
my $mode = SDL_GetCurrentDisplayMode( 0 ); |
2202
|
|
|
|
|
|
|
|
2203
|
|
|
|
|
|
|
There's a difference between this function and L<< C
|
2204
|
|
|
|
|
|
|
... )>|/C >> when SDL runs fullscreen and has |
2205
|
|
|
|
|
|
|
changed the resolution. In that case this function will return the current |
2206
|
|
|
|
|
|
|
display mode, and not the previous native display mode. |
2207
|
|
|
|
|
|
|
|
2208
|
|
|
|
|
|
|
Expected parameters include: |
2209
|
|
|
|
|
|
|
|
2210
|
|
|
|
|
|
|
=over |
2211
|
|
|
|
|
|
|
|
2212
|
|
|
|
|
|
|
=item C - the index of the display to query |
2213
|
|
|
|
|
|
|
|
2214
|
|
|
|
|
|
|
=back |
2215
|
|
|
|
|
|
|
|
2216
|
|
|
|
|
|
|
Returns an L structure filled in with the current display |
2217
|
|
|
|
|
|
|
mode on success or a negative error code on failure; call L<< C
|
2218
|
|
|
|
|
|
|
)>|/C >> for more information. |
2219
|
|
|
|
|
|
|
|
2220
|
|
|
|
|
|
|
=head2 C |
2221
|
|
|
|
|
|
|
|
2222
|
|
|
|
|
|
|
Get the closes match to the requested display mode. |
2223
|
|
|
|
|
|
|
|
2224
|
|
|
|
|
|
|
$mode = SDL_GetClosestDisplayMode( 0, $mode ); |
2225
|
|
|
|
|
|
|
|
2226
|
|
|
|
|
|
|
The available display modes are scanned and he closest mode matching the |
2227
|
|
|
|
|
|
|
requested mode is returned. The mode format and refresh rate default to the |
2228
|
|
|
|
|
|
|
desktop mode if they are set to 0. The modes are scanned with size being first |
2229
|
|
|
|
|
|
|
priority, format being second priority, and finally checking the refresh rate. |
2230
|
|
|
|
|
|
|
If all the available modes are too small, then an undefined value is returned. |
2231
|
|
|
|
|
|
|
|
2232
|
|
|
|
|
|
|
Expected parameters include: |
2233
|
|
|
|
|
|
|
|
2234
|
|
|
|
|
|
|
=over |
2235
|
|
|
|
|
|
|
|
2236
|
|
|
|
|
|
|
=item C - index of the display to query |
2237
|
|
|
|
|
|
|
|
2238
|
|
|
|
|
|
|
=item C - an L structure containing the desired display mode |
2239
|
|
|
|
|
|
|
|
2240
|
|
|
|
|
|
|
=item C - an L structure filled in with the closest match of the available display modes |
2241
|
|
|
|
|
|
|
|
2242
|
|
|
|
|
|
|
=back |
2243
|
|
|
|
|
|
|
|
2244
|
|
|
|
|
|
|
Returns the passed in value C or an undefined value if no matching |
2245
|
|
|
|
|
|
|
video mode was available; call L<< C|/C >> |
2246
|
|
|
|
|
|
|
for more information. |
2247
|
|
|
|
|
|
|
|
2248
|
|
|
|
|
|
|
=head2 C |
2249
|
|
|
|
|
|
|
|
2250
|
|
|
|
|
|
|
Get the index of the display associated with a window. |
2251
|
|
|
|
|
|
|
|
2252
|
|
|
|
|
|
|
my $index = SDL_GetWindowDisplayIndex( $window ); |
2253
|
|
|
|
|
|
|
|
2254
|
|
|
|
|
|
|
Expected parameters include: |
2255
|
|
|
|
|
|
|
|
2256
|
|
|
|
|
|
|
=over |
2257
|
|
|
|
|
|
|
|
2258
|
|
|
|
|
|
|
=item C - the window to query |
2259
|
|
|
|
|
|
|
|
2260
|
|
|
|
|
|
|
=back |
2261
|
|
|
|
|
|
|
|
2262
|
|
|
|
|
|
|
Returns the index of the display containing the center of the window on success |
2263
|
|
|
|
|
|
|
or a negative error code on failure; call L<< C
|
2264
|
|
|
|
|
|
|
)>|/C >> for more information. |
2265
|
|
|
|
|
|
|
|
2266
|
|
|
|
|
|
|
=head2 C |
2267
|
|
|
|
|
|
|
|
2268
|
|
|
|
|
|
|
Set the display mode to use when a window is visible at fullscreen. |
2269
|
|
|
|
|
|
|
|
2270
|
|
|
|
|
|
|
my $ok = !SDL_SetWindowDisplayMode( $window, $mode ); |
2271
|
|
|
|
|
|
|
|
2272
|
|
|
|
|
|
|
This only affects the display mode used when the window is fullscreen. To |
2273
|
|
|
|
|
|
|
change the window size when the window is not fullscreen, use L<< |
2274
|
|
|
|
|
|
|
C|/C >>. |
2275
|
|
|
|
|
|
|
|
2276
|
|
|
|
|
|
|
=head2 C |
2277
|
|
|
|
|
|
|
|
2278
|
|
|
|
|
|
|
Query the display mode to use when a window is visible at fullscreen. |
2279
|
|
|
|
|
|
|
|
2280
|
|
|
|
|
|
|
my $mode = SDL_GetWindowDisplayMode( $window ); |
2281
|
|
|
|
|
|
|
|
2282
|
|
|
|
|
|
|
Expected parameters include: |
2283
|
|
|
|
|
|
|
|
2284
|
|
|
|
|
|
|
=over |
2285
|
|
|
|
|
|
|
|
2286
|
|
|
|
|
|
|
=item C - the window to query |
2287
|
|
|
|
|
|
|
|
2288
|
|
|
|
|
|
|
=back |
2289
|
|
|
|
|
|
|
|
2290
|
|
|
|
|
|
|
Returns a L structure on success or a negative error code on |
2291
|
|
|
|
|
|
|
failure; call L<< C|/C >> for more |
2292
|
|
|
|
|
|
|
information. |
2293
|
|
|
|
|
|
|
|
2294
|
|
|
|
|
|
|
=head2 C |
2295
|
|
|
|
|
|
|
|
2296
|
|
|
|
|
|
|
Get the pixel format associated with the window. |
2297
|
|
|
|
|
|
|
|
2298
|
|
|
|
|
|
|
my $format = SDL_GetWindowPixelFormat( $window ); |
2299
|
|
|
|
|
|
|
|
2300
|
|
|
|
|
|
|
Expected parameters include: |
2301
|
|
|
|
|
|
|
|
2302
|
|
|
|
|
|
|
=over |
2303
|
|
|
|
|
|
|
|
2304
|
|
|
|
|
|
|
=item C - the window to query |
2305
|
|
|
|
|
|
|
|
2306
|
|
|
|
|
|
|
=back |
2307
|
|
|
|
|
|
|
|
2308
|
|
|
|
|
|
|
Returns the pixel format of the window on success or C |
2309
|
|
|
|
|
|
|
on failure; call L<< C|/C >> for more |
2310
|
|
|
|
|
|
|
information. |
2311
|
|
|
|
|
|
|
|
2312
|
|
|
|
|
|
|
=head2 C |
2313
|
|
|
|
|
|
|
|
2314
|
|
|
|
|
|
|
Create a window with the specified position, dimensions, and flags. |
2315
|
|
|
|
|
|
|
|
2316
|
|
|
|
|
|
|
my $window = SDL_CreateWindow( 'Example', |
2317
|
|
|
|
|
|
|
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, |
2318
|
|
|
|
|
|
|
1280, 720, |
2319
|
|
|
|
|
|
|
SDL_WINDOW_SHOWN |
2320
|
|
|
|
|
|
|
); |
2321
|
|
|
|
|
|
|
|
2322
|
|
|
|
|
|
|
C may be any of the following OR'd together: |
2323
|
|
|
|
|
|
|
|
2324
|
|
|
|
|
|
|
=over |
2325
|
|
|
|
|
|
|
|
2326
|
|
|
|
|
|
|
=item C - fullscreen window |
2327
|
|
|
|
|
|
|
|
2328
|
|
|
|
|
|
|
=item C - fullscreen window at desktop resolution |
2329
|
|
|
|
|
|
|
|
2330
|
|
|
|
|
|
|
=item C - window usable with an OpenGL context |
2331
|
|
|
|
|
|
|
|
2332
|
|
|
|
|
|
|
=item C - window usable with a Vulkan instance |
2333
|
|
|
|
|
|
|
|
2334
|
|
|
|
|
|
|
=item C - window usable with a Metal instance |
2335
|
|
|
|
|
|
|
|
2336
|
|
|
|
|
|
|
=item C - window is not visible |
2337
|
|
|
|
|
|
|
|
2338
|
|
|
|
|
|
|
=item C - no window decoration |
2339
|
|
|
|
|
|
|
|
2340
|
|
|
|
|
|
|
=item C - window can be resized |
2341
|
|
|
|
|
|
|
|
2342
|
|
|
|
|
|
|
=item C - window is minimized |
2343
|
|
|
|
|
|
|
|
2344
|
|
|
|
|
|
|
=item C - window is maximized |
2345
|
|
|
|
|
|
|
|
2346
|
|
|
|
|
|
|
=item C - window has grabbed input focus |
2347
|
|
|
|
|
|
|
|
2348
|
|
|
|
|
|
|
=item C - window should be created in high-DPI mode if supported (>= SDL 2.0.1) |
2349
|
|
|
|
|
|
|
|
2350
|
|
|
|
|
|
|
=back |
2351
|
|
|
|
|
|
|
|
2352
|
|
|
|
|
|
|
C is ignored by C. The SDL_Window is |
2353
|
|
|
|
|
|
|
implicitly shown if C is not set. C may be |
2354
|
|
|
|
|
|
|
queried later using L<< C|/C
|
2355
|
|
|
|
|
|
|
)> >>. |
2356
|
|
|
|
|
|
|
|
2357
|
|
|
|
|
|
|
On Apple's macOS, you B set the NSHighResolutionCapable Info.plist |
2358
|
|
|
|
|
|
|
property to YES, otherwise you will not receive a High-DPI OpenGL canvas. |
2359
|
|
|
|
|
|
|
|
2360
|
|
|
|
|
|
|
If the window is created with the C flag, its size in |
2361
|
|
|
|
|
|
|
pixels may differ from its size in screen coordinates on platforms with |
2362
|
|
|
|
|
|
|
high-DPI support (e.g. iOS and macOS). Use L<< C
|
2363
|
|
|
|
|
|
|
)>|/C >> to query the client area's size in screen |
2364
|
|
|
|
|
|
|
coordinates, and L<< C|/C |
2365
|
|
|
|
|
|
|
>> or L<< C|/C >> |
2366
|
|
|
|
|
|
|
to query the drawable size in pixels. |
2367
|
|
|
|
|
|
|
|
2368
|
|
|
|
|
|
|
If the window is set fullscreen, the width and height parameters C and C |
2369
|
|
|
|
|
|
|
will not be used. However, invalid size parameters (e.g. too large) may still |
2370
|
|
|
|
|
|
|
fail. Window size is actually limited to 16384 x 16384 for all platforms at |
2371
|
|
|
|
|
|
|
window creation. |
2372
|
|
|
|
|
|
|
|
2373
|
|
|
|
|
|
|
If the window is created with any of the C or |
2374
|
|
|
|
|
|
|
C flags, then the corresponding LoadLibrary function |
2375
|
|
|
|
|
|
|
(SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the corresponding |
2376
|
|
|
|
|
|
|
UnloadLibrary function is called by L<< C
|
2377
|
|
|
|
|
|
|
)>|/C >>. |
2378
|
|
|
|
|
|
|
|
2379
|
|
|
|
|
|
|
If C is specified and there isn't a working Vulkan driver, |
2380
|
|
|
|
|
|
|
C will fail because L<< C
|
2381
|
|
|
|
|
|
|
)>|/C >> will fail. |
2382
|
|
|
|
|
|
|
|
2383
|
|
|
|
|
|
|
If C is specified on an OS that does not support Metal, |
2384
|
|
|
|
|
|
|
C will fail. |
2385
|
|
|
|
|
|
|
|
2386
|
|
|
|
|
|
|
On non-Apple devices, SDL requires you to either not link to the Vulkan loader |
2387
|
|
|
|
|
|
|
or link to a dynamic library version. This limitation may be removed in a |
2388
|
|
|
|
|
|
|
future version of SDL. |
2389
|
|
|
|
|
|
|
|
2390
|
|
|
|
|
|
|
Expected parameters include: |
2391
|
|
|
|
|
|
|
|
2392
|
|
|
|
|
|
|
=over |
2393
|
|
|
|
|
|
|
|
2394
|
|
|
|
|
|
|
=item C - the title of the window, in UTF-8 encoding |
2395
|
|
|
|
|
|
|
|
2396
|
|
|
|
|
|
|
=item C - the x position of the window, C, or C |
2397
|
|
|
|
|
|
|
|
2398
|
|
|
|
|
|
|
=item C - the y position of the window, C, or C |
2399
|
|
|
|
|
|
|
|
2400
|
|
|
|
|
|
|
=item C - the width of the window, in screen coordinates |
2401
|
|
|
|
|
|
|
|
2402
|
|
|
|
|
|
|
=item C - the height of the window, in screen coordinates |
2403
|
|
|
|
|
|
|
|
2404
|
|
|
|
|
|
|
=item C - 0, or one or more L<< C<:windowFlags>|SDL2::Enum/C<:windowFlags> >> OR'd together |
2405
|
|
|
|
|
|
|
|
2406
|
|
|
|
|
|
|
=back |
2407
|
|
|
|
|
|
|
|
2408
|
|
|
|
|
|
|
Returns the window that was created or an undefined value on failure; call L<< |
2409
|
|
|
|
|
|
|
C|/C >> for more information. |
2410
|
|
|
|
|
|
|
|
2411
|
|
|
|
|
|
|
|
2412
|
|
|
|
|
|
|
=head2 C |
2413
|
|
|
|
|
|
|
|
2414
|
|
|
|
|
|
|
Create an SDL window from an existing native window. |
2415
|
|
|
|
|
|
|
|
2416
|
|
|
|
|
|
|
my $window = SDL_CreateWindowFrom( $data ); |
2417
|
|
|
|
|
|
|
|
2418
|
|
|
|
|
|
|
In some cases (e.g. OpenGL) and on some platforms (e.g. Microsoft Windows) the |
2419
|
|
|
|
|
|
|
hint C needs to be configured before |
2420
|
|
|
|
|
|
|
using C. |
2421
|
|
|
|
|
|
|
|
2422
|
|
|
|
|
|
|
Expected parameters include: |
2423
|
|
|
|
|
|
|
|
2424
|
|
|
|
|
|
|
=over |
2425
|
|
|
|
|
|
|
|
2426
|
|
|
|
|
|
|
=item C - driver-dependant window creation data, typically your native window |
2427
|
|
|
|
|
|
|
|
2428
|
|
|
|
|
|
|
=back |
2429
|
|
|
|
|
|
|
|
2430
|
|
|
|
|
|
|
Returns the window that was created or an undefined value on failure; call L<< |
2431
|
|
|
|
|
|
|
C|/C >> for more information. |
2432
|
|
|
|
|
|
|
|
2433
|
|
|
|
|
|
|
=head2 C |
2434
|
|
|
|
|
|
|
|
2435
|
|
|
|
|
|
|
Get the numeric ID of a window. |
2436
|
|
|
|
|
|
|
|
2437
|
|
|
|
|
|
|
my $id = SDL_GetWindowID( $window ); |
2438
|
|
|
|
|
|
|
|
2439
|
|
|
|
|
|
|
The numeric ID is what L references, and is necessary to map |
2440
|
|
|
|
|
|
|
these events to specific L objects. |
2441
|
|
|
|
|
|
|
|
2442
|
|
|
|
|
|
|
Expected parameters include: |
2443
|
|
|
|
|
|
|
|
2444
|
|
|
|
|
|
|
=over |
2445
|
|
|
|
|
|
|
|
2446
|
|
|
|
|
|
|
=item C - the window to query |
2447
|
|
|
|
|
|
|
|
2448
|
|
|
|
|
|
|
=back |
2449
|
|
|
|
|
|
|
|
2450
|
|
|
|
|
|
|
Returns the ID of the window on success or C<0> on failure; call L<< |
2451
|
|
|
|
|
|
|
C|/C >> for more information. |
2452
|
|
|
|
|
|
|
|
2453
|
|
|
|
|
|
|
=head2 C |
2454
|
|
|
|
|
|
|
|
2455
|
|
|
|
|
|
|
Get a window from a stored ID. |
2456
|
|
|
|
|
|
|
|
2457
|
|
|
|
|
|
|
my $window = SDL_GetWindowFromID( 2 ); |
2458
|
|
|
|
|
|
|
|
2459
|
|
|
|
|
|
|
The numeric ID is what L references, and is necessary to map |
2460
|
|
|
|
|
|
|
these events to specific L objects. |
2461
|
|
|
|
|
|
|
|
2462
|
|
|
|
|
|
|
Expected parameters include: |
2463
|
|
|
|
|
|
|
|
2464
|
|
|
|
|
|
|
=over |
2465
|
|
|
|
|
|
|
|
2466
|
|
|
|
|
|
|
=item C - the ID of the window |
2467
|
|
|
|
|
|
|
|
2468
|
|
|
|
|
|
|
=back |
2469
|
|
|
|
|
|
|
|
2470
|
|
|
|
|
|
|
Returns the window associated with C or an undefined value if it doesn't |
2471
|
|
|
|
|
|
|
exist; call L<< C|/C >> for more information. |
2472
|
|
|
|
|
|
|
|
2473
|
|
|
|
|
|
|
=head2 C |
2474
|
|
|
|
|
|
|
|
2475
|
|
|
|
|
|
|
Get the window flags. |
2476
|
|
|
|
|
|
|
|
2477
|
|
|
|
|
|
|
my $id = SDL_GetWindowFlags( $window ); |
2478
|
|
|
|
|
|
|
|
2479
|
|
|
|
|
|
|
The numeric ID is what L references, and is necessary to map |
2480
|
|
|
|
|
|
|
these events to specific L objects. |
2481
|
|
|
|
|
|
|
|
2482
|
|
|
|
|
|
|
Expected parameters include: |
2483
|
|
|
|
|
|
|
|
2484
|
|
|
|
|
|
|
=over |
2485
|
|
|
|
|
|
|
|
2486
|
|
|
|
|
|
|
=item C - the window to query |
2487
|
|
|
|
|
|
|
|
2488
|
|
|
|
|
|
|
=back |
2489
|
|
|
|
|
|
|
|
2490
|
|
|
|
|
|
|
Returns a mask of the L<< C<:windowFlags>|SDL2::Enum/C<:windowFlags> >> |
2491
|
|
|
|
|
|
|
associated with C. |
2492
|
|
|
|
|
|
|
|
2493
|
|
|
|
|
|
|
=head2 C |
2494
|
|
|
|
|
|
|
|
2495
|
|
|
|
|
|
|
Set the title of a window. |
2496
|
|
|
|
|
|
|
|
2497
|
|
|
|
|
|
|
SDL_SetWindowTitle( $window, 'Untitle file *' ); |
2498
|
|
|
|
|
|
|
|
2499
|
|
|
|
|
|
|
This string is expected to be in UTF-8 encoding. |
2500
|
|
|
|
|
|
|
|
2501
|
|
|
|
|
|
|
Expected parameters include: |
2502
|
|
|
|
|
|
|
|
2503
|
|
|
|
|
|
|
=over |
2504
|
|
|
|
|
|
|
|
2505
|
|
|
|
|
|
|
=item C - the window to change |
2506
|
|
|
|
|
|
|
|
2507
|
|
|
|
|
|
|
=item C - the desired window title in UTF-8 format |
2508
|
|
|
|
|
|
|
|
2509
|
|
|
|
|
|
|
=back |
2510
|
|
|
|
|
|
|
|
2511
|
|
|
|
|
|
|
=head2 C |
2512
|
|
|
|
|
|
|
|
2513
|
|
|
|
|
|
|
Get the title of a window. |
2514
|
|
|
|
|
|
|
|
2515
|
|
|
|
|
|
|
my $title = SDL_GetWindowTitle( $window ); |
2516
|
|
|
|
|
|
|
|
2517
|
|
|
|
|
|
|
Expected parameters include: |
2518
|
|
|
|
|
|
|
|
2519
|
|
|
|
|
|
|
=over |
2520
|
|
|
|
|
|
|
|
2521
|
|
|
|
|
|
|
=item C - the window to query |
2522
|
|
|
|
|
|
|
|
2523
|
|
|
|
|
|
|
=back |
2524
|
|
|
|
|
|
|
|
2525
|
|
|
|
|
|
|
Returns the title of the window in UTF-8 format or C<""> (an empty string) if |
2526
|
|
|
|
|
|
|
there is no title. |
2527
|
|
|
|
|
|
|
|
2528
|
|
|
|
|
|
|
=head2 C |
2529
|
|
|
|
|
|
|
|
2530
|
|
|
|
|
|
|
Set the icon for a window. |
2531
|
|
|
|
|
|
|
|
2532
|
|
|
|
|
|
|
SDL_SetWindowIcon( $window, $icon ); |
2533
|
|
|
|
|
|
|
|
2534
|
|
|
|
|
|
|
Expected parameters include: |
2535
|
|
|
|
|
|
|
|
2536
|
|
|
|
|
|
|
=over |
2537
|
|
|
|
|
|
|
|
2538
|
|
|
|
|
|
|
=item C - the window to change |
2539
|
|
|
|
|
|
|
|
2540
|
|
|
|
|
|
|
=item C - an L structure containing the icon for the window |
2541
|
|
|
|
|
|
|
|
2542
|
|
|
|
|
|
|
=back |
2543
|
|
|
|
|
|
|
|
2544
|
|
|
|
|
|
|
=head2 C |
2545
|
|
|
|
|
|
|
|
2546
|
|
|
|
|
|
|
Associate an arbitrary named pointer with a window. |
2547
|
|
|
|
|
|
|
|
2548
|
|
|
|
|
|
|
my $prev = SDL_SetWindowData( $window, 'test', $data ); |
2549
|
|
|
|
|
|
|
|
2550
|
|
|
|
|
|
|
Expected parameters include: |
2551
|
|
|
|
|
|
|
|
2552
|
|
|
|
|
|
|
=over |
2553
|
|
|
|
|
|
|
|
2554
|
|
|
|
|
|
|
=item C - the window to change |
2555
|
|
|
|
|
|
|
|
2556
|
|
|
|
|
|
|
=item C - the name of the pointer |
2557
|
|
|
|
|
|
|
|
2558
|
|
|
|
|
|
|
=item C - the associated pointer |
2559
|
|
|
|
|
|
|
|
2560
|
|
|
|
|
|
|
=back |
2561
|
|
|
|
|
|
|
|
2562
|
|
|
|
|
|
|
Returns the previous value associated with C. |
2563
|
|
|
|
|
|
|
|
2564
|
|
|
|
|
|
|
|
2565
|
|
|
|
|
|
|
=head2 C |
2566
|
|
|
|
|
|
|
|
2567
|
|
|
|
|
|
|
Retrieve the data pointer associated with a window. |
2568
|
|
|
|
|
|
|
|
2569
|
|
|
|
|
|
|
my $data = SDL_SetWindowData( $window, 'test' ); |
2570
|
|
|
|
|
|
|
|
2571
|
|
|
|
|
|
|
Expected parameters include: |
2572
|
|
|
|
|
|
|
|
2573
|
|
|
|
|
|
|
=over |
2574
|
|
|
|
|
|
|
|
2575
|
|
|
|
|
|
|
=item C - the window to query |
2576
|
|
|
|
|
|
|
|
2577
|
|
|
|
|
|
|
=item C - the name of the pointer |
2578
|
|
|
|
|
|
|
|
2579
|
|
|
|
|
|
|
=back |
2580
|
|
|
|
|
|
|
|
2581
|
|
|
|
|
|
|
Returns the value associated with C. |
2582
|
|
|
|
|
|
|
|
2583
|
|
|
|
|
|
|
=head2 C |
2584
|
|
|
|
|
|
|
|
2585
|
|
|
|
|
|
|
Set the position of a window. |
2586
|
|
|
|
|
|
|
|
2587
|
|
|
|
|
|
|
SDL_SetWindowPosition( $window, 100, 100 ); |
2588
|
|
|
|
|
|
|
|
2589
|
|
|
|
|
|
|
The window coordinate origin is the upper left of the display. |
2590
|
|
|
|
|
|
|
|
2591
|
|
|
|
|
|
|
Expected parameters include: |
2592
|
|
|
|
|
|
|
|
2593
|
|
|
|
|
|
|
=over |
2594
|
|
|
|
|
|
|
|
2595
|
|
|
|
|
|
|
=item C - the window to reposition |
2596
|
|
|
|
|
|
|
|
2597
|
|
|
|
|
|
|
=item C - the x coordinate of the window in screen coordinates, or C or C |
2598
|
|
|
|
|
|
|
|
2599
|
|
|
|
|
|
|
=item C - the y coordinate of the window in screen coordinates, or C or C |
2600
|
|
|
|
|
|
|
|
2601
|
|
|
|
|
|
|
=back |
2602
|
|
|
|
|
|
|
|
2603
|
|
|
|
|
|
|
=head2 C |
2604
|
|
|
|
|
|
|
|
2605
|
|
|
|
|
|
|
Get the position of a window. |
2606
|
|
|
|
|
|
|
|
2607
|
|
|
|
|
|
|
my ($x, $y) = SDL_GetWindowPosition( $window ); |
2608
|
|
|
|
|
|
|
|
2609
|
|
|
|
|
|
|
Expected parameters include: |
2610
|
|
|
|
|
|
|
|
2611
|
|
|
|
|
|
|
=over |
2612
|
|
|
|
|
|
|
|
2613
|
|
|
|
|
|
|
=item C - the window to query |
2614
|
|
|
|
|
|
|
|
2615
|
|
|
|
|
|
|
=back |
2616
|
|
|
|
|
|
|
|
2617
|
|
|
|
|
|
|
Returns the C and C positions of the window, in screen coordinates, |
2618
|
|
|
|
|
|
|
either of which may be undefined. |
2619
|
|
|
|
|
|
|
|
2620
|
|
|
|
|
|
|
=head2 C |
2621
|
|
|
|
|
|
|
|
2622
|
|
|
|
|
|
|
Set the size of a window's client area. |
2623
|
|
|
|
|
|
|
|
2624
|
|
|
|
|
|
|
SDL_SetWindowSize( $window, 100, 100 ); |
2625
|
|
|
|
|
|
|
|
2626
|
|
|
|
|
|
|
The window size in screen coordinates may differ from the size in pixels, if |
2627
|
|
|
|
|
|
|
the window was created with C on a platform with |
2628
|
|
|
|
|
|
|
high-dpi support (e.g. iOS or macOS). Use L<< C
|
2629
|
|
|
|
|
|
|
)>|C >> or L<< C
|
2630
|
|
|
|
|
|
|
)>|/C >> to get the real client area size in |
2631
|
|
|
|
|
|
|
pixels. |
2632
|
|
|
|
|
|
|
|
2633
|
|
|
|
|
|
|
Fullscreen windows automatically match the size of the display mode, and you |
2634
|
|
|
|
|
|
|
should use L<< C|/C
|
2635
|
|
|
|
|
|
|
... )> >> to change their size. |
2636
|
|
|
|
|
|
|
|
2637
|
|
|
|
|
|
|
Expected parameters include: |
2638
|
|
|
|
|
|
|
|
2639
|
|
|
|
|
|
|
=over |
2640
|
|
|
|
|
|
|
|
2641
|
|
|
|
|
|
|
=item C - the window to change |
2642
|
|
|
|
|
|
|
|
2643
|
|
|
|
|
|
|
=item C - the width of the window in pixels, in screen coordinates, must be > 0 |
2644
|
|
|
|
|
|
|
|
2645
|
|
|
|
|
|
|
=item C - the height of the window in pixels, in screen coordinates, must be > 0 |
2646
|
|
|
|
|
|
|
|
2647
|
|
|
|
|
|
|
=back |
2648
|
|
|
|
|
|
|
|
2649
|
|
|
|
|
|
|
=head2 C |
2650
|
|
|
|
|
|
|
|
2651
|
|
|
|
|
|
|
Get the position of a window. |
2652
|
|
|
|
|
|
|
|
2653
|
|
|
|
|
|
|
my ($w, $h) = SDL_GetWindowSize( $window ); |
2654
|
|
|
|
|
|
|
|
2655
|
|
|
|
|
|
|
The window size in screen coordinates may differ from the size in pixels, if |
2656
|
|
|
|
|
|
|
the window was created with C on a platform with |
2657
|
|
|
|
|
|
|
high-dpi support (e.g. iOS or macOS). Use L<< C
|
2658
|
|
|
|
|
|
|
)>|C >>, L<< C
|
2659
|
|
|
|
|
|
|
)>|/C >>, or L<< |
2660
|
|
|
|
|
|
|
C|/C >> to |
2661
|
|
|
|
|
|
|
get the real client area size in pixels. |
2662
|
|
|
|
|
|
|
|
2663
|
|
|
|
|
|
|
Expected parameters include: |
2664
|
|
|
|
|
|
|
|
2665
|
|
|
|
|
|
|
=over |
2666
|
|
|
|
|
|
|
|
2667
|
|
|
|
|
|
|
=item C - the window to query the width and height from |
2668
|
|
|
|
|
|
|
|
2669
|
|
|
|
|
|
|
=back |
2670
|
|
|
|
|
|
|
|
2671
|
|
|
|
|
|
|
Returns the C and C of the window, in screen coordinates, either |
2672
|
|
|
|
|
|
|
of which may be undefined. |
2673
|
|
|
|
|
|
|
|
2674
|
|
|
|
|
|
|
=head2 C |
2675
|
|
|
|
|
|
|
|
2676
|
|
|
|
|
|
|
Get the size of a window's borders (decorations) around the client area. |
2677
|
|
|
|
|
|
|
|
2678
|
|
|
|
|
|
|
my ($top, $left, $bottom, $right) = SDL_GetWindowBorderSize( $window ); |
2679
|
|
|
|
|
|
|
|
2680
|
|
|
|
|
|
|
Expected parameters include: |
2681
|
|
|
|
|
|
|
|
2682
|
|
|
|
|
|
|
=over |
2683
|
|
|
|
|
|
|
|
2684
|
|
|
|
|
|
|
=item C - the window to query the size values of the border (decorations) from |
2685
|
|
|
|
|
|
|
|
2686
|
|
|
|
|
|
|
=back |
2687
|
|
|
|
|
|
|
|
2688
|
|
|
|
|
|
|
Returns the C, C, C, and C size values, any of which |
2689
|
|
|
|
|
|
|
may be undefined. |
2690
|
|
|
|
|
|
|
|
2691
|
|
|
|
|
|
|
Note: If this function fails (returns -1), the size values will be initialized |
2692
|
|
|
|
|
|
|
to C<0, 0, 0, 0>, as if the window in question was borderless. |
2693
|
|
|
|
|
|
|
|
2694
|
|
|
|
|
|
|
Note: This function may fail on systems where the window has not yet been |
2695
|
|
|
|
|
|
|
decorated by the display server (for example, immediately after calling L<< |
2696
|
|
|
|
|
|
|
C|/C >> ). It is |
2697
|
|
|
|
|
|
|
recommended that you wait at least until the window has been presented and |
2698
|
|
|
|
|
|
|
composited, so that the window system has a chance to decorate the window and |
2699
|
|
|
|
|
|
|
provide the border dimensions to SDL. |
2700
|
|
|
|
|
|
|
|
2701
|
|
|
|
|
|
|
This function also returns C<-1> if getting the information is not supported. |
2702
|
|
|
|
|
|
|
|
2703
|
|
|
|
|
|
|
=head2 C |
2704
|
|
|
|
|
|
|
|
2705
|
|
|
|
|
|
|
Set the minimum size of a window's client area. |
2706
|
|
|
|
|
|
|
|
2707
|
|
|
|
|
|
|
SDL_SetWindowMinimumSize( $window, 100, 100 ); |
2708
|
|
|
|
|
|
|
|
2709
|
|
|
|
|
|
|
Expected parameters include: |
2710
|
|
|
|
|
|
|
|
2711
|
|
|
|
|
|
|
=over |
2712
|
|
|
|
|
|
|
|
2713
|
|
|
|
|
|
|
=item C - the window to change |
2714
|
|
|
|
|
|
|
|
2715
|
|
|
|
|
|
|
=item C - the minimum width of the window in pixels |
2716
|
|
|
|
|
|
|
|
2717
|
|
|
|
|
|
|
=item C - the minimum height of the window in pixels |
2718
|
|
|
|
|
|
|
|
2719
|
|
|
|
|
|
|
=back |
2720
|
|
|
|
|
|
|
|
2721
|
|
|
|
|
|
|
=head2 C |
2722
|
|
|
|
|
|
|
|
2723
|
|
|
|
|
|
|
Get the minimum size of a window's client area. |
2724
|
|
|
|
|
|
|
|
2725
|
|
|
|
|
|
|
my ($w, $h) = SDL_GetWindowMinimumSize( $window ); |
2726
|
|
|
|
|
|
|
|
2727
|
|
|
|
|
|
|
Expected parameters include: |
2728
|
|
|
|
|
|
|
|
2729
|
|
|
|
|
|
|
=over |
2730
|
|
|
|
|
|
|
|
2731
|
|
|
|
|
|
|
=item C - the window to query the minimum width and minimum height from |
2732
|
|
|
|
|
|
|
|
2733
|
|
|
|
|
|
|
=back |
2734
|
|
|
|
|
|
|
|
2735
|
|
|
|
|
|
|
Returns the minimum C and minimum C of the window, either of |
2736
|
|
|
|
|
|
|
which may be undefined. |
2737
|
|
|
|
|
|
|
|
2738
|
|
|
|
|
|
|
=head2 C |
2739
|
|
|
|
|
|
|
|
2740
|
|
|
|
|
|
|
Set the maximum size of a window's client area. |
2741
|
|
|
|
|
|
|
|
2742
|
|
|
|
|
|
|
SDL_SetWindowMaximumSize( $window, 100, 100 ); |
2743
|
|
|
|
|
|
|
|
2744
|
|
|
|
|
|
|
Expected parameters include: |
2745
|
|
|
|
|
|
|
|
2746
|
|
|
|
|
|
|
=over |
2747
|
|
|
|
|
|
|
|
2748
|
|
|
|
|
|
|
=item C - the window to change |
2749
|
|
|
|
|
|
|
|
2750
|
|
|
|
|
|
|
=item C - the maximum width of the window in pixels |
2751
|
|
|
|
|
|
|
|
2752
|
|
|
|
|
|
|
=item C - the maximum height of the window in pixels |
2753
|
|
|
|
|
|
|
|
2754
|
|
|
|
|
|
|
=back |
2755
|
|
|
|
|
|
|
|
2756
|
|
|
|
|
|
|
=head2 C |
2757
|
|
|
|
|
|
|
|
2758
|
|
|
|
|
|
|
Get the maximum size of a window's client area. |
2759
|
|
|
|
|
|
|
|
2760
|
|
|
|
|
|
|
my ($w, $h) = SDL_GetWindowMaximumSize( $window ); |
2761
|
|
|
|
|
|
|
|
2762
|
|
|
|
|
|
|
Expected parameters include: |
2763
|
|
|
|
|
|
|
|
2764
|
|
|
|
|
|
|
=over |
2765
|
|
|
|
|
|
|
|
2766
|
|
|
|
|
|
|
=item C - the window to query the maximum width and maximum height from |
2767
|
|
|
|
|
|
|
|
2768
|
|
|
|
|
|
|
=back |
2769
|
|
|
|
|
|
|
|
2770
|
|
|
|
|
|
|
Returns the maximum C and maximum C of the window, either of |
2771
|
|
|
|
|
|
|
which may be undefined. |
2772
|
|
|
|
|
|
|
|
2773
|
|
|
|
|
|
|
=head2 C |
2774
|
|
|
|
|
|
|
|
2775
|
|
|
|
|
|
|
Set the border state of a window. |
2776
|
|
|
|
|
|
|
|
2777
|
|
|
|
|
|
|
SDL_SetWindowBordered( $window, 1 ); |
2778
|
|
|
|
|
|
|
|
2779
|
|
|
|
|
|
|
This will add or remove the window's C flag and add or |
2780
|
|
|
|
|
|
|
remove the border from the actual window. This is a no-op if the window's |
2781
|
|
|
|
|
|
|
border already matches the requested state. |
2782
|
|
|
|
|
|
|
|
2783
|
|
|
|
|
|
|
You can't change the border state of a fullscreen window. |
2784
|
|
|
|
|
|
|
|
2785
|
|
|
|
|
|
|
Expected parameters include: |
2786
|
|
|
|
|
|
|
|
2787
|
|
|
|
|
|
|
=over |
2788
|
|
|
|
|
|
|
|
2789
|
|
|
|
|
|
|
=item C - the window of which to change the border state |
2790
|
|
|
|
|
|
|
|
2791
|
|
|
|
|
|
|
=item C - false value to remove border, true value to add border |
2792
|
|
|
|
|
|
|
|
2793
|
|
|
|
|
|
|
=back |
2794
|
|
|
|
|
|
|
|
2795
|
|
|
|
|
|
|
=head2 C |
2796
|
|
|
|
|
|
|
|
2797
|
|
|
|
|
|
|
Set the user-resizable state of a window. |
2798
|
|
|
|
|
|
|
|
2799
|
|
|
|
|
|
|
SDL_SetWindowResizable( $window, 1 ); |
2800
|
|
|
|
|
|
|
|
2801
|
|
|
|
|
|
|
This will add or remove the window's C flag and |
2802
|
|
|
|
|
|
|
allow/disallow user resizing of the window. This is a no-op if the window's |
2803
|
|
|
|
|
|
|
resizable state already matches the requested state. |
2804
|
|
|
|
|
|
|
|
2805
|
|
|
|
|
|
|
You can't change the resizable state of a fullscreen window. |
2806
|
|
|
|
|
|
|
|
2807
|
|
|
|
|
|
|
Expected parameters include: |
2808
|
|
|
|
|
|
|
|
2809
|
|
|
|
|
|
|
=over |
2810
|
|
|
|
|
|
|
|
2811
|
|
|
|
|
|
|
=item C - the window of which to change the border state |
2812
|
|
|
|
|
|
|
|
2813
|
|
|
|
|
|
|
=item C - true value to allow resizing, false value to disallow |
2814
|
|
|
|
|
|
|
|
2815
|
|
|
|
|
|
|
=back |
2816
|
|
|
|
|
|
|
|
2817
|
|
|
|
|
|
|
=head2 C |
2818
|
|
|
|
|
|
|
|
2819
|
|
|
|
|
|
|
Show a window. |
2820
|
|
|
|
|
|
|
|
2821
|
|
|
|
|
|
|
SDL_ShowWindow( $window ); |
2822
|
|
|
|
|
|
|
|
2823
|
|
|
|
|
|
|
Expected parameters include: |
2824
|
|
|
|
|
|
|
|
2825
|
|
|
|
|
|
|
=over |
2826
|
|
|
|
|
|
|
|
2827
|
|
|
|
|
|
|
=item C - the window to show |
2828
|
|
|
|
|
|
|
|
2829
|
|
|
|
|
|
|
=back |
2830
|
|
|
|
|
|
|
|
2831
|
|
|
|
|
|
|
=head2 C |
2832
|
|
|
|
|
|
|
|
2833
|
|
|
|
|
|
|
Hide a window. |
2834
|
|
|
|
|
|
|
|
2835
|
|
|
|
|
|
|
SDL_HideWindow( $window ); |
2836
|
|
|
|
|
|
|
|
2837
|
|
|
|
|
|
|
Expected parameters include: |
2838
|
|
|
|
|
|
|
|
2839
|
|
|
|
|
|
|
=over |
2840
|
|
|
|
|
|
|
|
2841
|
|
|
|
|
|
|
=item C - the window to hide |
2842
|
|
|
|
|
|
|
|
2843
|
|
|
|
|
|
|
=back |
2844
|
|
|
|
|
|
|
|
2845
|
|
|
|
|
|
|
=head2 C |
2846
|
|
|
|
|
|
|
|
2847
|
|
|
|
|
|
|
Raise a window above other windows and set the input focus. |
2848
|
|
|
|
|
|
|
|
2849
|
|
|
|
|
|
|
SDL_RaiseWindow( $window ); |
2850
|
|
|
|
|
|
|
|
2851
|
|
|
|
|
|
|
Expected parameters include: |
2852
|
|
|
|
|
|
|
|
2853
|
|
|
|
|
|
|
=over |
2854
|
|
|
|
|
|
|
|
2855
|
|
|
|
|
|
|
=item C - the window to raise |
2856
|
|
|
|
|
|
|
|
2857
|
|
|
|
|
|
|
=back |
2858
|
|
|
|
|
|
|
|
2859
|
|
|
|
|
|
|
=head2 C |
2860
|
|
|
|
|
|
|
|
2861
|
|
|
|
|
|
|
Make a window as large as possible. |
2862
|
|
|
|
|
|
|
|
2863
|
|
|
|
|
|
|
SDL_MaximizeWindow( $window ); |
2864
|
|
|
|
|
|
|
|
2865
|
|
|
|
|
|
|
Expected parameters include: |
2866
|
|
|
|
|
|
|
|
2867
|
|
|
|
|
|
|
=over |
2868
|
|
|
|
|
|
|
|
2869
|
|
|
|
|
|
|
=item C - the window to maximize |
2870
|
|
|
|
|
|
|
|
2871
|
|
|
|
|
|
|
=back |
2872
|
|
|
|
|
|
|
|
2873
|
|
|
|
|
|
|
=head2 C |
2874
|
|
|
|
|
|
|
|
2875
|
|
|
|
|
|
|
Minimize a window to an iconic representation. |
2876
|
|
|
|
|
|
|
|
2877
|
|
|
|
|
|
|
SDL_MinimizeWindow( $window ); |
2878
|
|
|
|
|
|
|
|
2879
|
|
|
|
|
|
|
Expected parameters include: |
2880
|
|
|
|
|
|
|
|
2881
|
|
|
|
|
|
|
=over |
2882
|
|
|
|
|
|
|
|
2883
|
|
|
|
|
|
|
=item C - the window to minimize |
2884
|
|
|
|
|
|
|
|
2885
|
|
|
|
|
|
|
=back |
2886
|
|
|
|
|
|
|
|
2887
|
|
|
|
|
|
|
=head2 C |
2888
|
|
|
|
|
|
|
|
2889
|
|
|
|
|
|
|
Restore the size and position of a minimized or maximized window. |
2890
|
|
|
|
|
|
|
|
2891
|
|
|
|
|
|
|
SDL_RestoreWindow( $window ); |
2892
|
|
|
|
|
|
|
|
2893
|
|
|
|
|
|
|
Expected parameters include: |
2894
|
|
|
|
|
|
|
|
2895
|
|
|
|
|
|
|
=over |
2896
|
|
|
|
|
|
|
|
2897
|
|
|
|
|
|
|
=item C - the window to restore |
2898
|
|
|
|
|
|
|
|
2899
|
|
|
|
|
|
|
=back |
2900
|
|
|
|
|
|
|
|
2901
|
|
|
|
|
|
|
=head2 C |
2902
|
|
|
|
|
|
|
|
2903
|
|
|
|
|
|
|
Set a window's fullscreen state. |
2904
|
|
|
|
|
|
|
|
2905
|
|
|
|
|
|
|
SDL_SetWindowFullscreen( $window, SDL_WINDOW_FULLSCREEN ); |
2906
|
|
|
|
|
|
|
|
2907
|
|
|
|
|
|
|
Expected parameters include: |
2908
|
|
|
|
|
|
|
|
2909
|
|
|
|
|
|
|
=over |
2910
|
|
|
|
|
|
|
|
2911
|
|
|
|
|
|
|
=item C - the window to change |
2912
|
|
|
|
|
|
|
|
2913
|
|
|
|
|
|
|
=item C - C, C or 0 |
2914
|
|
|
|
|
|
|
|
2915
|
|
|
|
|
|
|
=back |
2916
|
|
|
|
|
|
|
|
2917
|
|
|
|
|
|
|
Returns 0 on success or a negative error code on failure; call L<< |
2918
|
|
|
|
|
|
|
C|/C >> for more information. |
2919
|
|
|
|
|
|
|
|
2920
|
|
|
|
|
|
|
=head2 C |
2921
|
|
|
|
|
|
|
|
2922
|
|
|
|
|
|
|
Get the SDL surface associated with the window. |
2923
|
|
|
|
|
|
|
|
2924
|
|
|
|
|
|
|
my $surface = SDL_GetWindowSurface( $window ); |
2925
|
|
|
|
|
|
|
|
2926
|
|
|
|
|
|
|
A new surface will be created with the optimal format for the window, if |
2927
|
|
|
|
|
|
|
necessary. This surface will be freed when the window is destroyed. Do not free |
2928
|
|
|
|
|
|
|
this surface. |
2929
|
|
|
|
|
|
|
|
2930
|
|
|
|
|
|
|
This surface will be invalidated if the window is resized. After resizing a |
2931
|
|
|
|
|
|
|
window this function must be called again to return a valid surface. |
2932
|
|
|
|
|
|
|
|
2933
|
|
|
|
|
|
|
You may not combine this with 3D or the rendering API on this window. |
2934
|
|
|
|
|
|
|
|
2935
|
|
|
|
|
|
|
This function is affected by C. |
2936
|
|
|
|
|
|
|
|
2937
|
|
|
|
|
|
|
Expected parameters include: |
2938
|
|
|
|
|
|
|
|
2939
|
|
|
|
|
|
|
=over |
2940
|
|
|
|
|
|
|
|
2941
|
|
|
|
|
|
|
=item C - the window to query |
2942
|
|
|
|
|
|
|
|
2943
|
|
|
|
|
|
|
=back |
2944
|
|
|
|
|
|
|
|
2945
|
|
|
|
|
|
|
Returns the surface associated with the window, or an undefined on failure; |
2946
|
|
|
|
|
|
|
call L<< C|/C >> for more information. |
2947
|
|
|
|
|
|
|
|
2948
|
|
|
|
|
|
|
=head2 C |
2949
|
|
|
|
|
|
|
|
2950
|
|
|
|
|
|
|
Copy the window surface to the screen. |
2951
|
|
|
|
|
|
|
|
2952
|
|
|
|
|
|
|
my $ok = !SDL_UpdateWindowSurface( $window ); |
2953
|
|
|
|
|
|
|
|
2954
|
|
|
|
|
|
|
This is the function you use to reflect any changes to the surface on the |
2955
|
|
|
|
|
|
|
screen. |
2956
|
|
|
|
|
|
|
|
2957
|
|
|
|
|
|
|
Expected parameters include: |
2958
|
|
|
|
|
|
|
|
2959
|
|
|
|
|
|
|
=over |
2960
|
|
|
|
|
|
|
|
2961
|
|
|
|
|
|
|
=item C - the window to query |
2962
|
|
|
|
|
|
|
|
2963
|
|
|
|
|
|
|
=back |
2964
|
|
|
|
|
|
|
|
2965
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
2966
|
|
|
|
|
|
|
C|/C >> for more information. |
2967
|
|
|
|
|
|
|
|
2968
|
|
|
|
|
|
|
=head2 C |
2969
|
|
|
|
|
|
|
|
2970
|
|
|
|
|
|
|
Copy areas of the window surface to the screen. |
2971
|
|
|
|
|
|
|
|
2972
|
|
|
|
|
|
|
SDL_UpdateWindowSurfaceRects( $window, @recs ); |
2973
|
|
|
|
|
|
|
|
2974
|
|
|
|
|
|
|
This is the function you use to reflect changes to portions of the surface on |
2975
|
|
|
|
|
|
|
the screen. |
2976
|
|
|
|
|
|
|
|
2977
|
|
|
|
|
|
|
Expected parameters include: |
2978
|
|
|
|
|
|
|
|
2979
|
|
|
|
|
|
|
=over |
2980
|
|
|
|
|
|
|
|
2981
|
|
|
|
|
|
|
=item C - the window to update |
2982
|
|
|
|
|
|
|
|
2983
|
|
|
|
|
|
|
=item C - an array of L structures representing areas of the surface to copy |
2984
|
|
|
|
|
|
|
|
2985
|
|
|
|
|
|
|
=back |
2986
|
|
|
|
|
|
|
|
2987
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
2988
|
|
|
|
|
|
|
C|/C >> for more information. |
2989
|
|
|
|
|
|
|
|
2990
|
|
|
|
|
|
|
=head2 C |
2991
|
|
|
|
|
|
|
|
2992
|
|
|
|
|
|
|
Set a window's input grab mode. |
2993
|
|
|
|
|
|
|
|
2994
|
|
|
|
|
|
|
SDL_SetWindowGrab( $window, 1 ); |
2995
|
|
|
|
|
|
|
|
2996
|
|
|
|
|
|
|
When input is grabbed the mouse is confined to the window. |
2997
|
|
|
|
|
|
|
|
2998
|
|
|
|
|
|
|
If the caller enables a grab while another window is currently grabbed, the |
2999
|
|
|
|
|
|
|
other window loses its grab in favor of the caller's window. |
3000
|
|
|
|
|
|
|
|
3001
|
|
|
|
|
|
|
Expected parameters include: |
3002
|
|
|
|
|
|
|
|
3003
|
|
|
|
|
|
|
=over |
3004
|
|
|
|
|
|
|
|
3005
|
|
|
|
|
|
|
=item C - the window for which the input grab mode should be set |
3006
|
|
|
|
|
|
|
|
3007
|
|
|
|
|
|
|
=item C - a true value to grab input or a false value to release input |
3008
|
|
|
|
|
|
|
|
3009
|
|
|
|
|
|
|
=back |
3010
|
|
|
|
|
|
|
|
3011
|
|
|
|
|
|
|
=head2 C |
3012
|
|
|
|
|
|
|
|
3013
|
|
|
|
|
|
|
Set a window's keyboard grab mode. |
3014
|
|
|
|
|
|
|
|
3015
|
|
|
|
|
|
|
SDL_SetWindowKeyboardGrab( $window, 1 ); |
3016
|
|
|
|
|
|
|
|
3017
|
|
|
|
|
|
|
If the caller enables a grab while another window is currently grabbed, the |
3018
|
|
|
|
|
|
|
other window loses its grab in favor of the caller's window. |
3019
|
|
|
|
|
|
|
|
3020
|
|
|
|
|
|
|
Expected parameters include: |
3021
|
|
|
|
|
|
|
|
3022
|
|
|
|
|
|
|
=over |
3023
|
|
|
|
|
|
|
|
3024
|
|
|
|
|
|
|
=item C - The window for which the keyboard grab mode should be set. |
3025
|
|
|
|
|
|
|
|
3026
|
|
|
|
|
|
|
=item C - This is true to grab keyboard, and false to release. |
3027
|
|
|
|
|
|
|
|
3028
|
|
|
|
|
|
|
=back |
3029
|
|
|
|
|
|
|
|
3030
|
|
|
|
|
|
|
=head2 C |
3031
|
|
|
|
|
|
|
|
3032
|
|
|
|
|
|
|
Set a window's mouse grab mode. |
3033
|
|
|
|
|
|
|
|
3034
|
|
|
|
|
|
|
SDL_SetWindowMouseGrab( $window, 1 ); |
3035
|
|
|
|
|
|
|
|
3036
|
|
|
|
|
|
|
Expected parameters include: |
3037
|
|
|
|
|
|
|
|
3038
|
|
|
|
|
|
|
=over |
3039
|
|
|
|
|
|
|
|
3040
|
|
|
|
|
|
|
=item C - The window for which the mouse grab mode should be set. |
3041
|
|
|
|
|
|
|
|
3042
|
|
|
|
|
|
|
=item C - This is true to grab mouse, and false to release. |
3043
|
|
|
|
|
|
|
|
3044
|
|
|
|
|
|
|
=back |
3045
|
|
|
|
|
|
|
|
3046
|
|
|
|
|
|
|
If the caller enables a grab while another window is currently grabbed, the |
3047
|
|
|
|
|
|
|
other window loses its grab in favor of the caller's window. |
3048
|
|
|
|
|
|
|
|
3049
|
|
|
|
|
|
|
=head2 C |
3050
|
|
|
|
|
|
|
|
3051
|
|
|
|
|
|
|
Get a window's input grab mode. |
3052
|
|
|
|
|
|
|
|
3053
|
|
|
|
|
|
|
my $grabbing = SDL_GetWindowGrab( $window ); |
3054
|
|
|
|
|
|
|
|
3055
|
|
|
|
|
|
|
Expected parameters include: |
3056
|
|
|
|
|
|
|
|
3057
|
|
|
|
|
|
|
=over |
3058
|
|
|
|
|
|
|
|
3059
|
|
|
|
|
|
|
=item C - the window to query |
3060
|
|
|
|
|
|
|
|
3061
|
|
|
|
|
|
|
=back |
3062
|
|
|
|
|
|
|
|
3063
|
|
|
|
|
|
|
Returns true if input is grabbed, false otherwise. |
3064
|
|
|
|
|
|
|
|
3065
|
|
|
|
|
|
|
=head2 C |
3066
|
|
|
|
|
|
|
|
3067
|
|
|
|
|
|
|
Get a window's keyboard grab mode. |
3068
|
|
|
|
|
|
|
|
3069
|
|
|
|
|
|
|
my $keyboard = SDL_GetWindowKeyboardGrab( $window ); |
3070
|
|
|
|
|
|
|
|
3071
|
|
|
|
|
|
|
Expected parameters include: |
3072
|
|
|
|
|
|
|
|
3073
|
|
|
|
|
|
|
=over |
3074
|
|
|
|
|
|
|
|
3075
|
|
|
|
|
|
|
=item C - the window to query |
3076
|
|
|
|
|
|
|
|
3077
|
|
|
|
|
|
|
=back |
3078
|
|
|
|
|
|
|
|
3079
|
|
|
|
|
|
|
Returns true if keyboard is grabbed, and false otherwise. |
3080
|
|
|
|
|
|
|
|
3081
|
|
|
|
|
|
|
=head2 C |
3082
|
|
|
|
|
|
|
|
3083
|
|
|
|
|
|
|
Get a window's mouse grab mode. |
3084
|
|
|
|
|
|
|
|
3085
|
|
|
|
|
|
|
my $mouse = SDL_GetWindowMouseGrab( $window ); |
3086
|
|
|
|
|
|
|
|
3087
|
|
|
|
|
|
|
Expected parameters include: |
3088
|
|
|
|
|
|
|
|
3089
|
|
|
|
|
|
|
=over |
3090
|
|
|
|
|
|
|
|
3091
|
|
|
|
|
|
|
=item C - the window to query |
3092
|
|
|
|
|
|
|
|
3093
|
|
|
|
|
|
|
=back |
3094
|
|
|
|
|
|
|
|
3095
|
|
|
|
|
|
|
This returns true if mouse is grabbed, and false otherwise. |
3096
|
|
|
|
|
|
|
|
3097
|
|
|
|
|
|
|
=head2 C |
3098
|
|
|
|
|
|
|
|
3099
|
|
|
|
|
|
|
Get the window that currently has an input grab enabled. |
3100
|
|
|
|
|
|
|
|
3101
|
|
|
|
|
|
|
my $window = SDL_GetGrabbedWindow( ); |
3102
|
|
|
|
|
|
|
|
3103
|
|
|
|
|
|
|
Returns the window if input is grabbed or undefined otherwise. |
3104
|
|
|
|
|
|
|
|
3105
|
|
|
|
|
|
|
=head2 C |
3106
|
|
|
|
|
|
|
|
3107
|
|
|
|
|
|
|
Set the brightness (gamma multiplier) for a given window's display. |
3108
|
|
|
|
|
|
|
|
3109
|
|
|
|
|
|
|
my $ok = !SDL_SetWindowBrightness( $window, 2 ); |
3110
|
|
|
|
|
|
|
|
3111
|
|
|
|
|
|
|
Despite the name and signature, this method sets the brightness of the entire |
3112
|
|
|
|
|
|
|
display, not an individual window. A window is considered to be owned by the |
3113
|
|
|
|
|
|
|
display that contains the window's center pixel. (The index of this display can |
3114
|
|
|
|
|
|
|
be retrieved using L<< C
|
3115
|
|
|
|
|
|
|
)>|/C >>.) The brightness set will not follow |
3116
|
|
|
|
|
|
|
the window if it is moved to another display. |
3117
|
|
|
|
|
|
|
|
3118
|
|
|
|
|
|
|
Many platforms will refuse to set the display brightness in modern times. You |
3119
|
|
|
|
|
|
|
are better off using a shader to adjust gamma during rendering, or something |
3120
|
|
|
|
|
|
|
similar. |
3121
|
|
|
|
|
|
|
|
3122
|
|
|
|
|
|
|
Expected parameters includes: |
3123
|
|
|
|
|
|
|
|
3124
|
|
|
|
|
|
|
=over |
3125
|
|
|
|
|
|
|
|
3126
|
|
|
|
|
|
|
=item C - the window used to select the display whose brightness will be changed |
3127
|
|
|
|
|
|
|
|
3128
|
|
|
|
|
|
|
=item C - the brightness (gamma multiplier) value to set where 0.0 is completely dark and 1.0 is normal brightness |
3129
|
|
|
|
|
|
|
|
3130
|
|
|
|
|
|
|
=back |
3131
|
|
|
|
|
|
|
|
3132
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
3133
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3134
|
|
|
|
|
|
|
|
3135
|
|
|
|
|
|
|
=head2 C |
3136
|
|
|
|
|
|
|
|
3137
|
|
|
|
|
|
|
Get the brightness (gamma multiplier) for a given window's display. |
3138
|
|
|
|
|
|
|
|
3139
|
|
|
|
|
|
|
my $gamma = SDL_GetWindowBrightness( $window ); |
3140
|
|
|
|
|
|
|
|
3141
|
|
|
|
|
|
|
Despite the name and signature, this method retrieves the brightness of the |
3142
|
|
|
|
|
|
|
entire display, not an individual window. A window is considered to be owned by |
3143
|
|
|
|
|
|
|
the display that contains the window's center pixel. (The index of this display |
3144
|
|
|
|
|
|
|
can be retrieved using L<< C
|
3145
|
|
|
|
|
|
|
)>|/C >>.) |
3146
|
|
|
|
|
|
|
|
3147
|
|
|
|
|
|
|
Expected parameters include: |
3148
|
|
|
|
|
|
|
|
3149
|
|
|
|
|
|
|
=over |
3150
|
|
|
|
|
|
|
|
3151
|
|
|
|
|
|
|
=item C - the window used to select the display whose brightness will be queried |
3152
|
|
|
|
|
|
|
|
3153
|
|
|
|
|
|
|
=back |
3154
|
|
|
|
|
|
|
|
3155
|
|
|
|
|
|
|
Returns the brightness for the display where 0.0 is completely dark and C<1.0> |
3156
|
|
|
|
|
|
|
is normal brightness. |
3157
|
|
|
|
|
|
|
|
3158
|
|
|
|
|
|
|
=head2 C |
3159
|
|
|
|
|
|
|
|
3160
|
|
|
|
|
|
|
Set the opacity for a window. |
3161
|
|
|
|
|
|
|
|
3162
|
|
|
|
|
|
|
SDL_SetWindowOpacity( $window, .5 ); |
3163
|
|
|
|
|
|
|
|
3164
|
|
|
|
|
|
|
The parameter C will be clamped internally between C<0.0> |
3165
|
|
|
|
|
|
|
(transparent) and C<1.0> (opaque). |
3166
|
|
|
|
|
|
|
|
3167
|
|
|
|
|
|
|
This function also returns C<-1> if setting the opacity isn't supported. |
3168
|
|
|
|
|
|
|
|
3169
|
|
|
|
|
|
|
Expected parameters include: |
3170
|
|
|
|
|
|
|
|
3171
|
|
|
|
|
|
|
=over |
3172
|
|
|
|
|
|
|
|
3173
|
|
|
|
|
|
|
=item C - the window which will be made transparent or opaque |
3174
|
|
|
|
|
|
|
|
3175
|
|
|
|
|
|
|
=item C - the opacity value (0.0 - transparent, 1.0 - opaque) |
3176
|
|
|
|
|
|
|
|
3177
|
|
|
|
|
|
|
=back |
3178
|
|
|
|
|
|
|
|
3179
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
3180
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3181
|
|
|
|
|
|
|
|
3182
|
|
|
|
|
|
|
=head2 C |
3183
|
|
|
|
|
|
|
|
3184
|
|
|
|
|
|
|
Get the opacity of a window. |
3185
|
|
|
|
|
|
|
|
3186
|
|
|
|
|
|
|
my $opacity = SDL_GetWindowOpacity( $window ); |
3187
|
|
|
|
|
|
|
|
3188
|
|
|
|
|
|
|
If transparency isn't supported on this platform, opacity will be reported as |
3189
|
|
|
|
|
|
|
1.0 without error. |
3190
|
|
|
|
|
|
|
|
3191
|
|
|
|
|
|
|
The parameter C is ignored if it is undefined. |
3192
|
|
|
|
|
|
|
|
3193
|
|
|
|
|
|
|
This function also returns C<-1> if an invalid window was provided. |
3194
|
|
|
|
|
|
|
|
3195
|
|
|
|
|
|
|
Expected parameters include: |
3196
|
|
|
|
|
|
|
|
3197
|
|
|
|
|
|
|
=over |
3198
|
|
|
|
|
|
|
|
3199
|
|
|
|
|
|
|
=item C - the window to get the current opacity value from |
3200
|
|
|
|
|
|
|
|
3201
|
|
|
|
|
|
|
=back |
3202
|
|
|
|
|
|
|
|
3203
|
|
|
|
|
|
|
Returns the current opacity on success or a negative error code on failure; |
3204
|
|
|
|
|
|
|
call L<< C|/C >>( ) for more information. |
3205
|
|
|
|
|
|
|
|
3206
|
|
|
|
|
|
|
=head2 C |
3207
|
|
|
|
|
|
|
|
3208
|
|
|
|
|
|
|
Set the window as a modal for another window. |
3209
|
|
|
|
|
|
|
|
3210
|
|
|
|
|
|
|
my $ok = !SDL_SetWindowModalFor( $winodw, $parent ); |
3211
|
|
|
|
|
|
|
|
3212
|
|
|
|
|
|
|
Expected parameters include: |
3213
|
|
|
|
|
|
|
|
3214
|
|
|
|
|
|
|
=over |
3215
|
|
|
|
|
|
|
|
3216
|
|
|
|
|
|
|
=item C - the window that should be set modal |
3217
|
|
|
|
|
|
|
|
3218
|
|
|
|
|
|
|
=item C - the parent window for the modal window |
3219
|
|
|
|
|
|
|
|
3220
|
|
|
|
|
|
|
=back |
3221
|
|
|
|
|
|
|
|
3222
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
3223
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3224
|
|
|
|
|
|
|
|
3225
|
|
|
|
|
|
|
|
3226
|
|
|
|
|
|
|
=head2 C |
3227
|
|
|
|
|
|
|
|
3228
|
|
|
|
|
|
|
Explicitly set input focus to the window. |
3229
|
|
|
|
|
|
|
|
3230
|
|
|
|
|
|
|
SDL_SetWindowInputFocus( $window ); |
3231
|
|
|
|
|
|
|
|
3232
|
|
|
|
|
|
|
You almost certainly want L<< C|/C
|
3233
|
|
|
|
|
|
|
)> >> instead of this function. Use this with caution, as you might give focus |
3234
|
|
|
|
|
|
|
to a window that is completely obscured by other windows. |
3235
|
|
|
|
|
|
|
|
3236
|
|
|
|
|
|
|
Expected parameters include: |
3237
|
|
|
|
|
|
|
|
3238
|
|
|
|
|
|
|
=over |
3239
|
|
|
|
|
|
|
|
3240
|
|
|
|
|
|
|
=item C - the window that should get the input focus |
3241
|
|
|
|
|
|
|
|
3242
|
|
|
|
|
|
|
=back |
3243
|
|
|
|
|
|
|
|
3244
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
3245
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3246
|
|
|
|
|
|
|
|
3247
|
|
|
|
|
|
|
=head2 C |
3248
|
|
|
|
|
|
|
|
3249
|
|
|
|
|
|
|
Set the gamma ramp for the display that owns a given window. |
3250
|
|
|
|
|
|
|
|
3251
|
|
|
|
|
|
|
my $ok = !SDL_SetWindowGammaRamp( $window, \@red, \@green, \@blue ); |
3252
|
|
|
|
|
|
|
|
3253
|
|
|
|
|
|
|
Set the gamma translation table for the red, green, and blue channels of the |
3254
|
|
|
|
|
|
|
video hardware. Each table is an array of 256 16-bit quantities, representing a |
3255
|
|
|
|
|
|
|
mapping between the input and output for that channel. The input is the index |
3256
|
|
|
|
|
|
|
into the array, and the output is the 16-bit gamma value at that index, scaled |
3257
|
|
|
|
|
|
|
to the output color precision. Despite the name and signature, this method sets |
3258
|
|
|
|
|
|
|
the gamma ramp of the entire display, not an individual window. A window is |
3259
|
|
|
|
|
|
|
considered to be owned by the display that contains the window's center pixel. |
3260
|
|
|
|
|
|
|
(The index of this display can be retrieved using L<< |
3261
|
|
|
|
|
|
|
C|/C >>.) |
3262
|
|
|
|
|
|
|
The gamma ramp set will not follow the window if it is moved to another |
3263
|
|
|
|
|
|
|
display. |
3264
|
|
|
|
|
|
|
|
3265
|
|
|
|
|
|
|
Expected parameters include: |
3266
|
|
|
|
|
|
|
|
3267
|
|
|
|
|
|
|
=over |
3268
|
|
|
|
|
|
|
|
3269
|
|
|
|
|
|
|
=item C - the window used to select the display whose gamma ramp will be changed |
3270
|
|
|
|
|
|
|
|
3271
|
|
|
|
|
|
|
=item C - a 256 element array of 16-bit quantities representing the translation table for the red channel, or NULL |
3272
|
|
|
|
|
|
|
|
3273
|
|
|
|
|
|
|
=item C - a 256 element array of 16-bit quantities representing the translation table for the green channel, or NULL |
3274
|
|
|
|
|
|
|
|
3275
|
|
|
|
|
|
|
=item C - a 256 element array of 16-bit quantities representing the translation table for the blue channel, or NULL |
3276
|
|
|
|
|
|
|
|
3277
|
|
|
|
|
|
|
=back |
3278
|
|
|
|
|
|
|
|
3279
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
3280
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3281
|
|
|
|
|
|
|
|
3282
|
|
|
|
|
|
|
=head2 C |
3283
|
|
|
|
|
|
|
|
3284
|
|
|
|
|
|
|
Get the gamma ramp for a given window's display. |
3285
|
|
|
|
|
|
|
|
3286
|
|
|
|
|
|
|
my ($red, $green, $blue) = SDL_GetWindowGammaRamp( $window ); |
3287
|
|
|
|
|
|
|
|
3288
|
|
|
|
|
|
|
Despite the name and signature, this method retrieves the gamma ramp of the |
3289
|
|
|
|
|
|
|
entire display, not an individual window. A window is considered to be owned by |
3290
|
|
|
|
|
|
|
the display that contains the window's center pixel. (The index of this display |
3291
|
|
|
|
|
|
|
can be retrieved using L<< C
|
3292
|
|
|
|
|
|
|
)>|/C >>.) |
3293
|
|
|
|
|
|
|
|
3294
|
|
|
|
|
|
|
Expected parameters include: |
3295
|
|
|
|
|
|
|
|
3296
|
|
|
|
|
|
|
=over |
3297
|
|
|
|
|
|
|
|
3298
|
|
|
|
|
|
|
=item C - the window used to select the display whose gamma ramp will be queried |
3299
|
|
|
|
|
|
|
|
3300
|
|
|
|
|
|
|
=back |
3301
|
|
|
|
|
|
|
|
3302
|
|
|
|
|
|
|
Returns three 256 element arrays of 16-bit quantities filled in with the |
3303
|
|
|
|
|
|
|
translation table for the red, gree, and blue channels on success or a negative |
3304
|
|
|
|
|
|
|
error code on failure; call L<< C|/C >>( ) |
3305
|
|
|
|
|
|
|
for more information. |
3306
|
|
|
|
|
|
|
|
3307
|
|
|
|
|
|
|
=head2 C |
3308
|
|
|
|
|
|
|
|
3309
|
|
|
|
|
|
|
Provide a callback that decides if a window region has special properties. |
3310
|
|
|
|
|
|
|
|
3311
|
|
|
|
|
|
|
SDL_SetWindowHitTest( $window, sub ($win, $point, $data) { |
3312
|
|
|
|
|
|
|
warn sprintf 'Click at x:%d y:%d', $point->x, $point->y; |
3313
|
|
|
|
|
|
|
...; |
3314
|
|
|
|
|
|
|
}); |
3315
|
|
|
|
|
|
|
|
3316
|
|
|
|
|
|
|
Normally, windows are dragged and resized by decorations provided by the system |
3317
|
|
|
|
|
|
|
window manager (a title bar, borders, etc), but for some apps, it makes sense |
3318
|
|
|
|
|
|
|
to drag them from somewhere else inside the window itself; for example, one |
3319
|
|
|
|
|
|
|
might have a borderless window that wants to be draggable from any part, or |
3320
|
|
|
|
|
|
|
simulate its own title bar, etc. |
3321
|
|
|
|
|
|
|
|
3322
|
|
|
|
|
|
|
This function lets the app provide a callback that designates pieces of a given |
3323
|
|
|
|
|
|
|
window as special. This callback is run during event processing if we need to |
3324
|
|
|
|
|
|
|
tell the OS to treat a region of the window specially; the use of this callback |
3325
|
|
|
|
|
|
|
is known as "hit testing." |
3326
|
|
|
|
|
|
|
|
3327
|
|
|
|
|
|
|
Mouse input may not be delivered to your application if it is within a special |
3328
|
|
|
|
|
|
|
area; the OS will often apply that input to moving the window or resizing the |
3329
|
|
|
|
|
|
|
window and not deliver it to the application. |
3330
|
|
|
|
|
|
|
|
3331
|
|
|
|
|
|
|
Specifying undef for a callback disables hit-testing. Hit-testing is disabled |
3332
|
|
|
|
|
|
|
by default. |
3333
|
|
|
|
|
|
|
|
3334
|
|
|
|
|
|
|
Platforms that don't support this functionality will return C<-1> |
3335
|
|
|
|
|
|
|
unconditionally, even if you're attempting to disable hit-testing. |
3336
|
|
|
|
|
|
|
|
3337
|
|
|
|
|
|
|
Your callback may fire at any time, and its firing does not indicate any |
3338
|
|
|
|
|
|
|
specific behavior (for example, on Windows, this certainly might fire when the |
3339
|
|
|
|
|
|
|
OS is deciding whether to drag your window, but it fires for lots of other |
3340
|
|
|
|
|
|
|
reasons, too, some unrelated to anything you probably care about B
|
3341
|
|
|
|
|
|
|
mouse isn't actually at the location it is testing>). Since this can fire at |
3342
|
|
|
|
|
|
|
any time, you should try to keep your callback efficient, devoid of |
3343
|
|
|
|
|
|
|
allocations, etc. |
3344
|
|
|
|
|
|
|
|
3345
|
|
|
|
|
|
|
Expected parameters include: |
3346
|
|
|
|
|
|
|
|
3347
|
|
|
|
|
|
|
=over |
3348
|
|
|
|
|
|
|
|
3349
|
|
|
|
|
|
|
=item C - the window to set hit-testing on |
3350
|
|
|
|
|
|
|
|
3351
|
|
|
|
|
|
|
=item C - the function to call when doing a hit-test |
3352
|
|
|
|
|
|
|
|
3353
|
|
|
|
|
|
|
=item C - an app-defined void pointer passed to C |
3354
|
|
|
|
|
|
|
|
3355
|
|
|
|
|
|
|
=back |
3356
|
|
|
|
|
|
|
|
3357
|
|
|
|
|
|
|
Returns C<0> on success or C<-1> on error (including unsupported); call L<< |
3358
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3359
|
|
|
|
|
|
|
|
3360
|
|
|
|
|
|
|
=head2 C |
3361
|
|
|
|
|
|
|
|
3362
|
|
|
|
|
|
|
Request a window to give a signal, e.g. a visual signal, to demand attention |
3363
|
|
|
|
|
|
|
from the user. |
3364
|
|
|
|
|
|
|
|
3365
|
|
|
|
|
|
|
SDL_FlashWindow( $window, 10 ); |
3366
|
|
|
|
|
|
|
|
3367
|
|
|
|
|
|
|
Expected parameters include: |
3368
|
|
|
|
|
|
|
|
3369
|
|
|
|
|
|
|
=over |
3370
|
|
|
|
|
|
|
|
3371
|
|
|
|
|
|
|
=item C - the window to request the flashing for |
3372
|
|
|
|
|
|
|
|
3373
|
|
|
|
|
|
|
=item C - number of times the window gets flashed on systems that support flashing the window multiple times, like Windows, else it is ignored |
3374
|
|
|
|
|
|
|
|
3375
|
|
|
|
|
|
|
=back |
3376
|
|
|
|
|
|
|
|
3377
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
3378
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3379
|
|
|
|
|
|
|
|
3380
|
|
|
|
|
|
|
=head2 C |
3381
|
|
|
|
|
|
|
|
3382
|
|
|
|
|
|
|
Destroy a window. |
3383
|
|
|
|
|
|
|
|
3384
|
|
|
|
|
|
|
SDL_DestoryWindow( $window ); |
3385
|
|
|
|
|
|
|
|
3386
|
|
|
|
|
|
|
If C is undefined, this function will return immediately after setting |
3387
|
|
|
|
|
|
|
the SDL error message to "Invalid window". See L<< C
|
3388
|
|
|
|
|
|
|
)>|/C >>( ). |
3389
|
|
|
|
|
|
|
|
3390
|
|
|
|
|
|
|
Expected parameters include: |
3391
|
|
|
|
|
|
|
|
3392
|
|
|
|
|
|
|
=over |
3393
|
|
|
|
|
|
|
|
3394
|
|
|
|
|
|
|
=item C - the window to destroy |
3395
|
|
|
|
|
|
|
|
3396
|
|
|
|
|
|
|
=back |
3397
|
|
|
|
|
|
|
|
3398
|
|
|
|
|
|
|
=head2 C |
3399
|
|
|
|
|
|
|
|
3400
|
|
|
|
|
|
|
Check whether the screensaver is currently enabled. |
3401
|
|
|
|
|
|
|
|
3402
|
|
|
|
|
|
|
my $enabled = SDL_IsScreenSaverEnabled( ); |
3403
|
|
|
|
|
|
|
|
3404
|
|
|
|
|
|
|
The screensaver is disabled by default since SDL 2.0.2. Before SDL 2.0.2 the |
3405
|
|
|
|
|
|
|
screensaver was enabled by default. |
3406
|
|
|
|
|
|
|
|
3407
|
|
|
|
|
|
|
The default can also be changed using C. |
3408
|
|
|
|
|
|
|
|
3409
|
|
|
|
|
|
|
Returns true if the screensaver is enabled, false if it is disabled. |
3410
|
|
|
|
|
|
|
|
3411
|
|
|
|
|
|
|
=head2 C |
3412
|
|
|
|
|
|
|
|
3413
|
|
|
|
|
|
|
Allow the screen to be blanked by a screen saver. |
3414
|
|
|
|
|
|
|
|
3415
|
|
|
|
|
|
|
SDL_EnableScreenSaver( ); |
3416
|
|
|
|
|
|
|
|
3417
|
|
|
|
|
|
|
|
3418
|
|
|
|
|
|
|
=head2 C |
3419
|
|
|
|
|
|
|
|
3420
|
|
|
|
|
|
|
Prevent the screen from being blanked by a screen saver. |
3421
|
|
|
|
|
|
|
|
3422
|
|
|
|
|
|
|
SDL_DisableScreenSaver( ); |
3423
|
|
|
|
|
|
|
|
3424
|
|
|
|
|
|
|
If you disable the screensaver, it is automatically re-enabled when SDL quits. |
3425
|
|
|
|
|
|
|
|
3426
|
|
|
|
|
|
|
=head1 OpenGL Support Functions |
3427
|
|
|
|
|
|
|
|
3428
|
|
|
|
|
|
|
These may be imported with the C<:opengl> tag. |
3429
|
|
|
|
|
|
|
|
3430
|
|
|
|
|
|
|
=head2 C |
3431
|
|
|
|
|
|
|
|
3432
|
|
|
|
|
|
|
Dynamically load an OpenGL library. |
3433
|
|
|
|
|
|
|
|
3434
|
|
|
|
|
|
|
my $ok = SDL_GL_LoadLibrary( ); |
3435
|
|
|
|
|
|
|
|
3436
|
|
|
|
|
|
|
This should be done after initializing the video driver, but before creating |
3437
|
|
|
|
|
|
|
any OpenGL windows. If no OpenGL library is loaded, the default library will be |
3438
|
|
|
|
|
|
|
loaded upon creation of the first OpenGL window. |
3439
|
|
|
|
|
|
|
|
3440
|
|
|
|
|
|
|
If you do this, you need to retrieve all of the GL functions used in your |
3441
|
|
|
|
|
|
|
program from the dynamic library using L<< C
|
3442
|
|
|
|
|
|
|
)>|/C >>. |
3443
|
|
|
|
|
|
|
|
3444
|
|
|
|
|
|
|
Expected parameters include: |
3445
|
|
|
|
|
|
|
|
3446
|
|
|
|
|
|
|
=over |
3447
|
|
|
|
|
|
|
|
3448
|
|
|
|
|
|
|
=item C - the platform dependent OpenGL library name, or undef to open the default OpenGL library |
3449
|
|
|
|
|
|
|
|
3450
|
|
|
|
|
|
|
=back |
3451
|
|
|
|
|
|
|
|
3452
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
3453
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3454
|
|
|
|
|
|
|
|
3455
|
|
|
|
|
|
|
=head2 C |
3456
|
|
|
|
|
|
|
|
3457
|
|
|
|
|
|
|
Get an OpenGL function by name. |
3458
|
|
|
|
|
|
|
|
3459
|
|
|
|
|
|
|
my $ptr = SDL_GL_GetProcAddress( 'glGenBuffers' ); |
3460
|
|
|
|
|
|
|
...; # TODO |
3461
|
|
|
|
|
|
|
# TODO: In the future, this should return an XSUB loaded with FFI. |
3462
|
|
|
|
|
|
|
|
3463
|
|
|
|
|
|
|
If the GL library is loaded at runtime with L<< C
|
3464
|
|
|
|
|
|
|
)>|/C >>, then all GL functions must be retrieved |
3465
|
|
|
|
|
|
|
this way. Usually this is used to retrieve function pointers to OpenGL |
3466
|
|
|
|
|
|
|
extensions. |
3467
|
|
|
|
|
|
|
|
3468
|
|
|
|
|
|
|
There are some quirks to looking up OpenGL functions that require some extra |
3469
|
|
|
|
|
|
|
care from the application. If you code carefully, you can handle these quirks |
3470
|
|
|
|
|
|
|
without any platform-specific code, though: |
3471
|
|
|
|
|
|
|
|
3472
|
|
|
|
|
|
|
=over |
3473
|
|
|
|
|
|
|
|
3474
|
|
|
|
|
|
|
=item * On Windows, function pointers are specific to the current GL context; |
3475
|
|
|
|
|
|
|
this means you need to have created a GL context and made it current before |
3476
|
|
|
|
|
|
|
calling SDL_GL_GetProcAddress( ). If you recreate your context or create a |
3477
|
|
|
|
|
|
|
second context, you should assume that any existing function pointers |
3478
|
|
|
|
|
|
|
aren't valid to use with it. This is (currently) a Windows-specific |
3479
|
|
|
|
|
|
|
limitation, and in practice lots of drivers don't suffer this limitation, |
3480
|
|
|
|
|
|
|
but it is still the way the wgl API is documented to work and you should |
3481
|
|
|
|
|
|
|
expect crashes if you don't respect it. Store a copy of the function |
3482
|
|
|
|
|
|
|
pointers that comes and goes with context lifespan. |
3483
|
|
|
|
|
|
|
|
3484
|
|
|
|
|
|
|
=item * On X11, function pointers returned by this function are valid for any |
3485
|
|
|
|
|
|
|
context, and can even be looked up before a context is created at all. This |
3486
|
|
|
|
|
|
|
means that, for at least some common OpenGL implementations, if you look up |
3487
|
|
|
|
|
|
|
a function that doesn't exist, you'll get a non-NULL result that is _NOT_ |
3488
|
|
|
|
|
|
|
safe to call. You must always make sure the function is actually available |
3489
|
|
|
|
|
|
|
for a given GL context before calling it, by checking for the existence of |
3490
|
|
|
|
|
|
|
the appropriate extension with L<< C|C >>, or verifying |
3491
|
|
|
|
|
|
|
that the version of OpenGL you're using offers the function as core |
3492
|
|
|
|
|
|
|
functionality. |
3493
|
|
|
|
|
|
|
|
3494
|
|
|
|
|
|
|
=item * Some OpenGL drivers, on all platforms, B return undef if a function |
3495
|
|
|
|
|
|
|
isn't supported, but you can't count on this behavior. Check for extensions |
3496
|
|
|
|
|
|
|
you use, and if you get an undef anyway, act as if that extension wasn't |
3497
|
|
|
|
|
|
|
available. This is probably a bug in the driver, but you can code |
3498
|
|
|
|
|
|
|
defensively for this scenario anyhow. |
3499
|
|
|
|
|
|
|
|
3500
|
|
|
|
|
|
|
=item * Just because you're on Linux/Unix, don't assume you'll be using X11. |
3501
|
|
|
|
|
|
|
Next-gen display servers are waiting to replace it, and may or may not make |
3502
|
|
|
|
|
|
|
the same promises about function pointers. |
3503
|
|
|
|
|
|
|
|
3504
|
|
|
|
|
|
|
=item * OpenGL function pointers must be declared C as in the example |
3505
|
|
|
|
|
|
|
code. This will ensure the proper calling convention is followed on |
3506
|
|
|
|
|
|
|
platforms where this matters (Win32) thereby avoiding stack corruption. |
3507
|
|
|
|
|
|
|
|
3508
|
|
|
|
|
|
|
=back |
3509
|
|
|
|
|
|
|
|
3510
|
|
|
|
|
|
|
Expected parameters include: |
3511
|
|
|
|
|
|
|
|
3512
|
|
|
|
|
|
|
=over |
3513
|
|
|
|
|
|
|
|
3514
|
|
|
|
|
|
|
=item C - the name of an OpenGL function |
3515
|
|
|
|
|
|
|
|
3516
|
|
|
|
|
|
|
=back |
3517
|
|
|
|
|
|
|
|
3518
|
|
|
|
|
|
|
Returns a pointer to the named OpenGL function. The returned pointer should be |
3519
|
|
|
|
|
|
|
cast to the appropriate function signature. |
3520
|
|
|
|
|
|
|
|
3521
|
|
|
|
|
|
|
=head2 C |
3522
|
|
|
|
|
|
|
|
3523
|
|
|
|
|
|
|
Unload the OpenGL library previously loaded by L<< C
|
3524
|
|
|
|
|
|
|
)>|/C >>. |
3525
|
|
|
|
|
|
|
|
3526
|
|
|
|
|
|
|
=head2 C |
3527
|
|
|
|
|
|
|
|
3528
|
|
|
|
|
|
|
Check if an OpenGL extension is supported for the current context. |
3529
|
|
|
|
|
|
|
|
3530
|
|
|
|
|
|
|
my $ok = SDL_GL_ExtensionSupported( 'GL_ARB_texture_rectangle' ); |
3531
|
|
|
|
|
|
|
|
3532
|
|
|
|
|
|
|
This function operates on the current GL context; you must have created a |
3533
|
|
|
|
|
|
|
context and it must be current before calling this function. Do not assume that |
3534
|
|
|
|
|
|
|
all contexts you create will have the same set of extensions available, or that |
3535
|
|
|
|
|
|
|
recreating an existing context will offer the same extensions again. |
3536
|
|
|
|
|
|
|
|
3537
|
|
|
|
|
|
|
While it's probably not a massive overhead, this function is not an O(1) |
3538
|
|
|
|
|
|
|
operation. Check the extensions you care about after creating the GL context |
3539
|
|
|
|
|
|
|
and save that information somewhere instead of calling the function every time |
3540
|
|
|
|
|
|
|
you need to know. |
3541
|
|
|
|
|
|
|
|
3542
|
|
|
|
|
|
|
Expected parameters include: |
3543
|
|
|
|
|
|
|
|
3544
|
|
|
|
|
|
|
=over |
3545
|
|
|
|
|
|
|
|
3546
|
|
|
|
|
|
|
=item C - the name of the extension to check |
3547
|
|
|
|
|
|
|
|
3548
|
|
|
|
|
|
|
=back |
3549
|
|
|
|
|
|
|
|
3550
|
|
|
|
|
|
|
Returns true if the extension is supported, false otherwise. |
3551
|
|
|
|
|
|
|
|
3552
|
|
|
|
|
|
|
=head2 C |
3553
|
|
|
|
|
|
|
|
3554
|
|
|
|
|
|
|
Reset all previously set OpenGL context attributes to their default values. |
3555
|
|
|
|
|
|
|
|
3556
|
|
|
|
|
|
|
SDL_GL_ResetAttributes( ); |
3557
|
|
|
|
|
|
|
|
3558
|
|
|
|
|
|
|
=head2 C |
3559
|
|
|
|
|
|
|
|
3560
|
|
|
|
|
|
|
Set an OpenGL window attribute before window creation. |
3561
|
|
|
|
|
|
|
|
3562
|
|
|
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); |
3563
|
|
|
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); |
3564
|
|
|
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); |
3565
|
|
|
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); |
3566
|
|
|
|
|
|
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); |
3567
|
|
|
|
|
|
|
|
3568
|
|
|
|
|
|
|
This function sets the OpenGL attribute C to C. The requested |
3569
|
|
|
|
|
|
|
attributes should be set before creating an OpenGL window. You should use L<< |
3570
|
|
|
|
|
|
|
C|/C >> to check the |
3571
|
|
|
|
|
|
|
values after creating the OpenGL context, since the values obtained can differ |
3572
|
|
|
|
|
|
|
from the requested ones. |
3573
|
|
|
|
|
|
|
|
3574
|
|
|
|
|
|
|
Expected parameters include: |
3575
|
|
|
|
|
|
|
|
3576
|
|
|
|
|
|
|
=over |
3577
|
|
|
|
|
|
|
|
3578
|
|
|
|
|
|
|
=item C - an SDL_GLattr enum value specifying the OpenGL attribute to set |
3579
|
|
|
|
|
|
|
|
3580
|
|
|
|
|
|
|
=item C - the desired value for the attribute |
3581
|
|
|
|
|
|
|
|
3582
|
|
|
|
|
|
|
=back |
3583
|
|
|
|
|
|
|
|
3584
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
3585
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3586
|
|
|
|
|
|
|
|
3587
|
|
|
|
|
|
|
=head2 C |
3588
|
|
|
|
|
|
|
|
3589
|
|
|
|
|
|
|
Get the actual value for an attribute from the current context. |
3590
|
|
|
|
|
|
|
|
3591
|
|
|
|
|
|
|
my $value = SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER); |
3592
|
|
|
|
|
|
|
|
3593
|
|
|
|
|
|
|
Expected parameters include: |
3594
|
|
|
|
|
|
|
|
3595
|
|
|
|
|
|
|
=over |
3596
|
|
|
|
|
|
|
|
3597
|
|
|
|
|
|
|
=item C - an SDL_GLattr enum value specifying the OpenGL attribute to get |
3598
|
|
|
|
|
|
|
|
3599
|
|
|
|
|
|
|
=back |
3600
|
|
|
|
|
|
|
|
3601
|
|
|
|
|
|
|
Returns the value on success or a negative error code on failure; call L<< |
3602
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3603
|
|
|
|
|
|
|
|
3604
|
|
|
|
|
|
|
=head2 C |
3605
|
|
|
|
|
|
|
|
3606
|
|
|
|
|
|
|
Create an OpenGL context for an OpenGL window, and make it current. |
3607
|
|
|
|
|
|
|
|
3608
|
|
|
|
|
|
|
# Window mode MUST include SDL_WINDOW_OPENGL for use with OpenGL. |
3609
|
|
|
|
|
|
|
my $window = SDL_CreateWindow( |
3610
|
|
|
|
|
|
|
'SDL2/OpenGL Demo', 0, 0, 640, 480, |
3611
|
|
|
|
|
|
|
SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE); |
3612
|
|
|
|
|
|
|
|
3613
|
|
|
|
|
|
|
# Create an OpenGL context associated with the window |
3614
|
|
|
|
|
|
|
my $glcontext = SDL_GL_CreateContext( $window ); |
3615
|
|
|
|
|
|
|
|
3616
|
|
|
|
|
|
|
# now you can make GL calls. |
3617
|
|
|
|
|
|
|
glClearColor( 0, 0, 0 ,1 ); |
3618
|
|
|
|
|
|
|
glClear( GL_COLOR_BUFFER_BIT ); |
3619
|
|
|
|
|
|
|
SDL_GL_SwapWindow( $window ); |
3620
|
|
|
|
|
|
|
|
3621
|
|
|
|
|
|
|
# Once finished with OpenGL functions, the SDL_GLContext can be deleted. |
3622
|
|
|
|
|
|
|
SDL_GL_DeleteContext( $glcontext ); |
3623
|
|
|
|
|
|
|
|
3624
|
|
|
|
|
|
|
Windows users new to OpenGL should note that, for historical reasons, GL |
3625
|
|
|
|
|
|
|
functions added after OpenGL version 1.1 are not available by default. Those |
3626
|
|
|
|
|
|
|
functions must be loaded at run-time, either with an OpenGL extension-handling |
3627
|
|
|
|
|
|
|
library or with L<< C|/C
|
3628
|
|
|
|
|
|
|
... )> >> and its related functions. |
3629
|
|
|
|
|
|
|
|
3630
|
|
|
|
|
|
|
SDL2::GLContext is opaque to the application. |
3631
|
|
|
|
|
|
|
|
3632
|
|
|
|
|
|
|
Expected parameters include: |
3633
|
|
|
|
|
|
|
|
3634
|
|
|
|
|
|
|
=over |
3635
|
|
|
|
|
|
|
|
3636
|
|
|
|
|
|
|
=item C - the window to associate with the context |
3637
|
|
|
|
|
|
|
|
3638
|
|
|
|
|
|
|
=back |
3639
|
|
|
|
|
|
|
|
3640
|
|
|
|
|
|
|
Returns the OpenGL context associated with C or undef on error; call |
3641
|
|
|
|
|
|
|
L<< C|/C >>( ) for more details. |
3642
|
|
|
|
|
|
|
|
3643
|
|
|
|
|
|
|
=head2 C |
3644
|
|
|
|
|
|
|
|
3645
|
|
|
|
|
|
|
Set up an OpenGL context for rendering into an OpenGL window. |
3646
|
|
|
|
|
|
|
|
3647
|
|
|
|
|
|
|
SDL_GL_MakeCurrent( $window, $gl ); |
3648
|
|
|
|
|
|
|
|
3649
|
|
|
|
|
|
|
The context must have been created with a compatible window. |
3650
|
|
|
|
|
|
|
|
3651
|
|
|
|
|
|
|
Expected parameters include: |
3652
|
|
|
|
|
|
|
|
3653
|
|
|
|
|
|
|
=over |
3654
|
|
|
|
|
|
|
|
3655
|
|
|
|
|
|
|
=item C - the window to associate with the context |
3656
|
|
|
|
|
|
|
|
3657
|
|
|
|
|
|
|
=item C - the OpenGL context to associate with the window |
3658
|
|
|
|
|
|
|
|
3659
|
|
|
|
|
|
|
=back |
3660
|
|
|
|
|
|
|
|
3661
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
3662
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3663
|
|
|
|
|
|
|
|
3664
|
|
|
|
|
|
|
=head2 C |
3665
|
|
|
|
|
|
|
|
3666
|
|
|
|
|
|
|
Get the currently active OpenGL window. |
3667
|
|
|
|
|
|
|
|
3668
|
|
|
|
|
|
|
my $window = SDL_GL_GetCurrentWindow( ); |
3669
|
|
|
|
|
|
|
|
3670
|
|
|
|
|
|
|
Returns the currently active OpenGL window on success or undef on failure; call |
3671
|
|
|
|
|
|
|
L<< C|/C >>( ) for more information. |
3672
|
|
|
|
|
|
|
|
3673
|
|
|
|
|
|
|
=head2 C |
3674
|
|
|
|
|
|
|
|
3675
|
|
|
|
|
|
|
Get the currently active OpenGL context. |
3676
|
|
|
|
|
|
|
|
3677
|
|
|
|
|
|
|
my $gl = SDL_GL_GetCurrentContext( ); |
3678
|
|
|
|
|
|
|
|
3679
|
|
|
|
|
|
|
Returns the currently active OpenGL context or NULL on failure; call L<< |
3680
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3681
|
|
|
|
|
|
|
|
3682
|
|
|
|
|
|
|
=head2 C |
3683
|
|
|
|
|
|
|
|
3684
|
|
|
|
|
|
|
Get the size of a window's underlying drawable in pixels. |
3685
|
|
|
|
|
|
|
|
3686
|
|
|
|
|
|
|
my ($w, $h) = SDL_GL_GetDrawableSize( $window ); |
3687
|
|
|
|
|
|
|
|
3688
|
|
|
|
|
|
|
This returns info useful for calling C. |
3689
|
|
|
|
|
|
|
|
3690
|
|
|
|
|
|
|
This may differ from L<< C|/C
|
3691
|
|
|
|
|
|
|
)> >> if we're rendering to a high-DPI drawable, i.e. the window was created |
3692
|
|
|
|
|
|
|
with C on a platform with high-DPI support (Apple |
3693
|
|
|
|
|
|
|
calls this "Retina"), and not disabled by the |
3694
|
|
|
|
|
|
|
C hint. |
3695
|
|
|
|
|
|
|
|
3696
|
|
|
|
|
|
|
Expected parameters include: |
3697
|
|
|
|
|
|
|
|
3698
|
|
|
|
|
|
|
=over |
3699
|
|
|
|
|
|
|
|
3700
|
|
|
|
|
|
|
=item C - the window from which the drawable size should be queried |
3701
|
|
|
|
|
|
|
|
3702
|
|
|
|
|
|
|
=back |
3703
|
|
|
|
|
|
|
|
3704
|
|
|
|
|
|
|
Returns the width and height in pixels, either of which may be undefined. |
3705
|
|
|
|
|
|
|
|
3706
|
|
|
|
|
|
|
=head2 C |
3707
|
|
|
|
|
|
|
|
3708
|
|
|
|
|
|
|
Set the swap interval for the current OpenGL context. |
3709
|
|
|
|
|
|
|
|
3710
|
|
|
|
|
|
|
my $ok = !SDL_GL_SetSwapInterval( 1 ); |
3711
|
|
|
|
|
|
|
|
3712
|
|
|
|
|
|
|
Some systems allow specifying C<-1> for the interval, to enable adaptive vsync. |
3713
|
|
|
|
|
|
|
Adaptive vsync works the same as vsync, but if you've already missed the |
3714
|
|
|
|
|
|
|
vertical retrace for a given frame, it swaps buffers immediately, which might |
3715
|
|
|
|
|
|
|
be less jarring for the user during occasional framerate drops. If application |
3716
|
|
|
|
|
|
|
requests adaptive vsync and the system does not support it, this function will |
3717
|
|
|
|
|
|
|
fail and return C<-1>. In such a case, you should probably retry the call with |
3718
|
|
|
|
|
|
|
C<1> for the interval. |
3719
|
|
|
|
|
|
|
|
3720
|
|
|
|
|
|
|
Adaptive vsync is implemented for some glX drivers with |
3721
|
|
|
|
|
|
|
C: |
3722
|
|
|
|
|
|
|
L and for |
3723
|
|
|
|
|
|
|
some Windows drivers with C: |
3724
|
|
|
|
|
|
|
L |
3725
|
|
|
|
|
|
|
|
3726
|
|
|
|
|
|
|
Read more on the Khronos wiki: |
3727
|
|
|
|
|
|
|
L |
3728
|
|
|
|
|
|
|
|
3729
|
|
|
|
|
|
|
Expected parameters include: |
3730
|
|
|
|
|
|
|
|
3731
|
|
|
|
|
|
|
=over |
3732
|
|
|
|
|
|
|
|
3733
|
|
|
|
|
|
|
=item C - 0 for immediate updates, 1 for updates synchronized with the vertical retrace, -1 for adaptive vsync |
3734
|
|
|
|
|
|
|
|
3735
|
|
|
|
|
|
|
=back |
3736
|
|
|
|
|
|
|
|
3737
|
|
|
|
|
|
|
Returns C<0> on success or C<-1> if setting the swap interval is not supported; |
3738
|
|
|
|
|
|
|
call L<< C|/C >>( ) for more information. |
3739
|
|
|
|
|
|
|
|
3740
|
|
|
|
|
|
|
=head2 C |
3741
|
|
|
|
|
|
|
|
3742
|
|
|
|
|
|
|
Get the swap interval for the current OpenGL context. |
3743
|
|
|
|
|
|
|
|
3744
|
|
|
|
|
|
|
my $interval = SDL_GL_GetSwapInterval( ); |
3745
|
|
|
|
|
|
|
|
3746
|
|
|
|
|
|
|
If the system can't determine the swap interval, or there isn't a valid current |
3747
|
|
|
|
|
|
|
context, this function will return 0 as a safe default. |
3748
|
|
|
|
|
|
|
|
3749
|
|
|
|
|
|
|
Returns C<0> if there is no vertical retrace synchronization, C<1> if the |
3750
|
|
|
|
|
|
|
buffer swap is synchronized with the vertical retrace, and C<-1> if late swaps |
3751
|
|
|
|
|
|
|
happen immediately instead of waiting for the next retrace; call L<< |
3752
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3753
|
|
|
|
|
|
|
|
3754
|
|
|
|
|
|
|
=head2 C |
3755
|
|
|
|
|
|
|
|
3756
|
|
|
|
|
|
|
Update a window with OpenGL rendering. |
3757
|
|
|
|
|
|
|
|
3758
|
|
|
|
|
|
|
SDL_GL_SwapWindow( $window ); |
3759
|
|
|
|
|
|
|
|
3760
|
|
|
|
|
|
|
This is used with double-buffered OpenGL contexts, which are the default. |
3761
|
|
|
|
|
|
|
|
3762
|
|
|
|
|
|
|
On macOS, make sure you bind 0 to the draw framebuffer before swapping the |
3763
|
|
|
|
|
|
|
window, otherwise nothing will happen. If you aren't using C
|
3764
|
|
|
|
|
|
|
)>, this is the default and you won't have to do anything extra. |
3765
|
|
|
|
|
|
|
|
3766
|
|
|
|
|
|
|
Expected parameters include: |
3767
|
|
|
|
|
|
|
|
3768
|
|
|
|
|
|
|
=over |
3769
|
|
|
|
|
|
|
|
3770
|
|
|
|
|
|
|
=item C - the window to change |
3771
|
|
|
|
|
|
|
|
3772
|
|
|
|
|
|
|
=back |
3773
|
|
|
|
|
|
|
|
3774
|
|
|
|
|
|
|
=head2 C |
3775
|
|
|
|
|
|
|
|
3776
|
|
|
|
|
|
|
Delete an OpenGL context. |
3777
|
|
|
|
|
|
|
|
3778
|
|
|
|
|
|
|
SDL_GL_DeleteContext( $context ); |
3779
|
|
|
|
|
|
|
|
3780
|
|
|
|
|
|
|
Expected parameters include: |
3781
|
|
|
|
|
|
|
|
3782
|
|
|
|
|
|
|
=over |
3783
|
|
|
|
|
|
|
|
3784
|
|
|
|
|
|
|
=item C - the OpenGL context to be deleted |
3785
|
|
|
|
|
|
|
|
3786
|
|
|
|
|
|
|
=back |
3787
|
|
|
|
|
|
|
|
3788
|
|
|
|
|
|
|
=head2 2D Accelerated Rendering |
3789
|
|
|
|
|
|
|
|
3790
|
|
|
|
|
|
|
This category contains functions for 2D accelerated rendering. You may import |
3791
|
|
|
|
|
|
|
these functions with the C<:render> tag. |
3792
|
|
|
|
|
|
|
|
3793
|
|
|
|
|
|
|
This API supports the following features: |
3794
|
|
|
|
|
|
|
|
3795
|
|
|
|
|
|
|
=over |
3796
|
|
|
|
|
|
|
|
3797
|
|
|
|
|
|
|
=item single pixel points |
3798
|
|
|
|
|
|
|
|
3799
|
|
|
|
|
|
|
=item single pixel lines |
3800
|
|
|
|
|
|
|
|
3801
|
|
|
|
|
|
|
=item filled rectangles |
3802
|
|
|
|
|
|
|
|
3803
|
|
|
|
|
|
|
=item texture images |
3804
|
|
|
|
|
|
|
|
3805
|
|
|
|
|
|
|
=back |
3806
|
|
|
|
|
|
|
|
3807
|
|
|
|
|
|
|
All of these may be drawn in opaque, blended, or additive modes. |
3808
|
|
|
|
|
|
|
|
3809
|
|
|
|
|
|
|
The texture images can have an additional color tint or alpha modulation |
3810
|
|
|
|
|
|
|
applied to them, and may also be stretched with linear interpolation, rotated |
3811
|
|
|
|
|
|
|
or flipped/mirrored. |
3812
|
|
|
|
|
|
|
|
3813
|
|
|
|
|
|
|
For advanced functionality like particle effects or actual 3D you should use |
3814
|
|
|
|
|
|
|
SDL's OpenGL/Direct3D support or one of the many available 3D engines. |
3815
|
|
|
|
|
|
|
|
3816
|
|
|
|
|
|
|
This API is not designed to be used from multiple threads, see L
|
3817
|
|
|
|
|
|
|
#986|https://github.com/libsdl-org/SDL/issues/986> for details. |
3818
|
|
|
|
|
|
|
|
3819
|
|
|
|
|
|
|
=head2 C |
3820
|
|
|
|
|
|
|
|
3821
|
|
|
|
|
|
|
Get the number of 2D rendering drivers available for the current display. |
3822
|
|
|
|
|
|
|
|
3823
|
|
|
|
|
|
|
my $drivers = SDL_GetNumRenderDrivers( ); |
3824
|
|
|
|
|
|
|
|
3825
|
|
|
|
|
|
|
A render driver is a set of code that handles rendering and texture management |
3826
|
|
|
|
|
|
|
on a particular display. Normally there is only one, but some drivers may have |
3827
|
|
|
|
|
|
|
several available with different capabilities. |
3828
|
|
|
|
|
|
|
|
3829
|
|
|
|
|
|
|
There may be none if SDL was compiled without render support. |
3830
|
|
|
|
|
|
|
|
3831
|
|
|
|
|
|
|
Returns a number >= 0 on success or a negative error code on failure; call L<< |
3832
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3833
|
|
|
|
|
|
|
|
3834
|
|
|
|
|
|
|
=head2 C |
3835
|
|
|
|
|
|
|
|
3836
|
|
|
|
|
|
|
Get info about a specific 2D rendering driver for the current display. |
3837
|
|
|
|
|
|
|
|
3838
|
|
|
|
|
|
|
my $info = !SDL_GetRendererDriverInfo( ); |
3839
|
|
|
|
|
|
|
|
3840
|
|
|
|
|
|
|
Expected parameters include: |
3841
|
|
|
|
|
|
|
|
3842
|
|
|
|
|
|
|
=over |
3843
|
|
|
|
|
|
|
|
3844
|
|
|
|
|
|
|
=item C - the index of the driver to query information about |
3845
|
|
|
|
|
|
|
|
3846
|
|
|
|
|
|
|
=back |
3847
|
|
|
|
|
|
|
|
3848
|
|
|
|
|
|
|
Returns an L structure on success or a negative error code |
3849
|
|
|
|
|
|
|
on failure; call L<< C|/C >>( ) for more |
3850
|
|
|
|
|
|
|
information. |
3851
|
|
|
|
|
|
|
|
3852
|
|
|
|
|
|
|
=head2 C |
3853
|
|
|
|
|
|
|
|
3854
|
|
|
|
|
|
|
Create a window and default renderer. |
3855
|
|
|
|
|
|
|
|
3856
|
|
|
|
|
|
|
my ($window, $renderer) = SDL_CreateWindowAndRenderer(640, 480, 0); |
3857
|
|
|
|
|
|
|
|
3858
|
|
|
|
|
|
|
Expected parameters include: |
3859
|
|
|
|
|
|
|
|
3860
|
|
|
|
|
|
|
=over |
3861
|
|
|
|
|
|
|
|
3862
|
|
|
|
|
|
|
=item C - the width of the window |
3863
|
|
|
|
|
|
|
|
3864
|
|
|
|
|
|
|
=item C - the height of the window |
3865
|
|
|
|
|
|
|
|
3866
|
|
|
|
|
|
|
=item C - the flags used to create the window (see L<< C|/C >>) |
3867
|
|
|
|
|
|
|
|
3868
|
|
|
|
|
|
|
=back |
3869
|
|
|
|
|
|
|
|
3870
|
|
|
|
|
|
|
Returns a L and L objects on success, or -1 on |
3871
|
|
|
|
|
|
|
error; call L<< C|/C >>( ) for more |
3872
|
|
|
|
|
|
|
information. |
3873
|
|
|
|
|
|
|
|
3874
|
|
|
|
|
|
|
=head2 C |
3875
|
|
|
|
|
|
|
|
3876
|
|
|
|
|
|
|
Create a 2D rendering context for a window. |
3877
|
|
|
|
|
|
|
|
3878
|
|
|
|
|
|
|
my $renderer = SDL_CreateRenderer( $window, -1, 0); |
3879
|
|
|
|
|
|
|
|
3880
|
|
|
|
|
|
|
Expected parameters include: |
3881
|
|
|
|
|
|
|
|
3882
|
|
|
|
|
|
|
=over |
3883
|
|
|
|
|
|
|
|
3884
|
|
|
|
|
|
|
=item C - the window where rendering is displayed |
3885
|
|
|
|
|
|
|
|
3886
|
|
|
|
|
|
|
=item C - the index of the rendering driver to initialize, or C<-1> to initialize the first one supporting the requested flags |
3887
|
|
|
|
|
|
|
|
3888
|
|
|
|
|
|
|
=item C - C<0>, or one or more C OR'd together |
3889
|
|
|
|
|
|
|
|
3890
|
|
|
|
|
|
|
=back |
3891
|
|
|
|
|
|
|
|
3892
|
|
|
|
|
|
|
Returns a valid rendering context or undefined if there was an error; call L<< |
3893
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3894
|
|
|
|
|
|
|
|
3895
|
|
|
|
|
|
|
=head2 C |
3896
|
|
|
|
|
|
|
|
3897
|
|
|
|
|
|
|
Create a 2D software rendering context for a surface. |
3898
|
|
|
|
|
|
|
|
3899
|
|
|
|
|
|
|
my $renderer = SDL_CreateSoftwareRenderer( $surface ); |
3900
|
|
|
|
|
|
|
|
3901
|
|
|
|
|
|
|
Two other API which can be used to create SDL_Renderer: |
3902
|
|
|
|
|
|
|
|
3903
|
|
|
|
|
|
|
L<< C|/C >> and L<< |
3904
|
|
|
|
|
|
|
C|/C |
3905
|
|
|
|
|
|
|
>>. These can B create a software renderer, but they are intended to be |
3906
|
|
|
|
|
|
|
used with an L as the final destination and not an |
3907
|
|
|
|
|
|
|
L. |
3908
|
|
|
|
|
|
|
|
3909
|
|
|
|
|
|
|
Expected parameters include: |
3910
|
|
|
|
|
|
|
|
3911
|
|
|
|
|
|
|
=over |
3912
|
|
|
|
|
|
|
|
3913
|
|
|
|
|
|
|
=item C - the L structure representing the surface where rendering is done |
3914
|
|
|
|
|
|
|
|
3915
|
|
|
|
|
|
|
=back |
3916
|
|
|
|
|
|
|
|
3917
|
|
|
|
|
|
|
Returns a valid rendering context or undef if there was an error; call L<< |
3918
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3919
|
|
|
|
|
|
|
|
3920
|
|
|
|
|
|
|
=head2 C |
3921
|
|
|
|
|
|
|
|
3922
|
|
|
|
|
|
|
Get the renderer associated with a window. |
3923
|
|
|
|
|
|
|
|
3924
|
|
|
|
|
|
|
my $renderer = SDL_GetRenderer( $window ); |
3925
|
|
|
|
|
|
|
|
3926
|
|
|
|
|
|
|
Expected parameters include: |
3927
|
|
|
|
|
|
|
|
3928
|
|
|
|
|
|
|
=over |
3929
|
|
|
|
|
|
|
|
3930
|
|
|
|
|
|
|
=item C - the window to query |
3931
|
|
|
|
|
|
|
|
3932
|
|
|
|
|
|
|
=back |
3933
|
|
|
|
|
|
|
|
3934
|
|
|
|
|
|
|
Returns the rendering context on success or undef on failure; call L<< |
3935
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
3936
|
|
|
|
|
|
|
|
3937
|
|
|
|
|
|
|
=head2 C |
3938
|
|
|
|
|
|
|
|
3939
|
|
|
|
|
|
|
Get information about a rendering context. |
3940
|
|
|
|
|
|
|
|
3941
|
|
|
|
|
|
|
my $info = !SDL_GetRendererInfo( $renderer ); |
3942
|
|
|
|
|
|
|
|
3943
|
|
|
|
|
|
|
Expected parameters include: |
3944
|
|
|
|
|
|
|
|
3945
|
|
|
|
|
|
|
=over |
3946
|
|
|
|
|
|
|
|
3947
|
|
|
|
|
|
|
=item C - the rendering context |
3948
|
|
|
|
|
|
|
|
3949
|
|
|
|
|
|
|
=back |
3950
|
|
|
|
|
|
|
|
3951
|
|
|
|
|
|
|
Returns an L structure on success or a negative error code |
3952
|
|
|
|
|
|
|
on failure; call L<< C|/C >>( ) for more |
3953
|
|
|
|
|
|
|
information. |
3954
|
|
|
|
|
|
|
|
3955
|
|
|
|
|
|
|
=head2 C |
3956
|
|
|
|
|
|
|
|
3957
|
|
|
|
|
|
|
Get the output size in pixels of a rendering context. |
3958
|
|
|
|
|
|
|
|
3959
|
|
|
|
|
|
|
my ($w, $h) = SDL_GetRendererOutputSize( $renderer ); |
3960
|
|
|
|
|
|
|
|
3961
|
|
|
|
|
|
|
Due to high-dpi displays, you might end up with a rendering context that has |
3962
|
|
|
|
|
|
|
more pixels than the window that contains it, so use this instead of L<< |
3963
|
|
|
|
|
|
|
C|/C >> to decide how much |
3964
|
|
|
|
|
|
|
drawing area you have. |
3965
|
|
|
|
|
|
|
|
3966
|
|
|
|
|
|
|
Expected parameters include: |
3967
|
|
|
|
|
|
|
|
3968
|
|
|
|
|
|
|
=over |
3969
|
|
|
|
|
|
|
|
3970
|
|
|
|
|
|
|
=item C - the rendering context |
3971
|
|
|
|
|
|
|
|
3972
|
|
|
|
|
|
|
=back |
3973
|
|
|
|
|
|
|
|
3974
|
|
|
|
|
|
|
Returns the width and height on success or a negative error code on failure; |
3975
|
|
|
|
|
|
|
call L<< C|/C >>( ) for more information. |
3976
|
|
|
|
|
|
|
|
3977
|
|
|
|
|
|
|
=head2 C |
3978
|
|
|
|
|
|
|
|
3979
|
|
|
|
|
|
|
Create a texture for a rendering context. |
3980
|
|
|
|
|
|
|
|
3981
|
|
|
|
|
|
|
my $texture = SDL_CreateTexture( $renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, 1024, 768); |
3982
|
|
|
|
|
|
|
|
3983
|
|
|
|
|
|
|
=for TODO: https://gist.github.com/malja/2193bd656fe50c203f264ce554919976 |
3984
|
|
|
|
|
|
|
|
3985
|
|
|
|
|
|
|
You can set the texture scaling method by setting |
3986
|
|
|
|
|
|
|
C before creating the texture. |
3987
|
|
|
|
|
|
|
|
3988
|
|
|
|
|
|
|
Expected parameters include: |
3989
|
|
|
|
|
|
|
|
3990
|
|
|
|
|
|
|
=over |
3991
|
|
|
|
|
|
|
|
3992
|
|
|
|
|
|
|
=item C - the rendering context |
3993
|
|
|
|
|
|
|
|
3994
|
|
|
|
|
|
|
=item C - one of the enumerated values in C<:pixelFormatEnum> |
3995
|
|
|
|
|
|
|
|
3996
|
|
|
|
|
|
|
=item C - one of the enumerated values in C<:textureAccess> |
3997
|
|
|
|
|
|
|
|
3998
|
|
|
|
|
|
|
=item C - the width of the texture in pixels |
3999
|
|
|
|
|
|
|
|
4000
|
|
|
|
|
|
|
=item C - the height of the texture in pixels |
4001
|
|
|
|
|
|
|
|
4002
|
|
|
|
|
|
|
=back |
4003
|
|
|
|
|
|
|
|
4004
|
|
|
|
|
|
|
Returns a pointer to the created texture or undefined if no rendering context |
4005
|
|
|
|
|
|
|
was active, the format was unsupported, or the width or height were out of |
4006
|
|
|
|
|
|
|
range; call L<< C|/C >>( ) for more |
4007
|
|
|
|
|
|
|
information. |
4008
|
|
|
|
|
|
|
|
4009
|
|
|
|
|
|
|
=head2 C |
4010
|
|
|
|
|
|
|
|
4011
|
|
|
|
|
|
|
Create a texture from an existing surface. |
4012
|
|
|
|
|
|
|
|
4013
|
|
|
|
|
|
|
use Config; |
4014
|
|
|
|
|
|
|
my ($rmask, $gmask, $bmask, $amask) = |
4015
|
|
|
|
|
|
|
$Config{byteorder} == 4321 ? (0xff000000,0x00ff0000,0x0000ff00,0x000000ff) : |
4016
|
|
|
|
|
|
|
(0x000000ff,0x0000ff00,0x00ff0000,0xff000000); |
4017
|
|
|
|
|
|
|
my $surface = SDL_CreateRGBSurface( 0, 640, 480, 32, $rmask, $gmask, $bmask, $amask ); |
4018
|
|
|
|
|
|
|
my $texture = SDL_CreateTextureFromSurface( $renderer, $surface ); |
4019
|
|
|
|
|
|
|
|
4020
|
|
|
|
|
|
|
The surface is not modified or freed by this function. |
4021
|
|
|
|
|
|
|
|
4022
|
|
|
|
|
|
|
The SDL_TextureAccess hint for the created texture is |
4023
|
|
|
|
|
|
|
C. |
4024
|
|
|
|
|
|
|
|
4025
|
|
|
|
|
|
|
The pixel format of the created texture may be different from the pixel format |
4026
|
|
|
|
|
|
|
of the surface. Use L<< C|/C |
4027
|
|
|
|
|
|
|
>> to query the pixel format of the texture. |
4028
|
|
|
|
|
|
|
|
4029
|
|
|
|
|
|
|
Expected parameters include: |
4030
|
|
|
|
|
|
|
|
4031
|
|
|
|
|
|
|
=over |
4032
|
|
|
|
|
|
|
|
4033
|
|
|
|
|
|
|
=item C - the rendering context |
4034
|
|
|
|
|
|
|
|
4035
|
|
|
|
|
|
|
=item C - the L structure containing pixel data used to fill the texture |
4036
|
|
|
|
|
|
|
|
4037
|
|
|
|
|
|
|
=back |
4038
|
|
|
|
|
|
|
|
4039
|
|
|
|
|
|
|
Returns the created texture or undef on failure; call L<< C
|
4040
|
|
|
|
|
|
|
)>|/C >>( ) for more information. |
4041
|
|
|
|
|
|
|
|
4042
|
|
|
|
|
|
|
=head2 C |
4043
|
|
|
|
|
|
|
|
4044
|
|
|
|
|
|
|
Query the attributes of a texture. |
4045
|
|
|
|
|
|
|
|
4046
|
|
|
|
|
|
|
my ( $format, $access, $w, $h ) = SDL_QueryTexture( $texture ); |
4047
|
|
|
|
|
|
|
|
4048
|
|
|
|
|
|
|
Expected parameters include: |
4049
|
|
|
|
|
|
|
|
4050
|
|
|
|
|
|
|
=over |
4051
|
|
|
|
|
|
|
|
4052
|
|
|
|
|
|
|
=item C - the texture to query |
4053
|
|
|
|
|
|
|
|
4054
|
|
|
|
|
|
|
=back |
4055
|
|
|
|
|
|
|
|
4056
|
|
|
|
|
|
|
Returns the following on success... |
4057
|
|
|
|
|
|
|
|
4058
|
|
|
|
|
|
|
=over |
4059
|
|
|
|
|
|
|
|
4060
|
|
|
|
|
|
|
=item C - a pointer filled in with the raw format of the texture; the |
4061
|
|
|
|
|
|
|
actual format may differ, but pixel transfers will use this |
4062
|
|
|
|
|
|
|
format (one of the L<< C<:pixelFormatEnum>|/C<:pixelFormatEnum> >> values) |
4063
|
|
|
|
|
|
|
|
4064
|
|
|
|
|
|
|
=item C - a pointer filled in with the actual access to the texture (one of the L<< C<:textureAccess>|/C<:textureAccess> >> values) |
4065
|
|
|
|
|
|
|
|
4066
|
|
|
|
|
|
|
=item C - a pointer filled in with the width of the texture in pixels |
4067
|
|
|
|
|
|
|
|
4068
|
|
|
|
|
|
|
=item C - a pointer filled in with the height of the texture in pixels |
4069
|
|
|
|
|
|
|
|
4070
|
|
|
|
|
|
|
=back |
4071
|
|
|
|
|
|
|
|
4072
|
|
|
|
|
|
|
...or a negative error code on failure; call L<< C
|
4073
|
|
|
|
|
|
|
)>|/C >>( ) for more information. |
4074
|
|
|
|
|
|
|
|
4075
|
|
|
|
|
|
|
=head2 C |
4076
|
|
|
|
|
|
|
|
4077
|
|
|
|
|
|
|
Set an additional color value multiplied into render copy operations. |
4078
|
|
|
|
|
|
|
|
4079
|
|
|
|
|
|
|
my $ok = !SDL_SetTextureColorMod( $texture, 64, 64, 64 ); |
4080
|
|
|
|
|
|
|
|
4081
|
|
|
|
|
|
|
When this texture is rendered, during the copy operation each source color |
4082
|
|
|
|
|
|
|
channel is modulated by the appropriate color value according to the following |
4083
|
|
|
|
|
|
|
formula: |
4084
|
|
|
|
|
|
|
|
4085
|
|
|
|
|
|
|
srcC = srcC * (color / 255) |
4086
|
|
|
|
|
|
|
|
4087
|
|
|
|
|
|
|
Color modulation is not always supported by the renderer; it will return C<-1> |
4088
|
|
|
|
|
|
|
if color modulation is not supported. |
4089
|
|
|
|
|
|
|
|
4090
|
|
|
|
|
|
|
Expected parameters include: |
4091
|
|
|
|
|
|
|
|
4092
|
|
|
|
|
|
|
=over |
4093
|
|
|
|
|
|
|
|
4094
|
|
|
|
|
|
|
=item C - the texture to update |
4095
|
|
|
|
|
|
|
|
4096
|
|
|
|
|
|
|
=item C - the red color value multiplied into copy operations |
4097
|
|
|
|
|
|
|
|
4098
|
|
|
|
|
|
|
=item C - the green color value multiplied into copy operations |
4099
|
|
|
|
|
|
|
|
4100
|
|
|
|
|
|
|
=item C - the blue color value multiplied into copy operations |
4101
|
|
|
|
|
|
|
|
4102
|
|
|
|
|
|
|
=back |
4103
|
|
|
|
|
|
|
|
4104
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4105
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4106
|
|
|
|
|
|
|
|
4107
|
|
|
|
|
|
|
=head2 C |
4108
|
|
|
|
|
|
|
|
4109
|
|
|
|
|
|
|
Get the additional color value multiplied into render copy operations. |
4110
|
|
|
|
|
|
|
|
4111
|
|
|
|
|
|
|
my ( $r, $g, $b ) = SDL_GetTextureColorMod( $texture ); |
4112
|
|
|
|
|
|
|
|
4113
|
|
|
|
|
|
|
Expected parameters include: |
4114
|
|
|
|
|
|
|
|
4115
|
|
|
|
|
|
|
=over |
4116
|
|
|
|
|
|
|
|
4117
|
|
|
|
|
|
|
=item C - the texture to query |
4118
|
|
|
|
|
|
|
|
4119
|
|
|
|
|
|
|
=back |
4120
|
|
|
|
|
|
|
|
4121
|
|
|
|
|
|
|
Returns the current red, green, and blue color values on success or a negative |
4122
|
|
|
|
|
|
|
error code on failure; call L<< C|/C >>( ) |
4123
|
|
|
|
|
|
|
for more information. |
4124
|
|
|
|
|
|
|
|
4125
|
|
|
|
|
|
|
=head2 C |
4126
|
|
|
|
|
|
|
|
4127
|
|
|
|
|
|
|
Set an additional alpha value multiplied into render copy operations. |
4128
|
|
|
|
|
|
|
|
4129
|
|
|
|
|
|
|
SDL_SetTextureAlphaMod( $texture, 100 ); |
4130
|
|
|
|
|
|
|
|
4131
|
|
|
|
|
|
|
When this texture is rendered, during the copy operation the source alpha |
4132
|
|
|
|
|
|
|
|
4133
|
|
|
|
|
|
|
value is modulated by this alpha value according to the following formula: |
4134
|
|
|
|
|
|
|
|
4135
|
|
|
|
|
|
|
srcA = srcA * (alpha / 255) |
4136
|
|
|
|
|
|
|
|
4137
|
|
|
|
|
|
|
Alpha modulation is not always supported by the renderer; it will return C<-1> |
4138
|
|
|
|
|
|
|
if alpha modulation is not supported. |
4139
|
|
|
|
|
|
|
|
4140
|
|
|
|
|
|
|
Expected parameters include: |
4141
|
|
|
|
|
|
|
|
4142
|
|
|
|
|
|
|
=over |
4143
|
|
|
|
|
|
|
|
4144
|
|
|
|
|
|
|
=item C - the texture to update |
4145
|
|
|
|
|
|
|
|
4146
|
|
|
|
|
|
|
=item C - the source alpha value multiplied into copy operations |
4147
|
|
|
|
|
|
|
|
4148
|
|
|
|
|
|
|
=back |
4149
|
|
|
|
|
|
|
|
4150
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4151
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4152
|
|
|
|
|
|
|
|
4153
|
|
|
|
|
|
|
=head2 C |
4154
|
|
|
|
|
|
|
|
4155
|
|
|
|
|
|
|
Get the additional alpha value multiplied into render copy operations. |
4156
|
|
|
|
|
|
|
|
4157
|
|
|
|
|
|
|
my $alpha = SDL_GetTextureAlphaMod( $texture ); |
4158
|
|
|
|
|
|
|
|
4159
|
|
|
|
|
|
|
Expected parameters include: |
4160
|
|
|
|
|
|
|
|
4161
|
|
|
|
|
|
|
=over |
4162
|
|
|
|
|
|
|
|
4163
|
|
|
|
|
|
|
=item C - the texture to query |
4164
|
|
|
|
|
|
|
|
4165
|
|
|
|
|
|
|
=back |
4166
|
|
|
|
|
|
|
|
4167
|
|
|
|
|
|
|
Returns the current alpha value on success or a negative error code on failure; |
4168
|
|
|
|
|
|
|
call L<< C|/C >>( ) for more information. |
4169
|
|
|
|
|
|
|
|
4170
|
|
|
|
|
|
|
=head2 C |
4171
|
|
|
|
|
|
|
|
4172
|
|
|
|
|
|
|
Set the blend mode for a texture, used by L<< C
|
4173
|
|
|
|
|
|
|
)>|/C >>. |
4174
|
|
|
|
|
|
|
|
4175
|
|
|
|
|
|
|
If the blend mode is not supported, the closest supported mode is chosen and |
4176
|
|
|
|
|
|
|
this function returns C<-1>. |
4177
|
|
|
|
|
|
|
|
4178
|
|
|
|
|
|
|
Expected parameters include: |
4179
|
|
|
|
|
|
|
|
4180
|
|
|
|
|
|
|
=over |
4181
|
|
|
|
|
|
|
|
4182
|
|
|
|
|
|
|
=item C - the texture to update |
4183
|
|
|
|
|
|
|
|
4184
|
|
|
|
|
|
|
=item C - the L<< C<:blendMode>|/C<:blendMode> >> to use for texture blending |
4185
|
|
|
|
|
|
|
|
4186
|
|
|
|
|
|
|
=back |
4187
|
|
|
|
|
|
|
|
4188
|
|
|
|
|
|
|
Returns 0 on success or a negative error code on failure; call L<< |
4189
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4190
|
|
|
|
|
|
|
|
4191
|
|
|
|
|
|
|
=head2 C |
4192
|
|
|
|
|
|
|
|
4193
|
|
|
|
|
|
|
Get the blend mode used for texture copy operations. |
4194
|
|
|
|
|
|
|
|
4195
|
|
|
|
|
|
|
SDL_GetTextureBlendMode( $texture, SDL_BLENDMODE_ADD ); |
4196
|
|
|
|
|
|
|
|
4197
|
|
|
|
|
|
|
Expected parameters include: |
4198
|
|
|
|
|
|
|
|
4199
|
|
|
|
|
|
|
=over |
4200
|
|
|
|
|
|
|
|
4201
|
|
|
|
|
|
|
=item C - the texture to query |
4202
|
|
|
|
|
|
|
|
4203
|
|
|
|
|
|
|
=back |
4204
|
|
|
|
|
|
|
|
4205
|
|
|
|
|
|
|
Returns the current C<:blendMode> on success or a negative error code on |
4206
|
|
|
|
|
|
|
failure; call L<< C|/C >>( ) for more |
4207
|
|
|
|
|
|
|
information. |
4208
|
|
|
|
|
|
|
|
4209
|
|
|
|
|
|
|
=head2 C |
4210
|
|
|
|
|
|
|
|
4211
|
|
|
|
|
|
|
Set the scale mode used for texture scale operations. |
4212
|
|
|
|
|
|
|
|
4213
|
|
|
|
|
|
|
SDL_SetTextureScaleMode( $texture, $scaleMode ); |
4214
|
|
|
|
|
|
|
|
4215
|
|
|
|
|
|
|
If the scale mode is not supported, the closest supported mode is chosen. |
4216
|
|
|
|
|
|
|
|
4217
|
|
|
|
|
|
|
Expected parameters include: |
4218
|
|
|
|
|
|
|
|
4219
|
|
|
|
|
|
|
=over |
4220
|
|
|
|
|
|
|
|
4221
|
|
|
|
|
|
|
=item C - The texture to update. |
4222
|
|
|
|
|
|
|
|
4223
|
|
|
|
|
|
|
=item C - the SDL_ScaleMode to use for texture scaling. |
4224
|
|
|
|
|
|
|
|
4225
|
|
|
|
|
|
|
=back |
4226
|
|
|
|
|
|
|
|
4227
|
|
|
|
|
|
|
Returns C<0> on success, or C<-1> if the texture is not valid. |
4228
|
|
|
|
|
|
|
|
4229
|
|
|
|
|
|
|
=head2 C |
4230
|
|
|
|
|
|
|
|
4231
|
|
|
|
|
|
|
Get the scale mode used for texture scale operations. |
4232
|
|
|
|
|
|
|
|
4233
|
|
|
|
|
|
|
my $ok = SDL_GetTextureScaleMode( $texture ); |
4234
|
|
|
|
|
|
|
|
4235
|
|
|
|
|
|
|
Expected parameters include: |
4236
|
|
|
|
|
|
|
|
4237
|
|
|
|
|
|
|
=over |
4238
|
|
|
|
|
|
|
|
4239
|
|
|
|
|
|
|
=item C - the texture to query. |
4240
|
|
|
|
|
|
|
|
4241
|
|
|
|
|
|
|
=back |
4242
|
|
|
|
|
|
|
|
4243
|
|
|
|
|
|
|
Returns the current scale mode on success, or C<-1> if the texture is not |
4244
|
|
|
|
|
|
|
valid. |
4245
|
|
|
|
|
|
|
|
4246
|
|
|
|
|
|
|
=head2 C |
4247
|
|
|
|
|
|
|
|
4248
|
|
|
|
|
|
|
Update the given texture rectangle with new pixel data. |
4249
|
|
|
|
|
|
|
|
4250
|
|
|
|
|
|
|
my $rect = SDL2::Rect->new( { x => 0, y => ..., w => $surface->w, h => $surface->h } ); |
4251
|
|
|
|
|
|
|
SDL_UpdateTexture( $texture, $rect, $surface->pixels, $surface->pitch ); |
4252
|
|
|
|
|
|
|
|
4253
|
|
|
|
|
|
|
The pixel data must be in the pixel format of the texture. Use L<< |
4254
|
|
|
|
|
|
|
C|/C >> to query the pixel |
4255
|
|
|
|
|
|
|
format of the texture. |
4256
|
|
|
|
|
|
|
|
4257
|
|
|
|
|
|
|
This is a fairly slow function, intended for use with static textures that do |
4258
|
|
|
|
|
|
|
not change often. |
4259
|
|
|
|
|
|
|
|
4260
|
|
|
|
|
|
|
If the texture is intended to be updated often, it is preferred to create the |
4261
|
|
|
|
|
|
|
texture as streaming and use the locking functions referenced below. While this |
4262
|
|
|
|
|
|
|
function will work with streaming textures, for optimization reasons you may |
4263
|
|
|
|
|
|
|
not get the pixels back if you lock the texture afterward. |
4264
|
|
|
|
|
|
|
|
4265
|
|
|
|
|
|
|
Expected parameters include: |
4266
|
|
|
|
|
|
|
|
4267
|
|
|
|
|
|
|
=over |
4268
|
|
|
|
|
|
|
|
4269
|
|
|
|
|
|
|
=item C - the texture to update |
4270
|
|
|
|
|
|
|
|
4271
|
|
|
|
|
|
|
=item C - an L structure representing the area to update, or undef to update the entire texture |
4272
|
|
|
|
|
|
|
|
4273
|
|
|
|
|
|
|
=item C - the raw pixel data in the format of the texture |
4274
|
|
|
|
|
|
|
|
4275
|
|
|
|
|
|
|
=item C - the number of bytes in a row of pixel data, including padding between lines |
4276
|
|
|
|
|
|
|
|
4277
|
|
|
|
|
|
|
=back |
4278
|
|
|
|
|
|
|
|
4279
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4280
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4281
|
|
|
|
|
|
|
|
4282
|
|
|
|
|
|
|
=head2 C |
4283
|
|
|
|
|
|
|
|
4284
|
|
|
|
|
|
|
Update a rectangle within a planar YV12 or IYUV texture with new pixel data. |
4285
|
|
|
|
|
|
|
|
4286
|
|
|
|
|
|
|
SDL_UpdateYUVTexture( $texture, $rect, $yPlane, $yPitch, $uPlane, $uPitch, $vPlane, $vPitch ); |
4287
|
|
|
|
|
|
|
|
4288
|
|
|
|
|
|
|
You can use L<< C|/C >> as |
4289
|
|
|
|
|
|
|
long as your pixel data is a contiguous block of Y and U/V planes in the proper |
4290
|
|
|
|
|
|
|
order, but this function is available if your pixel data is not contiguous. |
4291
|
|
|
|
|
|
|
|
4292
|
|
|
|
|
|
|
Expected parameters include: |
4293
|
|
|
|
|
|
|
|
4294
|
|
|
|
|
|
|
=over |
4295
|
|
|
|
|
|
|
|
4296
|
|
|
|
|
|
|
=item C - the texture to update |
4297
|
|
|
|
|
|
|
|
4298
|
|
|
|
|
|
|
=item C - a pointer to the rectangle of pixels to update, or undef to update the entire texture |
4299
|
|
|
|
|
|
|
|
4300
|
|
|
|
|
|
|
=item C - the raw pixel data for the Y plane |
4301
|
|
|
|
|
|
|
|
4302
|
|
|
|
|
|
|
=item C - the number of bytes between rows of pixel data for the Y plane |
4303
|
|
|
|
|
|
|
|
4304
|
|
|
|
|
|
|
=item C - the raw pixel data for the U plane |
4305
|
|
|
|
|
|
|
|
4306
|
|
|
|
|
|
|
=item C - the number of bytes between rows of pixel data for the U plane |
4307
|
|
|
|
|
|
|
|
4308
|
|
|
|
|
|
|
=item C - the raw pixel data for the V plane |
4309
|
|
|
|
|
|
|
|
4310
|
|
|
|
|
|
|
=item C - the number of bytes between rows of pixel data for the V plane |
4311
|
|
|
|
|
|
|
|
4312
|
|
|
|
|
|
|
=back |
4313
|
|
|
|
|
|
|
|
4314
|
|
|
|
|
|
|
Returns C<0> on success or -1 if the texture is not valid; call L<< |
4315
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4316
|
|
|
|
|
|
|
|
4317
|
|
|
|
|
|
|
=head2 C |
4318
|
|
|
|
|
|
|
|
4319
|
|
|
|
|
|
|
Update a rectangle within a planar NV12 or NV21 texture with new pixels. |
4320
|
|
|
|
|
|
|
|
4321
|
|
|
|
|
|
|
SDL_UpdateNVTexture( $texture, $rect, $yPlane, $yPitch, $uPlane, $uPitch ); |
4322
|
|
|
|
|
|
|
|
4323
|
|
|
|
|
|
|
You can use L<< C|/C >> as |
4324
|
|
|
|
|
|
|
long as your pixel data is a contiguous block of NV12/21 planes in the proper |
4325
|
|
|
|
|
|
|
order, but this function is available if your pixel data is not contiguous. |
4326
|
|
|
|
|
|
|
|
4327
|
|
|
|
|
|
|
Expected parameters include: |
4328
|
|
|
|
|
|
|
|
4329
|
|
|
|
|
|
|
=over |
4330
|
|
|
|
|
|
|
|
4331
|
|
|
|
|
|
|
=item C - the texture to update |
4332
|
|
|
|
|
|
|
|
4333
|
|
|
|
|
|
|
=item C - a pointer to the rectangle of pixels to update, or undef to update the entire texture. |
4334
|
|
|
|
|
|
|
|
4335
|
|
|
|
|
|
|
=item C - the raw pixel data for the Y plane. |
4336
|
|
|
|
|
|
|
|
4337
|
|
|
|
|
|
|
=item C - the number of bytes between rows of pixel data for the Y plane. |
4338
|
|
|
|
|
|
|
|
4339
|
|
|
|
|
|
|
=item C - the raw pixel data for the UV plane. |
4340
|
|
|
|
|
|
|
|
4341
|
|
|
|
|
|
|
=item C - the number of bytes between rows of pixel data for the UV plane. |
4342
|
|
|
|
|
|
|
|
4343
|
|
|
|
|
|
|
=back |
4344
|
|
|
|
|
|
|
|
4345
|
|
|
|
|
|
|
Returns C<0> on success, or C<-1> if the texture is not valid. |
4346
|
|
|
|
|
|
|
|
4347
|
|
|
|
|
|
|
=head2 C |
4348
|
|
|
|
|
|
|
|
4349
|
|
|
|
|
|
|
Lock a portion of the texture for B pixel access. |
4350
|
|
|
|
|
|
|
|
4351
|
|
|
|
|
|
|
SDL_LockTexture( $texture, $rect, $pixels, $pitch ); |
4352
|
|
|
|
|
|
|
|
4353
|
|
|
|
|
|
|
As an optimization, the pixels made available for editing don't necessarily |
4354
|
|
|
|
|
|
|
contain the old texture data. This is a write-only operation, and if you need |
4355
|
|
|
|
|
|
|
to keep a copy of the texture data you should do that at the application level. |
4356
|
|
|
|
|
|
|
|
4357
|
|
|
|
|
|
|
You must use L<< C|/C >> to |
4358
|
|
|
|
|
|
|
unlock the pixels and apply any changes. |
4359
|
|
|
|
|
|
|
|
4360
|
|
|
|
|
|
|
Expected parameters include: |
4361
|
|
|
|
|
|
|
|
4362
|
|
|
|
|
|
|
=over |
4363
|
|
|
|
|
|
|
|
4364
|
|
|
|
|
|
|
=item C - the texture to lock for access, which was created with C |
4365
|
|
|
|
|
|
|
|
4366
|
|
|
|
|
|
|
=item C - an L structure representing the area to lock for access; undef to lock the entire texture |
4367
|
|
|
|
|
|
|
|
4368
|
|
|
|
|
|
|
=item C - this is filled in with a pointer to the locked pixels, appropriately offset by the locked area |
4369
|
|
|
|
|
|
|
|
4370
|
|
|
|
|
|
|
=item C - this is filled in with the pitch of the locked pixels; the pitch is the length of one row in bytes |
4371
|
|
|
|
|
|
|
|
4372
|
|
|
|
|
|
|
=back |
4373
|
|
|
|
|
|
|
|
4374
|
|
|
|
|
|
|
Returns 0 on success or a negative error code if the texture is not valid or |
4375
|
|
|
|
|
|
|
was not created with `SDL_TEXTUREACCESS_STREAMING`; call L<< C
|
4376
|
|
|
|
|
|
|
)>|/C >>( ) for more information. |
4377
|
|
|
|
|
|
|
|
4378
|
|
|
|
|
|
|
=head2 C |
4379
|
|
|
|
|
|
|
|
4380
|
|
|
|
|
|
|
Lock a portion of the texture for B pixel access, and expose it as |
4381
|
|
|
|
|
|
|
a SDL surface. |
4382
|
|
|
|
|
|
|
|
4383
|
|
|
|
|
|
|
my $surface = SDL_LockTextureSurface( $texture, $rect ); |
4384
|
|
|
|
|
|
|
|
4385
|
|
|
|
|
|
|
Besides providing an L instead of raw pixel data, this function |
4386
|
|
|
|
|
|
|
operates like L. |
4387
|
|
|
|
|
|
|
|
4388
|
|
|
|
|
|
|
As an optimization, the pixels made available for editing don't necessarily |
4389
|
|
|
|
|
|
|
contain the old texture data. This is a write-only operation, and if you need |
4390
|
|
|
|
|
|
|
to keep a copy of the texture data you should do that at the application level. |
4391
|
|
|
|
|
|
|
|
4392
|
|
|
|
|
|
|
You must use L<< C|/C >> to |
4393
|
|
|
|
|
|
|
unlock the pixels and apply any changes. |
4394
|
|
|
|
|
|
|
|
4395
|
|
|
|
|
|
|
The returned surface is freed internally after calling L<< C
|
4396
|
|
|
|
|
|
|
... )>|/C >> or L<< C
|
4397
|
|
|
|
|
|
|
)>|/C >>. The caller should not free it. |
4398
|
|
|
|
|
|
|
|
4399
|
|
|
|
|
|
|
Expected parameters include: |
4400
|
|
|
|
|
|
|
|
4401
|
|
|
|
|
|
|
=over |
4402
|
|
|
|
|
|
|
|
4403
|
|
|
|
|
|
|
=item C - the texture to lock for access, which was created with C |
4404
|
|
|
|
|
|
|
|
4405
|
|
|
|
|
|
|
=item C - a pointer to the rectangle to lock for access. If the rect is undef, the entire texture will be locked |
4406
|
|
|
|
|
|
|
|
4407
|
|
|
|
|
|
|
=back |
4408
|
|
|
|
|
|
|
|
4409
|
|
|
|
|
|
|
Returns the L structure on success, or C<-1> if the texture is |
4410
|
|
|
|
|
|
|
not valid or was not created with C. |
4411
|
|
|
|
|
|
|
|
4412
|
|
|
|
|
|
|
=head2 C |
4413
|
|
|
|
|
|
|
|
4414
|
|
|
|
|
|
|
Unlock a texture, uploading the changes to video memory, if needed. |
4415
|
|
|
|
|
|
|
|
4416
|
|
|
|
|
|
|
SDL_UnlockTexture( $texture ); |
4417
|
|
|
|
|
|
|
|
4418
|
|
|
|
|
|
|
B: Please note that L<< C|/C
|
4419
|
|
|
|
|
|
|
... )> >> is intended to be write-only; it will not guarantee the previous |
4420
|
|
|
|
|
|
|
contents of the texture will be provided. You must fully initialize any area of |
4421
|
|
|
|
|
|
|
a texture that you lock before unlocking it, as the pixels might otherwise be |
4422
|
|
|
|
|
|
|
uninitialized memory. |
4423
|
|
|
|
|
|
|
|
4424
|
|
|
|
|
|
|
Which is to say: locking and immediately unlocking a texture can result in |
4425
|
|
|
|
|
|
|
corrupted textures, depending on the renderer in use. |
4426
|
|
|
|
|
|
|
|
4427
|
|
|
|
|
|
|
Expected parameters include: |
4428
|
|
|
|
|
|
|
|
4429
|
|
|
|
|
|
|
=over |
4430
|
|
|
|
|
|
|
|
4431
|
|
|
|
|
|
|
=item C - a texture locked by L<< C|/C >> |
4432
|
|
|
|
|
|
|
|
4433
|
|
|
|
|
|
|
=back |
4434
|
|
|
|
|
|
|
|
4435
|
|
|
|
|
|
|
=head2 C |
4436
|
|
|
|
|
|
|
|
4437
|
|
|
|
|
|
|
Determine whether a renderer supports the use of render targets. |
4438
|
|
|
|
|
|
|
|
4439
|
|
|
|
|
|
|
my $bool = SDL_RenderTargetSupported( $renderer ); |
4440
|
|
|
|
|
|
|
|
4441
|
|
|
|
|
|
|
Expected parameters include: |
4442
|
|
|
|
|
|
|
|
4443
|
|
|
|
|
|
|
=over |
4444
|
|
|
|
|
|
|
|
4445
|
|
|
|
|
|
|
=item C - the renderer that will be checked |
4446
|
|
|
|
|
|
|
|
4447
|
|
|
|
|
|
|
=back |
4448
|
|
|
|
|
|
|
|
4449
|
|
|
|
|
|
|
Returns true if supported or false if not. |
4450
|
|
|
|
|
|
|
|
4451
|
|
|
|
|
|
|
=head2 C |
4452
|
|
|
|
|
|
|
|
4453
|
|
|
|
|
|
|
Set a texture as the current rendering target. |
4454
|
|
|
|
|
|
|
|
4455
|
|
|
|
|
|
|
SDL_SetRenderTarget( $renderer, $texture ); |
4456
|
|
|
|
|
|
|
|
4457
|
|
|
|
|
|
|
Before using this function, you should check the C |
4458
|
|
|
|
|
|
|
bit in the flags of L to see if render targets are |
4459
|
|
|
|
|
|
|
supported. |
4460
|
|
|
|
|
|
|
|
4461
|
|
|
|
|
|
|
The default render target is the window for which the renderer was created. To |
4462
|
|
|
|
|
|
|
stop rendering to a texture and render to the window again, call this function |
4463
|
|
|
|
|
|
|
with a undefined C. |
4464
|
|
|
|
|
|
|
|
4465
|
|
|
|
|
|
|
Expected parameters include: |
4466
|
|
|
|
|
|
|
|
4467
|
|
|
|
|
|
|
=over |
4468
|
|
|
|
|
|
|
|
4469
|
|
|
|
|
|
|
=item C - the rendering context |
4470
|
|
|
|
|
|
|
|
4471
|
|
|
|
|
|
|
=item C - the targeted texture, which must be created with the C flag, or undef to render to the window instead of a texture. |
4472
|
|
|
|
|
|
|
|
4473
|
|
|
|
|
|
|
=back |
4474
|
|
|
|
|
|
|
|
4475
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4476
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4477
|
|
|
|
|
|
|
|
4478
|
|
|
|
|
|
|
=head2 C |
4479
|
|
|
|
|
|
|
|
4480
|
|
|
|
|
|
|
Get the current render target. |
4481
|
|
|
|
|
|
|
|
4482
|
|
|
|
|
|
|
my $texture = SDL_GetRenderTarget( $renderer ); |
4483
|
|
|
|
|
|
|
|
4484
|
|
|
|
|
|
|
The default render target is the window for which the renderer was created, and |
4485
|
|
|
|
|
|
|
is reported an undefined value here. |
4486
|
|
|
|
|
|
|
|
4487
|
|
|
|
|
|
|
Expected parameters include: |
4488
|
|
|
|
|
|
|
|
4489
|
|
|
|
|
|
|
=over |
4490
|
|
|
|
|
|
|
|
4491
|
|
|
|
|
|
|
=item C - the rendering context |
4492
|
|
|
|
|
|
|
|
4493
|
|
|
|
|
|
|
=back |
4494
|
|
|
|
|
|
|
|
4495
|
|
|
|
|
|
|
Returns the current render target or undef for the default render target. |
4496
|
|
|
|
|
|
|
|
4497
|
|
|
|
|
|
|
=head2 C |
4498
|
|
|
|
|
|
|
|
4499
|
|
|
|
|
|
|
Set a device independent resolution for rendering. |
4500
|
|
|
|
|
|
|
|
4501
|
|
|
|
|
|
|
SDL_RenderSetLogicalSize( $renderer, 100, 100 ); |
4502
|
|
|
|
|
|
|
|
4503
|
|
|
|
|
|
|
This function uses the viewport and scaling functionality to allow a fixed |
4504
|
|
|
|
|
|
|
logical resolution for rendering, regardless of the actual output resolution. |
4505
|
|
|
|
|
|
|
If the actual output resolution doesn't have the same aspect ratio the output |
4506
|
|
|
|
|
|
|
rendering will be centered within the output display. |
4507
|
|
|
|
|
|
|
|
4508
|
|
|
|
|
|
|
If the output display is a window, mouse and touch events in the window will be |
4509
|
|
|
|
|
|
|
filtered and scaled so they seem to arrive within the logical resolution. |
4510
|
|
|
|
|
|
|
|
4511
|
|
|
|
|
|
|
If this function results in scaling or subpixel drawing by the rendering |
4512
|
|
|
|
|
|
|
backend, it will be handled using the appropriate quality hints. |
4513
|
|
|
|
|
|
|
|
4514
|
|
|
|
|
|
|
Expected parameters include: |
4515
|
|
|
|
|
|
|
|
4516
|
|
|
|
|
|
|
=over |
4517
|
|
|
|
|
|
|
|
4518
|
|
|
|
|
|
|
=item C - the renderer for which resolution should be set |
4519
|
|
|
|
|
|
|
|
4520
|
|
|
|
|
|
|
=item C - the width of the logical resolution |
4521
|
|
|
|
|
|
|
|
4522
|
|
|
|
|
|
|
=item C - the height of the logical resolution |
4523
|
|
|
|
|
|
|
|
4524
|
|
|
|
|
|
|
=back |
4525
|
|
|
|
|
|
|
|
4526
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4527
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4528
|
|
|
|
|
|
|
|
4529
|
|
|
|
|
|
|
=head2 C |
4530
|
|
|
|
|
|
|
|
4531
|
|
|
|
|
|
|
Get device independent resolution for rendering. |
4532
|
|
|
|
|
|
|
|
4533
|
|
|
|
|
|
|
my ($w, $h) = SDL_RenderGetLogicalSize( $renderer ); |
4534
|
|
|
|
|
|
|
|
4535
|
|
|
|
|
|
|
This may return C<0> for C and C if the L has never had |
4536
|
|
|
|
|
|
|
its logical size set by L<< C
|
4537
|
|
|
|
|
|
|
)>|/C >> and never had a render target set. |
4538
|
|
|
|
|
|
|
|
4539
|
|
|
|
|
|
|
Expected parameters include: |
4540
|
|
|
|
|
|
|
|
4541
|
|
|
|
|
|
|
=over |
4542
|
|
|
|
|
|
|
|
4543
|
|
|
|
|
|
|
=item C - a rendering context |
4544
|
|
|
|
|
|
|
|
4545
|
|
|
|
|
|
|
=back |
4546
|
|
|
|
|
|
|
|
4547
|
|
|
|
|
|
|
Returns the width and height. |
4548
|
|
|
|
|
|
|
|
4549
|
|
|
|
|
|
|
=head2 C |
4550
|
|
|
|
|
|
|
|
4551
|
|
|
|
|
|
|
Set whether to force integer scales for resolution-independent rendering. |
4552
|
|
|
|
|
|
|
|
4553
|
|
|
|
|
|
|
SDL_RenderSetIntegerScale( $renderer, 1 ); |
4554
|
|
|
|
|
|
|
|
4555
|
|
|
|
|
|
|
This function restricts the logical viewport to integer values - that is, when |
4556
|
|
|
|
|
|
|
a resolution is between two multiples of a logical size, the viewport size is |
4557
|
|
|
|
|
|
|
rounded down to the lower multiple. |
4558
|
|
|
|
|
|
|
|
4559
|
|
|
|
|
|
|
Expected parameters include: |
4560
|
|
|
|
|
|
|
|
4561
|
|
|
|
|
|
|
=over |
4562
|
|
|
|
|
|
|
|
4563
|
|
|
|
|
|
|
=item C - the renderer for which integer scaling should be set |
4564
|
|
|
|
|
|
|
|
4565
|
|
|
|
|
|
|
=item C - enable or disable the integer scaling for rendering |
4566
|
|
|
|
|
|
|
|
4567
|
|
|
|
|
|
|
=back |
4568
|
|
|
|
|
|
|
|
4569
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4570
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4571
|
|
|
|
|
|
|
|
4572
|
|
|
|
|
|
|
=head2 C |
4573
|
|
|
|
|
|
|
|
4574
|
|
|
|
|
|
|
Get whether integer scales are forced for resolution-independent rendering. |
4575
|
|
|
|
|
|
|
|
4576
|
|
|
|
|
|
|
SDL_RenderGetIntegerScale( $renderer ); |
4577
|
|
|
|
|
|
|
|
4578
|
|
|
|
|
|
|
Expected parameters include: |
4579
|
|
|
|
|
|
|
|
4580
|
|
|
|
|
|
|
=over |
4581
|
|
|
|
|
|
|
|
4582
|
|
|
|
|
|
|
=item C - the renderer from which integer scaling should be queried |
4583
|
|
|
|
|
|
|
|
4584
|
|
|
|
|
|
|
=back |
4585
|
|
|
|
|
|
|
|
4586
|
|
|
|
|
|
|
Returns true if integer scales are forced or false if not and on failure; call |
4587
|
|
|
|
|
|
|
L<< C|/C >>( ) for more information. |
4588
|
|
|
|
|
|
|
|
4589
|
|
|
|
|
|
|
=head2 C |
4590
|
|
|
|
|
|
|
|
4591
|
|
|
|
|
|
|
Set the drawing area for rendering on the current target. |
4592
|
|
|
|
|
|
|
|
4593
|
|
|
|
|
|
|
SDL_RenderSetViewport( $renderer, $rect ); |
4594
|
|
|
|
|
|
|
|
4595
|
|
|
|
|
|
|
When the window is resized, the viewport is reset to fill the entire new window |
4596
|
|
|
|
|
|
|
size. |
4597
|
|
|
|
|
|
|
|
4598
|
|
|
|
|
|
|
Expected parameters include: |
4599
|
|
|
|
|
|
|
|
4600
|
|
|
|
|
|
|
=over |
4601
|
|
|
|
|
|
|
|
4602
|
|
|
|
|
|
|
=item C - the rendering context |
4603
|
|
|
|
|
|
|
|
4604
|
|
|
|
|
|
|
=item C - the L structure representing the drawing area, or undef to set the viewport to the entire target |
4605
|
|
|
|
|
|
|
|
4606
|
|
|
|
|
|
|
=back |
4607
|
|
|
|
|
|
|
|
4608
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4609
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4610
|
|
|
|
|
|
|
|
4611
|
|
|
|
|
|
|
=head2 C |
4612
|
|
|
|
|
|
|
|
4613
|
|
|
|
|
|
|
Get the drawing area for the current target. |
4614
|
|
|
|
|
|
|
|
4615
|
|
|
|
|
|
|
my $rect = SDL_RenderGetViewport( $renderer ); |
4616
|
|
|
|
|
|
|
|
4617
|
|
|
|
|
|
|
Expected parameters include: |
4618
|
|
|
|
|
|
|
|
4619
|
|
|
|
|
|
|
=over |
4620
|
|
|
|
|
|
|
|
4621
|
|
|
|
|
|
|
=item C - the rendering context |
4622
|
|
|
|
|
|
|
|
4623
|
|
|
|
|
|
|
=back |
4624
|
|
|
|
|
|
|
|
4625
|
|
|
|
|
|
|
Returns an L structure filled in with the current drawing area. |
4626
|
|
|
|
|
|
|
|
4627
|
|
|
|
|
|
|
=head2 C |
4628
|
|
|
|
|
|
|
|
4629
|
|
|
|
|
|
|
Set the clip rectangle for rendering on the specified target. |
4630
|
|
|
|
|
|
|
|
4631
|
|
|
|
|
|
|
SDL_RenderSetClipRect( $renderer, $rect ); |
4632
|
|
|
|
|
|
|
|
4633
|
|
|
|
|
|
|
Expected parameters include: |
4634
|
|
|
|
|
|
|
|
4635
|
|
|
|
|
|
|
=over |
4636
|
|
|
|
|
|
|
|
4637
|
|
|
|
|
|
|
=item C - the rendering context for which clip rectangle should be set |
4638
|
|
|
|
|
|
|
|
4639
|
|
|
|
|
|
|
=item C - an L structure representing the clip area, relative to the viewport, or undef to disable clipping |
4640
|
|
|
|
|
|
|
|
4641
|
|
|
|
|
|
|
=back |
4642
|
|
|
|
|
|
|
|
4643
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4644
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4645
|
|
|
|
|
|
|
|
4646
|
|
|
|
|
|
|
=head2 C |
4647
|
|
|
|
|
|
|
|
4648
|
|
|
|
|
|
|
Get the clip rectangle for the current target. |
4649
|
|
|
|
|
|
|
|
4650
|
|
|
|
|
|
|
my $rect = SDL_RenderGetClipRect( $renderer ); |
4651
|
|
|
|
|
|
|
|
4652
|
|
|
|
|
|
|
Expected parameters include: |
4653
|
|
|
|
|
|
|
|
4654
|
|
|
|
|
|
|
=over |
4655
|
|
|
|
|
|
|
|
4656
|
|
|
|
|
|
|
=item C - the rendering context from which clip rectangle should be queried |
4657
|
|
|
|
|
|
|
|
4658
|
|
|
|
|
|
|
=back |
4659
|
|
|
|
|
|
|
|
4660
|
|
|
|
|
|
|
Returns an L structure filled in with the current clipping area or |
4661
|
|
|
|
|
|
|
an empty rectangle if clipping is disabled. |
4662
|
|
|
|
|
|
|
|
4663
|
|
|
|
|
|
|
=head2 C |
4664
|
|
|
|
|
|
|
|
4665
|
|
|
|
|
|
|
Get whether clipping is enabled on the given renderer. |
4666
|
|
|
|
|
|
|
|
4667
|
|
|
|
|
|
|
my $tf = SDL_RenderIsClipEnabled( $renderer ); |
4668
|
|
|
|
|
|
|
|
4669
|
|
|
|
|
|
|
Expected parameters include: |
4670
|
|
|
|
|
|
|
|
4671
|
|
|
|
|
|
|
=over |
4672
|
|
|
|
|
|
|
|
4673
|
|
|
|
|
|
|
=item C - the renderer from which clip state should be queried |
4674
|
|
|
|
|
|
|
|
4675
|
|
|
|
|
|
|
=back |
4676
|
|
|
|
|
|
|
|
4677
|
|
|
|
|
|
|
Returns true if clipping is enabled or false if not; call L<< C
|
4678
|
|
|
|
|
|
|
)>|/C >>( ) for more information. |
4679
|
|
|
|
|
|
|
|
4680
|
|
|
|
|
|
|
=head2 C |
4681
|
|
|
|
|
|
|
|
4682
|
|
|
|
|
|
|
Set the drawing scale for rendering on the current target. |
4683
|
|
|
|
|
|
|
|
4684
|
|
|
|
|
|
|
SDL_RenderSetScale( $renderer, .5, 1 ); |
4685
|
|
|
|
|
|
|
|
4686
|
|
|
|
|
|
|
The drawing coordinates are scaled by the x/y scaling factors before they are |
4687
|
|
|
|
|
|
|
used by the renderer. This allows resolution independent drawing with a single |
4688
|
|
|
|
|
|
|
coordinate system. |
4689
|
|
|
|
|
|
|
|
4690
|
|
|
|
|
|
|
If this results in scaling or subpixel drawing by the rendering backend, it |
4691
|
|
|
|
|
|
|
will be handled using the appropriate quality hints. For best results use |
4692
|
|
|
|
|
|
|
integer scaling factors. |
4693
|
|
|
|
|
|
|
|
4694
|
|
|
|
|
|
|
Expected parameters include: |
4695
|
|
|
|
|
|
|
|
4696
|
|
|
|
|
|
|
=over |
4697
|
|
|
|
|
|
|
|
4698
|
|
|
|
|
|
|
=item C - a rendering context |
4699
|
|
|
|
|
|
|
|
4700
|
|
|
|
|
|
|
=item C - the horizontal scaling factor |
4701
|
|
|
|
|
|
|
|
4702
|
|
|
|
|
|
|
=item C - the vertical scaling factor |
4703
|
|
|
|
|
|
|
|
4704
|
|
|
|
|
|
|
=back |
4705
|
|
|
|
|
|
|
|
4706
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4707
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4708
|
|
|
|
|
|
|
|
4709
|
|
|
|
|
|
|
=head2 C |
4710
|
|
|
|
|
|
|
|
4711
|
|
|
|
|
|
|
Get the drawing scale for the current target. |
4712
|
|
|
|
|
|
|
|
4713
|
|
|
|
|
|
|
my ($scaleX, $scaleY) = SDL_RenderGetScale( $renderer ); |
4714
|
|
|
|
|
|
|
|
4715
|
|
|
|
|
|
|
Expected parameters include: |
4716
|
|
|
|
|
|
|
|
4717
|
|
|
|
|
|
|
=over |
4718
|
|
|
|
|
|
|
|
4719
|
|
|
|
|
|
|
=item C - the renderer from which drawing scale should be queried |
4720
|
|
|
|
|
|
|
|
4721
|
|
|
|
|
|
|
=back |
4722
|
|
|
|
|
|
|
|
4723
|
|
|
|
|
|
|
Returns the horizonal and vertical scaling factors. |
4724
|
|
|
|
|
|
|
|
4725
|
|
|
|
|
|
|
=head2 C |
4726
|
|
|
|
|
|
|
|
4727
|
|
|
|
|
|
|
Set the color used for drawing operations (Rect, Line and Clear). |
4728
|
|
|
|
|
|
|
|
4729
|
|
|
|
|
|
|
SDL_SetRenderDrawColor( $renderer, 0, 0, 128, SDL_ALPHA_OPAQUE ); |
4730
|
|
|
|
|
|
|
|
4731
|
|
|
|
|
|
|
Set the color for drawing or filling rectangles, lines, and points, and for L<< |
4732
|
|
|
|
|
|
|
C|/C >>. |
4733
|
|
|
|
|
|
|
|
4734
|
|
|
|
|
|
|
Expected parameters include: |
4735
|
|
|
|
|
|
|
|
4736
|
|
|
|
|
|
|
=over |
4737
|
|
|
|
|
|
|
|
4738
|
|
|
|
|
|
|
=item C - the rendering context |
4739
|
|
|
|
|
|
|
|
4740
|
|
|
|
|
|
|
=item C - the red value used to draw on the rendering target |
4741
|
|
|
|
|
|
|
|
4742
|
|
|
|
|
|
|
=item C - the green value used to draw on the rendering target |
4743
|
|
|
|
|
|
|
|
4744
|
|
|
|
|
|
|
=item C - the blue value used to draw on the rendering target |
4745
|
|
|
|
|
|
|
|
4746
|
|
|
|
|
|
|
=item C - the alpha value used to draw on the rendering target; usually C (255). Use C to specify how the alpha channel is used |
4747
|
|
|
|
|
|
|
|
4748
|
|
|
|
|
|
|
=back |
4749
|
|
|
|
|
|
|
|
4750
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4751
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4752
|
|
|
|
|
|
|
|
4753
|
|
|
|
|
|
|
=head2 C |
4754
|
|
|
|
|
|
|
|
4755
|
|
|
|
|
|
|
Get the color used for drawing operations (Rect, Line and Clear). |
4756
|
|
|
|
|
|
|
|
4757
|
|
|
|
|
|
|
my ($r, $g, $b, $a) = SDL_GetRenderDrawColor( $renderer ); |
4758
|
|
|
|
|
|
|
|
4759
|
|
|
|
|
|
|
Expected parameters include: |
4760
|
|
|
|
|
|
|
|
4761
|
|
|
|
|
|
|
=over |
4762
|
|
|
|
|
|
|
|
4763
|
|
|
|
|
|
|
=item C - the rendering context |
4764
|
|
|
|
|
|
|
|
4765
|
|
|
|
|
|
|
=back |
4766
|
|
|
|
|
|
|
|
4767
|
|
|
|
|
|
|
Returns red, green, blue, and alpha values on success or a negative error code |
4768
|
|
|
|
|
|
|
on failure; call L<< C|/C >>( ) for more |
4769
|
|
|
|
|
|
|
information. |
4770
|
|
|
|
|
|
|
|
4771
|
|
|
|
|
|
|
=head2 C |
4772
|
|
|
|
|
|
|
|
4773
|
|
|
|
|
|
|
Set the blend mode used for drawing operations (Fill and Line). |
4774
|
|
|
|
|
|
|
|
4775
|
|
|
|
|
|
|
SDL_SetRenderDrawBlendMode( $renderer, SDL_BLENDMODE_BLEND ); |
4776
|
|
|
|
|
|
|
|
4777
|
|
|
|
|
|
|
If the blend mode is not supported, the closest supported mode is chosen. |
4778
|
|
|
|
|
|
|
|
4779
|
|
|
|
|
|
|
Expected parameters include: |
4780
|
|
|
|
|
|
|
|
4781
|
|
|
|
|
|
|
=over |
4782
|
|
|
|
|
|
|
|
4783
|
|
|
|
|
|
|
=item C - the rendering context |
4784
|
|
|
|
|
|
|
|
4785
|
|
|
|
|
|
|
=item C - the L<< C<:blendMode>|/C<:blendMode> >> to use for blending |
4786
|
|
|
|
|
|
|
|
4787
|
|
|
|
|
|
|
=back |
4788
|
|
|
|
|
|
|
|
4789
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4790
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4791
|
|
|
|
|
|
|
|
4792
|
|
|
|
|
|
|
=head2 C |
4793
|
|
|
|
|
|
|
|
4794
|
|
|
|
|
|
|
Get the blend mode used for drawing operations. |
4795
|
|
|
|
|
|
|
|
4796
|
|
|
|
|
|
|
my $blendMode = SDL_GetRenderDrawBlendMode( $rendering ); |
4797
|
|
|
|
|
|
|
|
4798
|
|
|
|
|
|
|
Expected parameters include: |
4799
|
|
|
|
|
|
|
|
4800
|
|
|
|
|
|
|
=over |
4801
|
|
|
|
|
|
|
|
4802
|
|
|
|
|
|
|
=item C - the rendering context |
4803
|
|
|
|
|
|
|
|
4804
|
|
|
|
|
|
|
=back |
4805
|
|
|
|
|
|
|
|
4806
|
|
|
|
|
|
|
Returns the current C<:blendMode> on success or a negative error code on |
4807
|
|
|
|
|
|
|
failure; call L<< C|/C >>( ) for more |
4808
|
|
|
|
|
|
|
information. |
4809
|
|
|
|
|
|
|
|
4810
|
|
|
|
|
|
|
=head2 C |
4811
|
|
|
|
|
|
|
|
4812
|
|
|
|
|
|
|
Clear the current rendering target with the drawing color. |
4813
|
|
|
|
|
|
|
|
4814
|
|
|
|
|
|
|
SDL_RenderClear( $renderer ); |
4815
|
|
|
|
|
|
|
|
4816
|
|
|
|
|
|
|
This function clears the entire rendering target, ignoring the viewport and the |
4817
|
|
|
|
|
|
|
clip rectangle. |
4818
|
|
|
|
|
|
|
|
4819
|
|
|
|
|
|
|
=over |
4820
|
|
|
|
|
|
|
|
4821
|
|
|
|
|
|
|
=item C - the rendering context |
4822
|
|
|
|
|
|
|
|
4823
|
|
|
|
|
|
|
=back |
4824
|
|
|
|
|
|
|
|
4825
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4826
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4827
|
|
|
|
|
|
|
|
4828
|
|
|
|
|
|
|
=head2 C |
4829
|
|
|
|
|
|
|
|
4830
|
|
|
|
|
|
|
Draw a point on the current rendering target. |
4831
|
|
|
|
|
|
|
|
4832
|
|
|
|
|
|
|
SDL_RenderDrawPoint( $renderer, 100, 100 ); |
4833
|
|
|
|
|
|
|
|
4834
|
|
|
|
|
|
|
C draws a single point. If you want to draw |
4835
|
|
|
|
|
|
|
multiple, use L<< C|/C
|
4836
|
|
|
|
|
|
|
)> >> instead. |
4837
|
|
|
|
|
|
|
|
4838
|
|
|
|
|
|
|
Expected parameters include: |
4839
|
|
|
|
|
|
|
|
4840
|
|
|
|
|
|
|
=over |
4841
|
|
|
|
|
|
|
|
4842
|
|
|
|
|
|
|
=item C - the rendering context |
4843
|
|
|
|
|
|
|
|
4844
|
|
|
|
|
|
|
=item C - the x coordinate of the point |
4845
|
|
|
|
|
|
|
|
4846
|
|
|
|
|
|
|
=item C - the y coordinate of the point |
4847
|
|
|
|
|
|
|
|
4848
|
|
|
|
|
|
|
=back |
4849
|
|
|
|
|
|
|
|
4850
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4851
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4852
|
|
|
|
|
|
|
|
4853
|
|
|
|
|
|
|
=head2 C |
4854
|
|
|
|
|
|
|
|
4855
|
|
|
|
|
|
|
Draw multiple points on the current rendering target. |
4856
|
|
|
|
|
|
|
|
4857
|
|
|
|
|
|
|
my @points = map { SDL2::Point->new( {x => int rand, y => int rand } ) } 1..1024; |
4858
|
|
|
|
|
|
|
SDL_RenderDrawPoints( $renderer, @points ); |
4859
|
|
|
|
|
|
|
|
4860
|
|
|
|
|
|
|
=over |
4861
|
|
|
|
|
|
|
|
4862
|
|
|
|
|
|
|
=item C - the rendering context |
4863
|
|
|
|
|
|
|
|
4864
|
|
|
|
|
|
|
=item C - an array of L structures that represent the points to draw |
4865
|
|
|
|
|
|
|
|
4866
|
|
|
|
|
|
|
=back |
4867
|
|
|
|
|
|
|
|
4868
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4869
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4870
|
|
|
|
|
|
|
|
4871
|
|
|
|
|
|
|
=head2 C |
4872
|
|
|
|
|
|
|
|
4873
|
|
|
|
|
|
|
Draw a line on the current rendering target. |
4874
|
|
|
|
|
|
|
|
4875
|
|
|
|
|
|
|
SDL_RenderDrawLine( $renderer, 300, 240, 340, 240 ); |
4876
|
|
|
|
|
|
|
|
4877
|
|
|
|
|
|
|
C draws the line to include both end points. If you |
4878
|
|
|
|
|
|
|
want to draw multiple, connecting lines use L<< C
|
4879
|
|
|
|
|
|
|
)>|/C >> instead. |
4880
|
|
|
|
|
|
|
|
4881
|
|
|
|
|
|
|
Expected parameters include: |
4882
|
|
|
|
|
|
|
|
4883
|
|
|
|
|
|
|
=over |
4884
|
|
|
|
|
|
|
|
4885
|
|
|
|
|
|
|
=item C - the rendering context |
4886
|
|
|
|
|
|
|
|
4887
|
|
|
|
|
|
|
=item C - the x coordinate of the start point |
4888
|
|
|
|
|
|
|
|
4889
|
|
|
|
|
|
|
=item C - the y coordinate of the start point |
4890
|
|
|
|
|
|
|
|
4891
|
|
|
|
|
|
|
=item C - the x coordinate of the end point |
4892
|
|
|
|
|
|
|
|
4893
|
|
|
|
|
|
|
=item C - the y coordinate of the end point |
4894
|
|
|
|
|
|
|
|
4895
|
|
|
|
|
|
|
=back |
4896
|
|
|
|
|
|
|
|
4897
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4898
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4899
|
|
|
|
|
|
|
|
4900
|
|
|
|
|
|
|
=head2 C |
4901
|
|
|
|
|
|
|
|
4902
|
|
|
|
|
|
|
Draw a series of connected lines on the current rendering target. |
4903
|
|
|
|
|
|
|
|
4904
|
|
|
|
|
|
|
SDL_RenderDrawLines( $renderer, @points); |
4905
|
|
|
|
|
|
|
|
4906
|
|
|
|
|
|
|
Expected parameters include: |
4907
|
|
|
|
|
|
|
|
4908
|
|
|
|
|
|
|
=over |
4909
|
|
|
|
|
|
|
|
4910
|
|
|
|
|
|
|
=item C - the rendering context |
4911
|
|
|
|
|
|
|
|
4912
|
|
|
|
|
|
|
=item C - an array of L structures representing points along the lines |
4913
|
|
|
|
|
|
|
|
4914
|
|
|
|
|
|
|
=back |
4915
|
|
|
|
|
|
|
|
4916
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4917
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4918
|
|
|
|
|
|
|
|
4919
|
|
|
|
|
|
|
=head2 C |
4920
|
|
|
|
|
|
|
|
4921
|
|
|
|
|
|
|
Draw a rectangle on the current rendering target. |
4922
|
|
|
|
|
|
|
|
4923
|
|
|
|
|
|
|
SDL_RenderDrawRect( $renderer, SDL2::Rect->new( { x => 100, y => 100, w => 100, h => 100 } ) ); |
4924
|
|
|
|
|
|
|
|
4925
|
|
|
|
|
|
|
Expected parameters include: |
4926
|
|
|
|
|
|
|
|
4927
|
|
|
|
|
|
|
=over |
4928
|
|
|
|
|
|
|
|
4929
|
|
|
|
|
|
|
=item C - the rendering context |
4930
|
|
|
|
|
|
|
|
4931
|
|
|
|
|
|
|
=item C - an L structure representing the rectangle to draw |
4932
|
|
|
|
|
|
|
|
4933
|
|
|
|
|
|
|
=for TODO - or undef to outline the entire rendering target |
4934
|
|
|
|
|
|
|
|
4935
|
|
|
|
|
|
|
=back |
4936
|
|
|
|
|
|
|
|
4937
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4938
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4939
|
|
|
|
|
|
|
|
4940
|
|
|
|
|
|
|
=head2 C |
4941
|
|
|
|
|
|
|
|
4942
|
|
|
|
|
|
|
Draw some number of rectangles on the current rendering target. |
4943
|
|
|
|
|
|
|
|
4944
|
|
|
|
|
|
|
SDL_RenderDrawRects( $renderer, |
4945
|
|
|
|
|
|
|
SDL2::Rect->new( { x => 100, y => 100, w => 100, h => 100 } ), |
4946
|
|
|
|
|
|
|
SDL2::Rect->new( { x => 75, y => 75, w => 50, h => 50 } ) |
4947
|
|
|
|
|
|
|
); |
4948
|
|
|
|
|
|
|
|
4949
|
|
|
|
|
|
|
Expected parameters include: |
4950
|
|
|
|
|
|
|
|
4951
|
|
|
|
|
|
|
=over |
4952
|
|
|
|
|
|
|
|
4953
|
|
|
|
|
|
|
=item C - the rendering context |
4954
|
|
|
|
|
|
|
|
4955
|
|
|
|
|
|
|
=item C - an array of SDL2::Rect structures representing the rectangles to be drawn |
4956
|
|
|
|
|
|
|
|
4957
|
|
|
|
|
|
|
=back |
4958
|
|
|
|
|
|
|
|
4959
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4960
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4961
|
|
|
|
|
|
|
|
4962
|
|
|
|
|
|
|
=head2 C |
4963
|
|
|
|
|
|
|
|
4964
|
|
|
|
|
|
|
Fill a rectangle on the current rendering target with the drawing color. |
4965
|
|
|
|
|
|
|
|
4966
|
|
|
|
|
|
|
SDL_RenderFillRect( $renderer, SDL2::Rect->new( { x => 100, y => 100, w => 100, h => 100 } ) ); |
4967
|
|
|
|
|
|
|
|
4968
|
|
|
|
|
|
|
The current drawing color is set by L<< C
|
4969
|
|
|
|
|
|
|
)>|/C >>, and the color's alpha value is ignored |
4970
|
|
|
|
|
|
|
unless blending is enabled with the appropriate call to L<< |
4971
|
|
|
|
|
|
|
C|/C >>. |
4972
|
|
|
|
|
|
|
|
4973
|
|
|
|
|
|
|
Expected parameters include: |
4974
|
|
|
|
|
|
|
|
4975
|
|
|
|
|
|
|
=over |
4976
|
|
|
|
|
|
|
|
4977
|
|
|
|
|
|
|
=item C - the rendering context |
4978
|
|
|
|
|
|
|
|
4979
|
|
|
|
|
|
|
=item C - the L structure representing the rectangle to fill |
4980
|
|
|
|
|
|
|
|
4981
|
|
|
|
|
|
|
=for TODO - or undef for the entire rendering target |
4982
|
|
|
|
|
|
|
|
4983
|
|
|
|
|
|
|
=back |
4984
|
|
|
|
|
|
|
|
4985
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
4986
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
4987
|
|
|
|
|
|
|
|
4988
|
|
|
|
|
|
|
=head2 C |
4989
|
|
|
|
|
|
|
|
4990
|
|
|
|
|
|
|
Fill some number of rectangles on the current rendering target with the drawing |
4991
|
|
|
|
|
|
|
color. |
4992
|
|
|
|
|
|
|
|
4993
|
|
|
|
|
|
|
SDL_RenderFillRects( $renderer, |
4994
|
|
|
|
|
|
|
SDL2::Rect->new( { x => 100, y => 100, w => 100, h => 100 } ), |
4995
|
|
|
|
|
|
|
SDL2::Rect->new( { x => 75, y => 75, w => 50, h => 50 } ) |
4996
|
|
|
|
|
|
|
); |
4997
|
|
|
|
|
|
|
|
4998
|
|
|
|
|
|
|
Expected parameters include: |
4999
|
|
|
|
|
|
|
|
5000
|
|
|
|
|
|
|
=over |
5001
|
|
|
|
|
|
|
|
5002
|
|
|
|
|
|
|
=item C - the rendering context |
5003
|
|
|
|
|
|
|
|
5004
|
|
|
|
|
|
|
=item C - an array of L structures representing the rectangles to be filled |
5005
|
|
|
|
|
|
|
|
5006
|
|
|
|
|
|
|
=back |
5007
|
|
|
|
|
|
|
|
5008
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
5009
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
5010
|
|
|
|
|
|
|
|
5011
|
|
|
|
|
|
|
=head2 C |
5012
|
|
|
|
|
|
|
|
5013
|
|
|
|
|
|
|
Copy a portion of the texture to the current rendering target. |
5014
|
|
|
|
|
|
|
|
5015
|
|
|
|
|
|
|
SDL_RenderCopy( $renderer, $blueShapes, $srcR, $destR ); |
5016
|
|
|
|
|
|
|
|
5017
|
|
|
|
|
|
|
The texture is blended with the destination based on its blend mode set with |
5018
|
|
|
|
|
|
|
L<< C|/C >>. |
5019
|
|
|
|
|
|
|
|
5020
|
|
|
|
|
|
|
The texture color is affected based on its color modulation set by L<< |
5021
|
|
|
|
|
|
|
C|/C >>. |
5022
|
|
|
|
|
|
|
|
5023
|
|
|
|
|
|
|
The texture alpha is affected based on its alpha modulation set by L<< |
5024
|
|
|
|
|
|
|
C|/C >>. |
5025
|
|
|
|
|
|
|
|
5026
|
|
|
|
|
|
|
Expected parameters include: |
5027
|
|
|
|
|
|
|
|
5028
|
|
|
|
|
|
|
=over |
5029
|
|
|
|
|
|
|
|
5030
|
|
|
|
|
|
|
=item C - the rendering context |
5031
|
|
|
|
|
|
|
|
5032
|
|
|
|
|
|
|
=item C - the source texture |
5033
|
|
|
|
|
|
|
|
5034
|
|
|
|
|
|
|
=item C - the source L structure |
5035
|
|
|
|
|
|
|
|
5036
|
|
|
|
|
|
|
=for TODO: or NULL for the entire texture |
5037
|
|
|
|
|
|
|
|
5038
|
|
|
|
|
|
|
=item C - the destination L structure; the texture will be stretched to fill the given rectangle |
5039
|
|
|
|
|
|
|
|
5040
|
|
|
|
|
|
|
=for TODO or NULL for the entire rendering target; |
5041
|
|
|
|
|
|
|
|
5042
|
|
|
|
|
|
|
=back |
5043
|
|
|
|
|
|
|
|
5044
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
5045
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
5046
|
|
|
|
|
|
|
|
5047
|
|
|
|
|
|
|
=head2 C |
5048
|
|
|
|
|
|
|
|
5049
|
|
|
|
|
|
|
Copy a portion of the texture to the current rendering, with optional rotation |
5050
|
|
|
|
|
|
|
and flipping. |
5051
|
|
|
|
|
|
|
|
5052
|
|
|
|
|
|
|
=for TODO: I need an example for this... it's complex |
5053
|
|
|
|
|
|
|
|
5054
|
|
|
|
|
|
|
Copy a portion of the texture to the current rendering target, optionally |
5055
|
|
|
|
|
|
|
rotating it by angle around the given center and also flipping it top-bottom |
5056
|
|
|
|
|
|
|
and/or left-right. |
5057
|
|
|
|
|
|
|
|
5058
|
|
|
|
|
|
|
The texture is blended with the destination based on its blend mode set with |
5059
|
|
|
|
|
|
|
L<< C|/C >>. |
5060
|
|
|
|
|
|
|
|
5061
|
|
|
|
|
|
|
The texture color is affected based on its color modulation set by L<< |
5062
|
|
|
|
|
|
|
C|/C >>. |
5063
|
|
|
|
|
|
|
|
5064
|
|
|
|
|
|
|
The texture alpha is affected based on its alpha modulation set by L<< |
5065
|
|
|
|
|
|
|
C|/C >>. |
5066
|
|
|
|
|
|
|
|
5067
|
|
|
|
|
|
|
Expected parameters include: |
5068
|
|
|
|
|
|
|
|
5069
|
|
|
|
|
|
|
=over |
5070
|
|
|
|
|
|
|
|
5071
|
|
|
|
|
|
|
=item C - the rendering context |
5072
|
|
|
|
|
|
|
|
5073
|
|
|
|
|
|
|
=item C - the source texture |
5074
|
|
|
|
|
|
|
|
5075
|
|
|
|
|
|
|
=item C - the source L structure |
5076
|
|
|
|
|
|
|
|
5077
|
|
|
|
|
|
|
=for TODO: or NULL for the entire texture |
5078
|
|
|
|
|
|
|
|
5079
|
|
|
|
|
|
|
=item C - the destination SDL_Rect structure |
5080
|
|
|
|
|
|
|
|
5081
|
|
|
|
|
|
|
=for TODO: or NULL for the entire rendering target |
5082
|
|
|
|
|
|
|
|
5083
|
|
|
|
|
|
|
=item C - an angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction |
5084
|
|
|
|
|
|
|
|
5085
|
|
|
|
|
|
|
=item C - a pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around C, C) |
5086
|
|
|
|
|
|
|
|
5087
|
|
|
|
|
|
|
=item C - a L<:rendererFlip> value stating which flipping actions should be performed on the texture |
5088
|
|
|
|
|
|
|
|
5089
|
|
|
|
|
|
|
=back |
5090
|
|
|
|
|
|
|
|
5091
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
5092
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
5093
|
|
|
|
|
|
|
|
5094
|
|
|
|
|
|
|
=head2 C |
5095
|
|
|
|
|
|
|
|
5096
|
|
|
|
|
|
|
Draw a point on the current rendering target at subpixel precision. |
5097
|
|
|
|
|
|
|
|
5098
|
|
|
|
|
|
|
SDL_RenderDrawPointF( $renderer, 25.5, 100.25 ); |
5099
|
|
|
|
|
|
|
|
5100
|
|
|
|
|
|
|
Expected parameters include: |
5101
|
|
|
|
|
|
|
|
5102
|
|
|
|
|
|
|
=over |
5103
|
|
|
|
|
|
|
|
5104
|
|
|
|
|
|
|
=item C - The renderer which should draw a point. |
5105
|
|
|
|
|
|
|
|
5106
|
|
|
|
|
|
|
=item C - The x coordinate of the point. |
5107
|
|
|
|
|
|
|
|
5108
|
|
|
|
|
|
|
=item C - The y coordinate of the point. |
5109
|
|
|
|
|
|
|
|
5110
|
|
|
|
|
|
|
=back |
5111
|
|
|
|
|
|
|
|
5112
|
|
|
|
|
|
|
Returns C<0> on success, or C<-1> on error |
5113
|
|
|
|
|
|
|
|
5114
|
|
|
|
|
|
|
=head2 C |
5115
|
|
|
|
|
|
|
|
5116
|
|
|
|
|
|
|
Draw multiple points on the current rendering target at subpixel precision. |
5117
|
|
|
|
|
|
|
|
5118
|
|
|
|
|
|
|
my @points = map { SDL2::Point->new( {x => int rand, y => int rand } ) } 1..1024; |
5119
|
|
|
|
|
|
|
SDL_RenderDrawPointsF( $renderer, @points ); |
5120
|
|
|
|
|
|
|
|
5121
|
|
|
|
|
|
|
Expected parameters include: |
5122
|
|
|
|
|
|
|
|
5123
|
|
|
|
|
|
|
=over |
5124
|
|
|
|
|
|
|
|
5125
|
|
|
|
|
|
|
=item C - The renderer which should draw multiple points |
5126
|
|
|
|
|
|
|
|
5127
|
|
|
|
|
|
|
=item C - The points to draw |
5128
|
|
|
|
|
|
|
|
5129
|
|
|
|
|
|
|
=back |
5130
|
|
|
|
|
|
|
|
5131
|
|
|
|
|
|
|
Returns C<0> on success, or C<-1> on error; call L<< C
|
5132
|
|
|
|
|
|
|
)>|/C >>( ) for more information. |
5133
|
|
|
|
|
|
|
|
5134
|
|
|
|
|
|
|
=head2 C |
5135
|
|
|
|
|
|
|
|
5136
|
|
|
|
|
|
|
Draw a line on the current rendering target at subpixel precision. |
5137
|
|
|
|
|
|
|
|
5138
|
|
|
|
|
|
|
SDL_RenderDrawLineF( $renderer, 100, 100, 250, 100); |
5139
|
|
|
|
|
|
|
|
5140
|
|
|
|
|
|
|
Expected parameters include: |
5141
|
|
|
|
|
|
|
|
5142
|
|
|
|
|
|
|
=over |
5143
|
|
|
|
|
|
|
|
5144
|
|
|
|
|
|
|
=item C - The renderer which should draw a line. |
5145
|
|
|
|
|
|
|
|
5146
|
|
|
|
|
|
|
=item C - The x coordinate of the start point. |
5147
|
|
|
|
|
|
|
|
5148
|
|
|
|
|
|
|
=item C - The y coordinate of the start point. |
5149
|
|
|
|
|
|
|
|
5150
|
|
|
|
|
|
|
=item C - The x coordinate of the end point. |
5151
|
|
|
|
|
|
|
|
5152
|
|
|
|
|
|
|
=item C - The y coordinate of the end point. |
5153
|
|
|
|
|
|
|
|
5154
|
|
|
|
|
|
|
=back |
5155
|
|
|
|
|
|
|
|
5156
|
|
|
|
|
|
|
Returns C<0> on success, or C<-1> on error. |
5157
|
|
|
|
|
|
|
|
5158
|
|
|
|
|
|
|
=head2 C |
5159
|
|
|
|
|
|
|
|
5160
|
|
|
|
|
|
|
Draw a series of connected lines on the current rendering target at subpixel |
5161
|
|
|
|
|
|
|
precision. |
5162
|
|
|
|
|
|
|
|
5163
|
|
|
|
|
|
|
SDL_RenderDrawLines( $renderer, @points); |
5164
|
|
|
|
|
|
|
|
5165
|
|
|
|
|
|
|
Expected parameters include: |
5166
|
|
|
|
|
|
|
|
5167
|
|
|
|
|
|
|
=over |
5168
|
|
|
|
|
|
|
|
5169
|
|
|
|
|
|
|
=item C - The renderer which should draw multiple lines. |
5170
|
|
|
|
|
|
|
|
5171
|
|
|
|
|
|
|
=item C - The points along the lines |
5172
|
|
|
|
|
|
|
|
5173
|
|
|
|
|
|
|
=back |
5174
|
|
|
|
|
|
|
|
5175
|
|
|
|
|
|
|
Return C<0> on success, or C<-1> on error. |
5176
|
|
|
|
|
|
|
|
5177
|
|
|
|
|
|
|
=head2 C |
5178
|
|
|
|
|
|
|
|
5179
|
|
|
|
|
|
|
Draw a rectangle on the current rendering target at subpixel precision. |
5180
|
|
|
|
|
|
|
|
5181
|
|
|
|
|
|
|
SDL_RenderDrawRectF( $renderer, $point); |
5182
|
|
|
|
|
|
|
|
5183
|
|
|
|
|
|
|
Expected parameters include: |
5184
|
|
|
|
|
|
|
|
5185
|
|
|
|
|
|
|
=over |
5186
|
|
|
|
|
|
|
|
5187
|
|
|
|
|
|
|
=item C - The renderer which should draw a rectangle. |
5188
|
|
|
|
|
|
|
|
5189
|
|
|
|
|
|
|
=item C - A pointer to the destination rectangle |
5190
|
|
|
|
|
|
|
|
5191
|
|
|
|
|
|
|
=for TODO: or NULL to outline the entire rendering target. |
5192
|
|
|
|
|
|
|
|
5193
|
|
|
|
|
|
|
=back |
5194
|
|
|
|
|
|
|
|
5195
|
|
|
|
|
|
|
Returns C<0> on success, or C<-1> on error |
5196
|
|
|
|
|
|
|
|
5197
|
|
|
|
|
|
|
=head2 C |
5198
|
|
|
|
|
|
|
|
5199
|
|
|
|
|
|
|
Draw some number of rectangles on the current rendering target at subpixel |
5200
|
|
|
|
|
|
|
precision. |
5201
|
|
|
|
|
|
|
|
5202
|
|
|
|
|
|
|
SDL_RenderDrawRectsF( $renderer, |
5203
|
|
|
|
|
|
|
SDL2::Rect->new( { x => 100, y => 100, w => 100, h => 100 } ), |
5204
|
|
|
|
|
|
|
SDL2::Rect->new( { x => 75, y => 75, w => 50, h => 50 } ) |
5205
|
|
|
|
|
|
|
); |
5206
|
|
|
|
|
|
|
|
5207
|
|
|
|
|
|
|
Expected parameters include: |
5208
|
|
|
|
|
|
|
|
5209
|
|
|
|
|
|
|
=over |
5210
|
|
|
|
|
|
|
|
5211
|
|
|
|
|
|
|
=item C - The renderer which should draw multiple rectangles. |
5212
|
|
|
|
|
|
|
|
5213
|
|
|
|
|
|
|
=item C - A pointer to an array of destination rectangles. |
5214
|
|
|
|
|
|
|
|
5215
|
|
|
|
|
|
|
=back |
5216
|
|
|
|
|
|
|
|
5217
|
|
|
|
|
|
|
Returns C<0> on success, or C<-1> on error. |
5218
|
|
|
|
|
|
|
|
5219
|
|
|
|
|
|
|
=head2 C |
5220
|
|
|
|
|
|
|
|
5221
|
|
|
|
|
|
|
Fill a rectangle on the current rendering target with the drawing color at |
5222
|
|
|
|
|
|
|
subpixel precision. |
5223
|
|
|
|
|
|
|
|
5224
|
|
|
|
|
|
|
SDL_RenderFillRectF( $renderer, |
5225
|
|
|
|
|
|
|
SDL2::Rect->new( { x => 75, y => 75, w => 50, h => 50 } ) |
5226
|
|
|
|
|
|
|
); |
5227
|
|
|
|
|
|
|
|
5228
|
|
|
|
|
|
|
Expected parameters include: |
5229
|
|
|
|
|
|
|
|
5230
|
|
|
|
|
|
|
=over |
5231
|
|
|
|
|
|
|
|
5232
|
|
|
|
|
|
|
=item C - The renderer which should fill a rectangle. |
5233
|
|
|
|
|
|
|
|
5234
|
|
|
|
|
|
|
=item C - A pointer to the destination rectangle |
5235
|
|
|
|
|
|
|
|
5236
|
|
|
|
|
|
|
=for TODO: or NULL for the entire rendering target. |
5237
|
|
|
|
|
|
|
|
5238
|
|
|
|
|
|
|
=back |
5239
|
|
|
|
|
|
|
|
5240
|
|
|
|
|
|
|
Returns C<0> on success, or C<-1> on error. |
5241
|
|
|
|
|
|
|
|
5242
|
|
|
|
|
|
|
=head2 C |
5243
|
|
|
|
|
|
|
|
5244
|
|
|
|
|
|
|
Fill some number of rectangles on the current rendering target with the drawing |
5245
|
|
|
|
|
|
|
color at subpixel precision. |
5246
|
|
|
|
|
|
|
|
5247
|
|
|
|
|
|
|
SDL_RenderFillRectsF( $renderer, |
5248
|
|
|
|
|
|
|
SDL2::Rect->new( { x => 100, y => 100, w => 100, h => 100 } ), |
5249
|
|
|
|
|
|
|
SDL2::Rect->new( { x => 75, y => 75, w => 50, h => 50 } ) |
5250
|
|
|
|
|
|
|
); |
5251
|
|
|
|
|
|
|
|
5252
|
|
|
|
|
|
|
Expected parameters include: |
5253
|
|
|
|
|
|
|
|
5254
|
|
|
|
|
|
|
=over |
5255
|
|
|
|
|
|
|
|
5256
|
|
|
|
|
|
|
=item C - The renderer which should fill multiple rectangles. |
5257
|
|
|
|
|
|
|
|
5258
|
|
|
|
|
|
|
=item C - A pointer to an array of destination rectangles. |
5259
|
|
|
|
|
|
|
|
5260
|
|
|
|
|
|
|
=back |
5261
|
|
|
|
|
|
|
|
5262
|
|
|
|
|
|
|
Returns C<0> on success, or C<-1> on error. |
5263
|
|
|
|
|
|
|
|
5264
|
|
|
|
|
|
|
=head2 C |
5265
|
|
|
|
|
|
|
|
5266
|
|
|
|
|
|
|
Copy a portion of the texture to the current rendering target at subpixel |
5267
|
|
|
|
|
|
|
precision. |
5268
|
|
|
|
|
|
|
|
5269
|
|
|
|
|
|
|
=for TODO: I need to come up with an example for this as well |
5270
|
|
|
|
|
|
|
|
5271
|
|
|
|
|
|
|
Expected parameters include: |
5272
|
|
|
|
|
|
|
|
5273
|
|
|
|
|
|
|
=over |
5274
|
|
|
|
|
|
|
|
5275
|
|
|
|
|
|
|
=item C - The renderer which should copy parts of a texture |
5276
|
|
|
|
|
|
|
|
5277
|
|
|
|
|
|
|
=item C - The source texture |
5278
|
|
|
|
|
|
|
|
5279
|
|
|
|
|
|
|
=item C - A pointer to the source rectangle |
5280
|
|
|
|
|
|
|
|
5281
|
|
|
|
|
|
|
=for TODO: or NULL for the entiretexture. |
5282
|
|
|
|
|
|
|
|
5283
|
|
|
|
|
|
|
=item C - A pointer to the destination rectangle |
5284
|
|
|
|
|
|
|
|
5285
|
|
|
|
|
|
|
=for TODO: or NULL for the entire rendering target |
5286
|
|
|
|
|
|
|
|
5287
|
|
|
|
|
|
|
=back |
5288
|
|
|
|
|
|
|
|
5289
|
|
|
|
|
|
|
Returns C<0> on success, or C<-1> on error. |
5290
|
|
|
|
|
|
|
|
5291
|
|
|
|
|
|
|
=head2 C |
5292
|
|
|
|
|
|
|
|
5293
|
|
|
|
|
|
|
Copy a portion of the source texture to the current rendering target, with |
5294
|
|
|
|
|
|
|
rotation and flipping, at subpixel precision. |
5295
|
|
|
|
|
|
|
|
5296
|
|
|
|
|
|
|
=for TODO: I need to come up with an example for this as well |
5297
|
|
|
|
|
|
|
|
5298
|
|
|
|
|
|
|
=over |
5299
|
|
|
|
|
|
|
|
5300
|
|
|
|
|
|
|
=item C - The renderer which should copy parts of a texture |
5301
|
|
|
|
|
|
|
|
5302
|
|
|
|
|
|
|
=item C - The source texture |
5303
|
|
|
|
|
|
|
|
5304
|
|
|
|
|
|
|
=item C - A pointer to the source rectangle |
5305
|
|
|
|
|
|
|
|
5306
|
|
|
|
|
|
|
=for TODO: or NULL for the entire texture |
5307
|
|
|
|
|
|
|
|
5308
|
|
|
|
|
|
|
=item C - A pointer to the destination rectangle |
5309
|
|
|
|
|
|
|
|
5310
|
|
|
|
|
|
|
=for TODO: or NULL for the entire rendering target. |
5311
|
|
|
|
|
|
|
|
5312
|
|
|
|
|
|
|
=item C - An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction |
5313
|
|
|
|
|
|
|
|
5314
|
|
|
|
|
|
|
=item C - A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around C, C) |
5315
|
|
|
|
|
|
|
|
5316
|
|
|
|
|
|
|
=item C - A C<:rendererFlip> value stating which flipping actions should be performed on the texture |
5317
|
|
|
|
|
|
|
|
5318
|
|
|
|
|
|
|
=back |
5319
|
|
|
|
|
|
|
|
5320
|
|
|
|
|
|
|
Returns C<0> on success, or C<-1> on error |
5321
|
|
|
|
|
|
|
|
5322
|
|
|
|
|
|
|
=head2 C |
5323
|
|
|
|
|
|
|
|
5324
|
|
|
|
|
|
|
Read pixels from the current rendering target to an array of pixels. |
5325
|
|
|
|
|
|
|
|
5326
|
|
|
|
|
|
|
SDL_RenderReadPixels( |
5327
|
|
|
|
|
|
|
$renderer, |
5328
|
|
|
|
|
|
|
SDL2::Rect->new( { x => 0, y => 0, w => 640, h => 480 } ), |
5329
|
|
|
|
|
|
|
SDL_PIXELFORMAT_RGB888, |
5330
|
|
|
|
|
|
|
$surface->pixels, $surface->pitch |
5331
|
|
|
|
|
|
|
); |
5332
|
|
|
|
|
|
|
|
5333
|
|
|
|
|
|
|
B: This is a very slow operation, and should not be used frequently. |
5334
|
|
|
|
|
|
|
|
5335
|
|
|
|
|
|
|
C specifies the number of bytes between rows in the destination |
5336
|
|
|
|
|
|
|
C data. This allows you to write to a subrectangle or have padded rows |
5337
|
|
|
|
|
|
|
in the destination. Generally, C should equal the number of pixels per |
5338
|
|
|
|
|
|
|
row in the `pixels` data times the number of bytes per pixel, but it might |
5339
|
|
|
|
|
|
|
contain additional padding (for example, 24bit RGB Windows Bitmap data pads all |
5340
|
|
|
|
|
|
|
rows to multiples of 4 bytes). |
5341
|
|
|
|
|
|
|
|
5342
|
|
|
|
|
|
|
Expected parameters include: |
5343
|
|
|
|
|
|
|
|
5344
|
|
|
|
|
|
|
=over |
5345
|
|
|
|
|
|
|
|
5346
|
|
|
|
|
|
|
=item C - the rendering context |
5347
|
|
|
|
|
|
|
|
5348
|
|
|
|
|
|
|
=item C - an L structure representing the area to read |
5349
|
|
|
|
|
|
|
|
5350
|
|
|
|
|
|
|
=for TODO: or NULL for the entire render target |
5351
|
|
|
|
|
|
|
|
5352
|
|
|
|
|
|
|
=item C - an C<:pixelFormatEnum> value of the desired format of the pixel data, or C<0> to use the format of the rendering target |
5353
|
|
|
|
|
|
|
|
5354
|
|
|
|
|
|
|
=item C - pointer to the pixel data to copy into |
5355
|
|
|
|
|
|
|
|
5356
|
|
|
|
|
|
|
=item C - the pitch of the C parameter |
5357
|
|
|
|
|
|
|
|
5358
|
|
|
|
|
|
|
=back |
5359
|
|
|
|
|
|
|
|
5360
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
5361
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
5362
|
|
|
|
|
|
|
|
5363
|
|
|
|
|
|
|
=head2 C |
5364
|
|
|
|
|
|
|
|
5365
|
|
|
|
|
|
|
Update the screen with any rendering performed since the previous call. |
5366
|
|
|
|
|
|
|
|
5367
|
|
|
|
|
|
|
SDL_RenderPresent( $renderer ); |
5368
|
|
|
|
|
|
|
|
5369
|
|
|
|
|
|
|
SDL's rendering functions operate on a backbuffer; that is, calling a rendering |
5370
|
|
|
|
|
|
|
function such as L<< C|/C |
5371
|
|
|
|
|
|
|
>> does not directly put a line on the screen, but rather updates the |
5372
|
|
|
|
|
|
|
backbuffer. As such, you compose your entire scene and *present* the composed |
5373
|
|
|
|
|
|
|
backbuffer to the screen as a complete picture. |
5374
|
|
|
|
|
|
|
|
5375
|
|
|
|
|
|
|
Therefore, when using SDL's rendering API, one does all drawing intended for |
5376
|
|
|
|
|
|
|
the frame, and then calls this function once per frame to present the final |
5377
|
|
|
|
|
|
|
drawing to the user. |
5378
|
|
|
|
|
|
|
|
5379
|
|
|
|
|
|
|
The backbuffer should be considered invalidated after each present; do not |
5380
|
|
|
|
|
|
|
assume that previous contents will exist between frames. You are strongly |
5381
|
|
|
|
|
|
|
encouraged to call L<< C|/C >> |
5382
|
|
|
|
|
|
|
to initialize the backbuffer before starting each new frame's drawing, even if |
5383
|
|
|
|
|
|
|
you plan to overwrite every pixel. |
5384
|
|
|
|
|
|
|
|
5385
|
|
|
|
|
|
|
Expected parameters include: |
5386
|
|
|
|
|
|
|
|
5387
|
|
|
|
|
|
|
=over |
5388
|
|
|
|
|
|
|
|
5389
|
|
|
|
|
|
|
=item C - the rendering context |
5390
|
|
|
|
|
|
|
|
5391
|
|
|
|
|
|
|
=back |
5392
|
|
|
|
|
|
|
|
5393
|
|
|
|
|
|
|
=head2 C |
5394
|
|
|
|
|
|
|
|
5395
|
|
|
|
|
|
|
Destroy the specified texture. |
5396
|
|
|
|
|
|
|
|
5397
|
|
|
|
|
|
|
SDL_DestroyTexture( $texture ); |
5398
|
|
|
|
|
|
|
|
5399
|
|
|
|
|
|
|
Passing undef or an otherwise invalid texture will set the SDL error message to |
5400
|
|
|
|
|
|
|
"Invalid texture". |
5401
|
|
|
|
|
|
|
|
5402
|
|
|
|
|
|
|
Expected parameters include: |
5403
|
|
|
|
|
|
|
|
5404
|
|
|
|
|
|
|
=over |
5405
|
|
|
|
|
|
|
|
5406
|
|
|
|
|
|
|
=item C - the texture to destroy |
5407
|
|
|
|
|
|
|
|
5408
|
|
|
|
|
|
|
=back |
5409
|
|
|
|
|
|
|
|
5410
|
|
|
|
|
|
|
|
5411
|
|
|
|
|
|
|
=head2 C |
5412
|
|
|
|
|
|
|
|
5413
|
|
|
|
|
|
|
Destroy the rendering context for a window and free associated textures. |
5414
|
|
|
|
|
|
|
|
5415
|
|
|
|
|
|
|
SDL_DestroyRenderer( $renderer ); |
5416
|
|
|
|
|
|
|
|
5417
|
|
|
|
|
|
|
Expected parameters include: |
5418
|
|
|
|
|
|
|
|
5419
|
|
|
|
|
|
|
=over |
5420
|
|
|
|
|
|
|
|
5421
|
|
|
|
|
|
|
=item C - the rendering context |
5422
|
|
|
|
|
|
|
|
5423
|
|
|
|
|
|
|
=back |
5424
|
|
|
|
|
|
|
|
5425
|
|
|
|
|
|
|
=head2 C |
5426
|
|
|
|
|
|
|
|
5427
|
|
|
|
|
|
|
Force the rendering context to flush any pending commands to the underlying |
5428
|
|
|
|
|
|
|
rendering API. |
5429
|
|
|
|
|
|
|
|
5430
|
|
|
|
|
|
|
SDL_RenderFlush( $renderer ); |
5431
|
|
|
|
|
|
|
|
5432
|
|
|
|
|
|
|
You do not need to (and in fact, shouldn't) call this function unless you are |
5433
|
|
|
|
|
|
|
planning to call into OpenGL/Direct3D/Metal/whatever directly in addition to |
5434
|
|
|
|
|
|
|
using an SDL_Renderer. |
5435
|
|
|
|
|
|
|
|
5436
|
|
|
|
|
|
|
This is for a very-specific case: if you are using SDL's render API, you asked |
5437
|
|
|
|
|
|
|
for a specific renderer backend (OpenGL, Direct3D, etc), you set |
5438
|
|
|
|
|
|
|
C to "C<1>", and you plan to make OpenGL/D3D/whatever |
5439
|
|
|
|
|
|
|
calls in addition to SDL render API calls. If all of this applies, you should |
5440
|
|
|
|
|
|
|
call L<< C|/C >> between calls |
5441
|
|
|
|
|
|
|
to SDL's render API and the low-level API you're using in cooperation. |
5442
|
|
|
|
|
|
|
|
5443
|
|
|
|
|
|
|
In all other cases, you can ignore this function. This is only here to get |
5444
|
|
|
|
|
|
|
maximum performance out of a specific situation. In all other cases, SDL will |
5445
|
|
|
|
|
|
|
do the right thing, perhaps at a performance loss. |
5446
|
|
|
|
|
|
|
|
5447
|
|
|
|
|
|
|
This function is first available in SDL 2.0.10, and is not needed in 2.0.9 and |
5448
|
|
|
|
|
|
|
earlier, as earlier versions did not queue rendering commands at all, instead |
5449
|
|
|
|
|
|
|
flushing them to the OS immediately. |
5450
|
|
|
|
|
|
|
|
5451
|
|
|
|
|
|
|
Expected parameters include: |
5452
|
|
|
|
|
|
|
|
5453
|
|
|
|
|
|
|
=over |
5454
|
|
|
|
|
|
|
|
5455
|
|
|
|
|
|
|
=item C - the rendering context |
5456
|
|
|
|
|
|
|
|
5457
|
|
|
|
|
|
|
=back |
5458
|
|
|
|
|
|
|
|
5459
|
|
|
|
|
|
|
Returns C<0> on success or a negative error code on failure; call L<< |
5460
|
|
|
|
|
|
|
C|/C >>( ) for more information. |
5461
|
|
|
|
|
|
|
|
5462
|
|
|
|
|
|
|
|
5463
|
|
|
|
|
|
|
=head2 C |
5464
|
|
|
|
|
|
|
|
5465
|
|
|
|
|
|
|
Bind an OpenGL/ES/ES2 texture to the current context. |
5466
|
|
|
|
|
|
|
|
5467
|
|
|
|
|
|
|
my ($texw, $texh) = SDL_GL_BindTexture( $texture ); |
5468
|
|
|
|
|
|
|
|
5469
|
|
|
|
|
|
|
This is for use with OpenGL instructions when rendering OpenGL primitives |
5470
|
|
|
|
|
|
|
directly. |
5471
|
|
|
|
|
|
|
|
5472
|
|
|
|
|
|
|
If not NULL, the returned width and height values suitable for the provided |
5473
|
|
|
|
|
|
|
texture. In most cases, both will be C<1.0>, however, on systems that support |
5474
|
|
|
|
|
|
|
the GL_ARB_texture_rectangle extension, these values will actually be the pixel |
5475
|
|
|
|
|
|
|
width and height used to create the texture, so this factor needs to be taken |
5476
|
|
|
|
|
|
|
into account when providing texture coordinates to OpenGL. |
5477
|
|
|
|
|
|
|
|
5478
|
|
|
|
|
|
|
You need a renderer to create an L, therefore you can only use |
5479
|
|
|
|
|
|
|
this function with an implicit OpenGL context from L<< C
|
5480
|
|
|
|
|
|
|
... )>|/C >>, not with your own OpenGL context. If |
5481
|
|
|
|
|
|
|
you need control over your OpenGL context, you need to write your own |
5482
|
|
|
|
|
|
|
texture-loading methods. |
5483
|
|
|
|
|
|
|
|
5484
|
|
|
|
|
|
|
Also note that SDL may upload RGB textures as BGR (or vice-versa), and re-order |
5485
|
|
|
|
|
|
|
the color channels in the shaders phase, so the uploaded texture may have |
5486
|
|
|
|
|
|
|
swapped color channels. |
5487
|
|
|
|
|
|
|
|
5488
|
|
|
|
|
|
|
Expected parameters include: |
5489
|
|
|
|
|
|
|
|
5490
|
|
|
|
|
|
|
=over |
5491
|
|
|
|
|
|
|
|
5492
|
|
|
|
|
|
|
=item C - the texture to bind to the current OpenGL/ES/ES2 context |
5493
|
|
|
|
|
|
|
|
5494
|
|
|
|
|
|
|
=back |
5495
|
|
|
|
|
|
|
|
5496
|
|
|
|
|
|
|
Returns the texture's with and height on success, or -1 if the operation is not |
5497
|
|
|
|
|
|
|
supported; call L<< C|/C >>( ) for more |
5498
|
|
|
|
|
|
|
information. |
5499
|
|
|
|
|
|
|
|
5500
|
|
|
|
|
|
|
=head2 C |
5501
|
|
|
|
|
|
|
|
5502
|
|
|
|
|
|
|
Unbind an OpenGL/ES/ES2 texture from the current context. |
5503
|
|
|
|
|
|
|
|
5504
|
|
|
|
|
|
|
SDL_GL_UnbindTexture( $texture ); |
5505
|
|
|
|
|
|
|
|
5506
|
|
|
|
|
|
|
See L<< C|/C >> for |
5507
|
|
|
|
|
|
|
examples on how to use these functions. |
5508
|
|
|
|
|
|
|
|
5509
|
|
|
|
|
|
|
Expected parameters include: |
5510
|
|
|
|
|
|
|
|
5511
|
|
|
|
|
|
|
=over |
5512
|
|
|
|
|
|
|
|
5513
|
|
|
|
|
|
|
=item C - the texture to unbind from the current OpenGL/ES/ES2 context |
5514
|
|
|
|
|
|
|
|
5515
|
|
|
|
|
|
|
=back |
5516
|
|
|
|
|
|
|
|
5517
|
|
|
|
|
|
|
Returns C<0> on success, or C<-1> if the operation is not supported. |
5518
|
|
|
|
|
|
|
|
5519
|
|
|
|
|
|
|
=head2 C |
5520
|
|
|
|
|
|
|
|
5521
|
|
|
|
|
|
|
Get the CAMetalLayer associated with the given Metal renderer. |
5522
|
|
|
|
|
|
|
|
5523
|
|
|
|
|
|
|
my $opaque = SDL_RenderGetMetalLayer( $renderer ); |
5524
|
|
|
|
|
|
|
|
5525
|
|
|
|
|
|
|
This function returns C, so SDL doesn't have to include Metal's |
5526
|
|
|
|
|
|
|
headers, but it can be safely cast to a C. |
5527
|
|
|
|
|
|
|
|
5528
|
|
|
|
|
|
|
Expected parameters include: |
5529
|
|
|
|
|
|
|
|
5530
|
|
|
|
|
|
|
=over |
5531
|
|
|
|
|
|
|
|
5532
|
|
|
|
|
|
|
=item C - the renderer to query |
5533
|
|
|
|
|
|
|
|
5534
|
|
|
|
|
|
|
=back |
5535
|
|
|
|
|
|
|
|
5536
|
|
|
|
|
|
|
Returns C on success, or undef if the renderer isn't a Metal |
5537
|
|
|
|
|
|
|
renderer. |
5538
|
|
|
|
|
|
|
|
5539
|
|
|
|
|
|
|
=head2 C |
5540
|
|
|
|
|
|
|
|
5541
|
|
|
|
|
|
|
Get the Metal command encoder for the current frame |
5542
|
|
|
|
|
|
|
|
5543
|
|
|
|
|
|
|
$opaque = SDL_RenderGetMetalCommandEncoder( $renderer ); |
5544
|
|
|
|
|
|
|
|
5545
|
|
|
|
|
|
|
This function returns C, so SDL doesn't have to include Metal's |
5546
|
|
|
|
|
|
|
headers, but it can be safely cast to an |
5547
|
|
|
|
|
|
|
CMTLRenderCommandEncoderE>. |
5548
|
|
|
|
|
|
|
|
5549
|
|
|
|
|
|
|
Expected parameters include: |
5550
|
|
|
|
|
|
|
|
5551
|
|
|
|
|
|
|
=over |
5552
|
|
|
|
|
|
|
|
5553
|
|
|
|
|
|
|
=item C - the renderer to query |
5554
|
|
|
|
|
|
|
|
5555
|
|
|
|
|
|
|
=back |
5556
|
|
|
|
|
|
|
|
5557
|
|
|
|
|
|
|
Returns CMTLRenderCommandEncoderE> on success, or undef if the |
5558
|
|
|
|
|
|
|
renderer isn't a Metal renderer. |
5559
|
|
|
|
|
|
|
|
5560
|
|
|
|
|
|
|
|
5561
|
|
|
|
|
|
|
|
5562
|
|
|
|
|
|
|
|
5563
|
|
|
|
|
|
|
|
5564
|
|
|
|
|
|
|
|
5565
|
|
|
|
|
|
|
|
5566
|
|
|
|
|
|
|
|
5567
|
|
|
|
|
|
|
|
5568
|
|
|
|
|
|
|
|
5569
|
|
|
|
|
|
|
|
5570
|
|
|
|
|
|
|
|
5571
|
|
|
|
|
|
|
|
5572
|
|
|
|
|
|
|
|
5573
|
|
|
|
|
|
|
|
5574
|
|
|
|
|
|
|
|
5575
|
|
|
|
|
|
|
|
5576
|
|
|
|
|
|
|
|
5577
|
|
|
|
|
|
|
|
5578
|
|
|
|
|
|
|
|
5579
|
|
|
|
|
|
|
|
5580
|
|
|
|
|
|
|
|
5581
|
|
|
|
|
|
|
|
5582
|
|
|
|
|
|
|
|
5583
|
|
|
|
|
|
|
|
5584
|
|
|
|
|
|
|
|
5585
|
|
|
|
|
|
|
|
5586
|
|
|
|
|
|
|
|
5587
|
|
|
|
|
|
|
|
5588
|
|
|
|
|
|
|
|
5589
|
|
|
|
|
|
|
|
5590
|
|
|
|
|
|
|
|
5591
|
|
|
|
|
|
|
|
5592
|
|
|
|
|
|
|
|
5593
|
|
|
|
|
|
|
|
5594
|
|
|
|
|
|
|
|
5595
|
|
|
|
|
|
|
|
5596
|
|
|
|
|
|
|
|
5597
|
|
|
|
|
|
|
|
5598
|
|
|
|
|
|
|
|
5599
|
|
|
|
|
|
|
|
5600
|
|
|
|
|
|
|
|
5601
|
|
|
|
|
|
|
|
5602
|
|
|
|
|
|
|
|
5603
|
|
|
|
|
|
|
|
5604
|
|
|
|
|
|
|
|
5605
|
|
|
|
|
|
|
|
5606
|
|
|
|
|
|
|
|
5607
|
|
|
|
|
|
|
|
5608
|
|
|
|
|
|
|
|
5609
|
|
|
|
|
|
|
|
5610
|
|
|
|
|
|
|
|
5611
|
|
|
|
|
|
|
|
5612
|
|
|
|
|
|
|
=head2 C |
5613
|
|
|
|
|
|
|
|
5614
|
|
|
|
|
|
|
Compose a custom blend mode for renderers. |
5615
|
|
|
|
|
|
|
|
5616
|
|
|
|
|
|
|
|
5617
|
|
|
|
|
|
|
|
5618
|
|
|
|
|
|
|
The functions SDL_SetRenderDrawBlendMode and SDL_SetTextureBlendMode accept the |
5619
|
|
|
|
|
|
|
SDL_BlendMode returned by this function if the renderer supports it. |
5620
|
|
|
|
|
|
|
|
5621
|
|
|
|
|
|
|
A blend mode controls how the pixels from a drawing operation (source) get |
5622
|
|
|
|
|
|
|
combined with the pixels from the render target (destination). First, the |
5623
|
|
|
|
|
|
|
components of the source and destination pixels get multiplied with their blend |
5624
|
|
|
|
|
|
|
factors. Then, the blend operation takes the two products and calculates the |
5625
|
|
|
|
|
|
|
result that will get stored in the render target. |
5626
|
|
|
|
|
|
|
|
5627
|
|
|
|
|
|
|
Expressed in pseudocode, it would look like this: |
5628
|
|
|
|
|
|
|
|
5629
|
|
|
|
|
|
|
my $dstRGB = colorOperation( $srcRGB * $srcColorFactor, $dstRGB * $dstColorFactor ); |
5630
|
|
|
|
|
|
|
my $dstA = alphaOperation( $srcA * $srcAlphaFactor, $dstA * $dstAlphaFactor ); |
5631
|
|
|
|
|
|
|
|
5632
|
|
|
|
|
|
|
Where the functions C and C |
5633
|
|
|
|
|
|
|
can return one of the following: |
5634
|
|
|
|
|
|
|
|
5635
|
|
|
|
|
|
|
=over |
5636
|
|
|
|
|
|
|
|
5637
|
|
|
|
|
|
|
=item C |
5638
|
|
|
|
|
|
|
|
5639
|
|
|
|
|
|
|
=item C |
5640
|
|
|
|
|
|
|
|
5641
|
|
|
|
|
|
|
=item C |
5642
|
|
|
|
|
|
|
|
5643
|
|
|
|
|
|
|
=item C |
5644
|
|
|
|
|
|
|
|
5645
|
|
|
|
|
|
|
=item C |
5646
|
|
|
|
|
|
|
|
5647
|
|
|
|
|
|
|
=back |
5648
|
|
|
|
|
|
|
|
5649
|
|
|
|
|
|
|
The red, green, and blue components are always multiplied with the first, |
5650
|
|
|
|
|
|
|
second, and third components of the SDL_BlendFactor, respectively. The fourth |
5651
|
|
|
|
|
|
|
component is not used. |
5652
|
|
|
|
|
|
|
|
5653
|
|
|
|
|
|
|
The alpha component is always multiplied with the fourth component of the L<< |
5654
|
|
|
|
|
|
|
C<:blendFactor>|/C<:blendFactor> >>. The other components are not used in the |
5655
|
|
|
|
|
|
|
alpha calculation. |
5656
|
|
|
|
|
|
|
|
5657
|
|
|
|
|
|
|
Support for these blend modes varies for each renderer. To check if a specific |
5658
|
|
|
|
|
|
|
L<< C<:blendMode>|/C<:blendMode> >> is supported, create a renderer and pass it |
5659
|
|
|
|
|
|
|
to either C or C. They |
5660
|
|
|
|
|
|
|
will return with an error if the blend mode is not supported. |
5661
|
|
|
|
|
|
|
|
5662
|
|
|
|
|
|
|
This list describes the support of custom blend modes for each renderer in SDL |
5663
|
|
|
|
|
|
|
2.0.6. All renderers support the four blend modes listed in the L<< |
5664
|
|
|
|
|
|
|
C<:blendMode>|/C<:blendMode> >> enumeration. |
5665
|
|
|
|
|
|
|
|
5666
|
|
|
|
|
|
|
=over |
5667
|
|
|
|
|
|
|
|
5668
|
|
|
|
|
|
|
=item B - Supports C with all factors. |
5669
|
|
|
|
|
|
|
|
5670
|
|
|
|
|
|
|
=item B - Supports all operations with all factors. However, some factors produce unexpected results with C and C. |
5671
|
|
|
|
|
|
|
|
5672
|
|
|
|
|
|
|
=item B - Supports the C operation with all factors. OpenGL versions 1.1, 1.2, and 1.3 do not work correctly with SDL 2.0.6. |
5673
|
|
|
|
|
|
|
|
5674
|
|
|
|
|
|
|
=item B - Supports the C operation with all factors. Color and alpha factors need to be the same. OpenGL ES 1 implementation specific: May also support C and C. May support color and alpha operations being different from each other. May support color and alpha factors being different from each other. |
5675
|
|
|
|
|
|
|
|
5676
|
|
|
|
|
|
|
=item B - Supports the C, C, C operations with all factors. |
5677
|
|
|
|
|
|
|
|
5678
|
|
|
|
|
|
|
=item B - No custom blend mode support. |
5679
|
|
|
|
|
|
|
|
5680
|
|
|
|
|
|
|
=item B - No custom blend mode support. |
5681
|
|
|
|
|
|
|
|
5682
|
|
|
|
|
|
|
=back |
5683
|
|
|
|
|
|
|
|
5684
|
|
|
|
|
|
|
Some renderers do not provide an alpha component for the default render target. |
5685
|
|
|
|
|
|
|
The C and C |
5686
|
|
|
|
|
|
|
factors do not have an effect in this case. |
5687
|
|
|
|
|
|
|
|
5688
|
|
|
|
|
|
|
Expected parameters include: |
5689
|
|
|
|
|
|
|
|
5690
|
|
|
|
|
|
|
=over |
5691
|
|
|
|
|
|
|
|
5692
|
|
|
|
|
|
|
=item C -the C<:blendFactor> applied to the red, green, and blue components of the source pixels |
5693
|
|
|
|
|
|
|
|
5694
|
|
|
|
|
|
|
=item C - the C<:blendFactor> applied to the red, green, and blue components of the destination pixels |
5695
|
|
|
|
|
|
|
|
5696
|
|
|
|
|
|
|
=item C - the C<:blendOperation> used to combine the red, green, and blue components of the source and destination pixels |
5697
|
|
|
|
|
|
|
|
5698
|
|
|
|
|
|
|
=item C - the C<:blendFactor> applied to the alpha component of the source pixels |
5699
|
|
|
|
|
|
|
|
5700
|
|
|
|
|
|
|
=item C - the C<:blendFactor> applied to the alpha component of the destination pixels |
5701
|
|
|
|
|
|
|
|
5702
|
|
|
|
|
|
|
=item C - the C<:blendOperation> used to combine the alpha component of the source and destination pixels |
5703
|
|
|
|
|
|
|
|
5704
|
|
|
|
|
|
|
=back |
5705
|
|
|
|
|
|
|
|
5706
|
|
|
|
|
|
|
Returns a C<:blendMode> that represents the chosen factors and operations. |
5707
|
|
|
|
|
|
|
|
5708
|
|
|
|
|
|
|
=head1 Time Management Routines |
5709
|
|
|
|
|
|
|
|
5710
|
|
|
|
|
|
|
This section contains functions for handling the SDL time management routines. |
5711
|
|
|
|
|
|
|
They may be imported with the C<:timer> tag. |
5712
|
|
|
|
|
|
|
|
5713
|
|
|
|
|
|
|
=head2 C |
5714
|
|
|
|
|
|
|
|
5715
|
|
|
|
|
|
|
Get the number of milliseconds since SDL library initialization. |
5716
|
|
|
|
|
|
|
|
5717
|
|
|
|
|
|
|
my $time = SDL_GetTicks( ); |
5718
|
|
|
|
|
|
|
|
5719
|
|
|
|
|
|
|
This value wraps if the program runs for more than C<~49> days. |
5720
|
|
|
|
|
|
|
|
5721
|
|
|
|
|
|
|
Returns an unsigned 32-bit value representing the number of milliseconds since |
5722
|
|
|
|
|
|
|
the SDL library initialized. |
5723
|
|
|
|
|
|
|
|
5724
|
|
|
|
|
|
|
=head2 C |
5725
|
|
|
|
|
|
|
|
5726
|
|
|
|
|
|
|
Get the current value of the high resolution counter. |
5727
|
|
|
|
|
|
|
|
5728
|
|
|
|
|
|
|
my $high_timer = SDL_GetPerformanceCounter( ); |
5729
|
|
|
|
|
|
|
|
5730
|
|
|
|
|
|
|
This function is typically used for profiling. |
5731
|
|
|
|
|
|
|
|
5732
|
|
|
|
|
|
|
The counter values are only meaningful relative to each other. Differences |
5733
|
|
|
|
|
|
|
between values can be converted to times by using L<< |
5734
|
|
|
|
|
|
|
C|/C >>. |
5735
|
|
|
|
|
|
|
|
5736
|
|
|
|
|
|
|
Returns the current counter value. |
5737
|
|
|
|
|
|
|
|
5738
|
|
|
|
|
|
|
=head2 C |
5739
|
|
|
|
|
|
|
|
5740
|
|
|
|
|
|
|
Get the count per second of the high resolution counter. |
5741
|
|
|
|
|
|
|
|
5742
|
|
|
|
|
|
|
my $hz = SDL_GetPerformanceFrequency( ); |
5743
|
|
|
|
|
|
|
|
5744
|
|
|
|
|
|
|
Returns a platform-specific count per second. |
5745
|
|
|
|
|
|
|
|
5746
|
|
|
|
|
|
|
=head2 C |
5747
|
|
|
|
|
|
|
|
5748
|
|
|
|
|
|
|
Wait a specified number of milliseconds before returning. |
5749
|
|
|
|
|
|
|
|
5750
|
|
|
|
|
|
|
SDL_Delay( 1000 ); |
5751
|
|
|
|
|
|
|
|
5752
|
|
|
|
|
|
|
This function waits a specified number of milliseconds before returning. It |
5753
|
|
|
|
|
|
|
waits at least the specified time, but possibly longer due to OS scheduling. |
5754
|
|
|
|
|
|
|
|
5755
|
|
|
|
|
|
|
Expected parameters include: |
5756
|
|
|
|
|
|
|
|
5757
|
|
|
|
|
|
|
=over |
5758
|
|
|
|
|
|
|
|
5759
|
|
|
|
|
|
|
=item C - the number of milliseconds to delay |
5760
|
|
|
|
|
|
|
|
5761
|
|
|
|
|
|
|
=back |
5762
|
|
|
|
|
|
|
|
5763
|
|
|
|
|
|
|
=head2 C |
5764
|
|
|
|
|
|
|
|
5765
|
|
|
|
|
|
|
Call a callback function at a future time. |
5766
|
|
|
|
|
|
|
|
5767
|
|
|
|
|
|
|
my $id = SDL_AddTimer( 1000, sub ( $interval, $data ) { warn 'ping!'; $interval; } ); |
5768
|
|
|
|
|
|
|
|
5769
|
|
|
|
|
|
|
If you use this function, you must pass C to L<< C
|
5770
|
|
|
|
|
|
|
... )>|/C >>. |
5771
|
|
|
|
|
|
|
|
5772
|
|
|
|
|
|
|
The callback function is passed the current timer interval and returns the next |
5773
|
|
|
|
|
|
|
timer interval. If the returned value is the same as the one passed in, the |
5774
|
|
|
|
|
|
|
periodic alarm continues, otherwise a new alarm is scheduled. If the callback |
5775
|
|
|
|
|
|
|
returns C<0>, the periodic alarm is cancelled. |
5776
|
|
|
|
|
|
|
|
5777
|
|
|
|
|
|
|
The callback is run on a separate thread. |
5778
|
|
|
|
|
|
|
|
5779
|
|
|
|
|
|
|
Timers take into account the amount of time it took to execute the callback. |
5780
|
|
|
|
|
|
|
For example, if the callback took 250 ms to execute and returned 1000 (ms), the |
5781
|
|
|
|
|
|
|
timer would only wait another 750 ms before its next iteration. |
5782
|
|
|
|
|
|
|
|
5783
|
|
|
|
|
|
|
Timing may be inexact due to OS scheduling. Be sure to note the current time |
5784
|
|
|
|
|
|
|
with L<< C|/C >> or L<< |
5785
|
|
|
|
|
|
|
C|/C >> in case |
5786
|
|
|
|
|
|
|
your callback needs to adjust for variances. |
5787
|
|
|
|
|
|
|
|
5788
|
|
|
|
|
|
|
Expected parameters include: |
5789
|
|
|
|
|
|
|
|
5790
|
|
|
|
|
|
|
=over |
5791
|
|
|
|
|
|
|
|
5792
|
|
|
|
|
|
|
=item C - the timer delay, in milliseconds, passed to C |
5793
|
|
|
|
|
|
|
|
5794
|
|
|
|
|
|
|
=item C - the C reference to call when the specified C elapses |
5795
|
|
|
|
|
|
|
|
5796
|
|
|
|
|
|
|
=item C - a pointer that is passed to C |
5797
|
|
|
|
|
|
|
|
5798
|
|
|
|
|
|
|
=back |
5799
|
|
|
|
|
|
|
|
5800
|
|
|
|
|
|
|
Returns a timer ID or C<0> if an error occurs; call L<< C
|
5801
|
|
|
|
|
|
|
)>|/C >>( ) for more information. |
5802
|
|
|
|
|
|
|
|
5803
|
|
|
|
|
|
|
=head2 C |
5804
|
|
|
|
|
|
|
|
5805
|
|
|
|
|
|
|
SDL_RemoveTimer( $id ); |
5806
|
|
|
|
|
|
|
|
5807
|
|
|
|
|
|
|
Remove a timer created with L<< C|/C |
5808
|
|
|
|
|
|
|
>>. |
5809
|
|
|
|
|
|
|
|
5810
|
|
|
|
|
|
|
Expected parameters include: |
5811
|
|
|
|
|
|
|
|
5812
|
|
|
|
|
|
|
=over |
5813
|
|
|
|
|
|
|
|
5814
|
|
|
|
|
|
|
=item C - the ID of the timer to remove |
5815
|
|
|
|
|
|
|
|
5816
|
|
|
|
|
|
|
=back |
5817
|
|
|
|
|
|
|
|
5818
|
|
|
|
|
|
|
Returns true if the timer is removed or false if the timer wasn't found. |
5819
|
|
|
|
|
|
|
|
5820
|
|
|
|
|
|
|
=head1 Raw Audio Mixing |
5821
|
|
|
|
|
|
|
|
5822
|
|
|
|
|
|
|
These methods provide access to the raw audio mixing buffer for the SDL |
5823
|
|
|
|
|
|
|
library. They may be imported with the C<:audio> tag. |
5824
|
|
|
|
|
|
|
|
5825
|
|
|
|
|
|
|
=head2 C |
5826
|
|
|
|
|
|
|
|
5827
|
|
|
|
|
|
|
Returns a list of built in audio drivers, in the order that they were normally |
5828
|
|
|
|
|
|
|
initialized by default. |
5829
|
|
|
|
|
|
|
|
5830
|
|
|
|
|
|
|
=head2 C |
5831
|
|
|
|
|
|
|
|
5832
|
|
|
|
|
|
|
Returns an audio driver by name. |
5833
|
|
|
|
|
|
|
|
5834
|
|
|
|
|
|
|
my $driver = SDL_GetAudioDriver( 1 ); |
5835
|
|
|
|
|
|
|
|
5836
|
|
|
|
|
|
|
Expected parameters include: |
5837
|
|
|
|
|
|
|
|
5838
|
|
|
|
|
|
|
=over |
5839
|
|
|
|
|
|
|
|
5840
|
|
|
|
|
|
|
=item C - The zero-based index of the desired audio driver |
5841
|
|
|
|
|
|
|
|
5842
|
|
|
|
|
|
|
=back |
5843
|
|
|
|
|
|
|
|
5844
|
|
|
|
|
|
|
=head2 C |
5845
|
|
|
|
|
|
|
|
5846
|
|
|
|
|
|
|
Audio system initialization. |
5847
|
|
|
|
|
|
|
|
5848
|
|
|
|
|
|
|
SDL_AudioInit( 'pulseaudio' ); |
5849
|
|
|
|
|
|
|
|
5850
|
|
|
|
|
|
|
This method is used internally, and should not be used unless you have a |
5851
|
|
|
|
|
|
|
specific need to specify the audio driver you want to use. You should normally |
5852
|
|
|
|
|
|
|
use L<< C|/C >>. |
5853
|
|
|
|
|
|
|
|
5854
|
|
|
|
|
|
|
Returns C<0> on success. |
5855
|
|
|
|
|
|
|
|
5856
|
|
|
|
|
|
|
=head2 C |
5857
|
|
|
|
|
|
|
|
5858
|
|
|
|
|
|
|
Cleaning up initialized audio system. |
5859
|
|
|
|
|
|
|
|
5860
|
|
|
|
|
|
|
SDL_AudioQuit( ); |
5861
|
|
|
|
|
|
|
|
5862
|
|
|
|
|
|
|
This method is used internally, and should not be used unless you have a |
5863
|
|
|
|
|
|
|
specific need to close the selected audio driver. You should normally use L<< |
5864
|
|
|
|
|
|
|
C|/C >>. |
5865
|
|
|
|
|
|
|
|
5866
|
|
|
|
|
|
|
=head2 C |
5867
|
|
|
|
|
|
|
|
5868
|
|
|
|
|
|
|
Get the name of the current audio driver. |
5869
|
|
|
|
|
|
|
|
5870
|
|
|
|
|
|
|
my $driver = SDL_GetCurrentAudioDriver( ); |
5871
|
|
|
|
|
|
|
|
5872
|
|
|
|
|
|
|
The returned string points to internal static memory and thus never becomes |
5873
|
|
|
|
|
|
|
invalid, even if you quit the audio subsystem and initialize a new driver |
5874
|
|
|
|
|
|
|
(although such a case would return a different static string from another call |
5875
|
|
|
|
|
|
|
to this function, of course). As such, you should not modify or free the |
5876
|
|
|
|
|
|
|
returned string. |
5877
|
|
|
|
|
|
|
|
5878
|
|
|
|
|
|
|
Returns the name of the current audio driver or undef if no driver has been |
5879
|
|
|
|
|
|
|
initialized. |
5880
|
|
|
|
|
|
|
|
5881
|
|
|
|
|
|
|
=head2 C |
5882
|
|
|
|
|
|
|
|
5883
|
|
|
|
|
|
|
This function is a legacy means of opening the audio device. |
5884
|
|
|
|
|
|
|
|
5885
|
|
|
|
|
|
|
my $obtained = SDL_OpenAudio( |
5886
|
|
|
|
|
|
|
SDL2::AudioSpec->new( { freq => 48000, channels => 2, format => AUDIO_F32 } ) ); |
5887
|
|
|
|
|
|
|
|
5888
|
|
|
|
|
|
|
This function remains for compatibility with SDL 1.2, but also because it's |
5889
|
|
|
|
|
|
|
slightly easier to use than the new functions in SDL 2.0. The new, more |
5890
|
|
|
|
|
|
|
powerful, and preferred way to do this is L<< C
|
5891
|
|
|
|
|
|
|
)>|/C >> . |
5892
|
|
|
|
|
|
|
|
5893
|
|
|
|
|
|
|
This function is roughly equivalent to: |
5894
|
|
|
|
|
|
|
|
5895
|
|
|
|
|
|
|
SDL_OpenAudioDevice( (), 0, $desired, SDL_AUDIO_ALLOW_ANY_CHANGE ); |
5896
|
|
|
|
|
|
|
|
5897
|
|
|
|
|
|
|
With two notable exceptions: |
5898
|
|
|
|
|
|
|
|
5899
|
|
|
|
|
|
|
=over |
5900
|
|
|
|
|
|
|
|
5901
|
|
|
|
|
|
|
=item - If C is undefined, we use C (and allow no changes), which |
5902
|
|
|
|
|
|
|
means desired will be modified to have the correct values for silence, |
5903
|
|
|
|
|
|
|
etc, and SDL will convert any differences between your app's specific |
5904
|
|
|
|
|
|
|
request and the hardware behind the scenes. |
5905
|
|
|
|
|
|
|
|
5906
|
|
|
|
|
|
|
=item - The return value is always success or failure, and not a device ID, which |
5907
|
|
|
|
|
|
|
means you can only have one device open at a time with this function. |
5908
|
|
|
|
|
|
|
|
5909
|
|
|
|
|
|
|
=back |
5910
|
|
|
|
|
|
|
|
5911
|
|
|
|
|
|
|
* \param desired an SDL_AudioSpec structure representing the desired output |
5912
|
|
|
|
|
|
|
* format. Please refer to the SDL_OpenAudioDevice documentation |
5913
|
|
|
|
|
|
|
* for details on how to prepare this structure. |
5914
|
|
|
|
|
|
|
* \param obtained an SDL_AudioSpec structure filled in with the actual |
5915
|
|
|
|
|
|
|
* parameters, or NULL. |
5916
|
|
|
|
|
|
|
* \returns This function opens the audio device with the desired parameters, |
5917
|
|
|
|
|
|
|
* and returns 0 if successful, placing the actual hardware |
5918
|
|
|
|
|
|
|
* parameters in the structure pointed to by `obtained`. |
5919
|
|
|
|
|
|
|
* |
5920
|
|
|
|
|
|
|
* If `obtained` is NULL, the audio data passed to the callback |
5921
|
|
|
|
|
|
|
* function will be guaranteed to be in the requested format, and |
5922
|
|
|
|
|
|
|
* will be automatically converted to the actual hardware audio |
5923
|
|
|
|
|
|
|
* format if necessary. If `obtained` is NULL, `desired` will |
5924
|
|
|
|
|
|
|
* have fields modified. |
5925
|
|
|
|
|
|
|
* |
5926
|
|
|
|
|
|
|
* This function returns a negative error code on failure to open the |
5927
|
|
|
|
|
|
|
* audio device or failure to set up the audio thread; call |
5928
|
|
|
|
|
|
|
* SDL_GetError() for more information. |
5929
|
|
|
|
|
|
|
|
5930
|
|
|
|
|
|
|
|
5931
|
|
|
|
|
|
|
|
5932
|
|
|
|
|
|
|
=head1 LICENSE |
5933
|
|
|
|
|
|
|
|
5934
|
|
|
|
|
|
|
Copyright (C) Sanko Robinson. |
5935
|
|
|
|
|
|
|
|
5936
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
5937
|
|
|
|
|
|
|
the terms found in the Artistic License 2. Other copyrights, terms, and |
5938
|
|
|
|
|
|
|
conditions may apply to data transmitted through this module. |
5939
|
|
|
|
|
|
|
|
5940
|
|
|
|
|
|
|
=head1 AUTHOR |
5941
|
|
|
|
|
|
|
|
5942
|
|
|
|
|
|
|
Sanko Robinson Esanko@cpan.orgE |
5943
|
|
|
|
|
|
|
|
5944
|
|
|
|
|
|
|
=begin stopwords |
5945
|
|
|
|
|
|
|
|
5946
|
|
|
|
|
|
|
libSDL enum iOS iPhone tvOS gamepad gamepads bitmap colorkey asyncify keycode |
5947
|
|
|
|
|
|
|
ctrl+click OpenGL glibc pthread screensaver fullscreen SDL_gamecontroller.h |
5948
|
|
|
|
|
|
|
XBox XInput pthread pthreads realtime rtkit Keycode mutexes resources imple |
5949
|
|
|
|
|
|
|
irectMedia ayer errstr coderef patchlevel distro WinRT raspberrypi psp macOS |
5950
|
|
|
|
|
|
|
NSHighResolutionCapable lowlevel vsync gamecontroller framebuffer XRandR |
5951
|
|
|
|
|
|
|
XVidMode libc musl non letterbox libsamplerate AVAudioSessionCategoryAmbient |
5952
|
|
|
|
|
|
|
AVAudioSessionCategoryPlayback VoIP OpenGLES opengl opengles opengles2 spammy |
5953
|
|
|
|
|
|
|
popup tooltip taskbar subwindow high-dpi subpixel borderless draggable viewport |
5954
|
|
|
|
|
|
|
user-resizable resizable srcA srcC GiB dstrect rect subrectangle pseudocode ms |
5955
|
|
|
|
|
|
|
verystrict resampler eglSwapBuffers backbuffer scancode unhandled lifespan wgl |
5956
|
|
|
|
|
|
|
glX framerate deadzones vice-versa kmsdrm jp CAMetalLayer |
5957
|
|
|
|
|
|
|
|
5958
|
|
|
|
|
|
|
=end stopwords |
5959
|
|
|
|
|
|
|
|
5960
|
|
|
|
|
|
|
=cut |
5961
|
|
|
|
|
|
|
|
5962
|
|
|
|
|
|
|
# Examples: |
5963
|
|
|
|
|
|
|
# - https://github.com/crust/sdl2-examples |
5964
|
|
|
|
|
|
|
# |