1SDL(3) User Contributed Perl Documentation SDL(3)
2
3
4
6 SDL_perl - Simple DirectMedia Layer for Perl
7
9 use SDL;
10
12 SDL_perl is a package of perl modules that provides both functional and
13 object orient interfaces to the Simple DirectMedia Layer for Perl 5.
14 This package does take some liberties with the SDL API, and attempts to
15 adhere to the spirit of both the SDL and Perl. This document describes
16 the low-level functional SDL_perl API. For the object oriented
17 programming interface please see the documentation provided on a per
18 class basis.
19
20 Init(flags)
21 As with the C language API, SDL_perl initializes the SDL environment
22 through the "SDL::Init" subroutine. This routine takes a mode flag
23 constructed through the bitwise OR product of the following functions:
24
25 · INIT_VIDEO()
26
27 · INIT_CDROM()
28
29 · INIT_EVERYTHING()
30
31 · INIT_NOPARACHUTE()
32
33 · INIT_JOYSTICK()
34
35 · INIT_TIMER()
36
37 "SDL::Init" returns 0 on success, or -1 on error.
38
39 GetError()
40 The last error message set by the SDL library can be retrieved using
41 the subroutine "SDL::GetError", which returns a scalar containing the
42 text of the message if any.
43
44 Delay(ms)
45 This subroutine allows an application to delay further operations for
46 atleast a number of milliseconds provided as the argument. The actual
47 delay may be longer than the specified depending on the underlying OS.
48
49 GetTicks()
50 An application may retrieve the number of milliseconds expired since
51 the initilization of the application through this subroutine. This
52 value resets rougly ever 49 days.
53
54 AddTimer(interval,callback,param)
55 "AddTimer" will register a SDL_NewTimerCallback function to be executed
56 after "interval" milliseconds, with parameter "param".
57 SDL_NewTimerCallback objects can be constructed with the "NewTimer"
58 subroutine. "SDL::PerlTimerCallback" will return a valid callback for
59 executing a perl subroutine or closure. This subroutine returns a
60 SDL_TimerID for the newly registered callback, or NULL on error.
61
62 NewTimer(interval,subroutine)
63 The "NewTimer" takes an interval in milliseconds and a reference to a
64 subroutine to call at that interval. The subroutine will be invoked in
65 a void context and accepts no parameters. The callback used is that
66 returned by "SDL::PerlTimerCallback". "NewTimer" returns the
67 SDL_TimerID for the new timer or NULL on error.
68
69 RemoveTimer(id)
70 This subroutine taks a SDL_TimerID and removes it from the list of
71 active callbacks. RemoveTimer returns false on failure.
72
73 SetTimer
74 This subroutine is depreciated, please use "NewTimer" or "AddTimer"
75 instead.
76
77 CDNumDrives()
78 "SDL::CDNumDrives" returns the number of available CD-ROM drives in the
79 system.
80
81 CDName(drive)
82 The subroutine "SDL::CDName" returns the system specific human readable
83 device name for the given CD-ROM drive.
84
85 CDOpen(drive)
86 This subroutine opens a CD-ROM drive for access, returning NULL if the
87 drive is busy or otherwise unavailable. On success this subroutine
88 returns a handle to the CD-ROM drive.
89
90 CDTrackListing(cd)
91 "SDL::CDTrackListing" returns a human readable description of a CD-ROM.
92 For each track one line will be produced with the following format:
93
94 Track index: %d, id %d, %2d.%2d
95
96 This is provided to ease the creation of human readable descriptions
97 and debugging.
98
99 CDTrackId(track)
100 "CDTrackId" returns the id field of the given SDL_CDtrack structure.
101
102 CDTrackType(track)
103 "CDTrackType" returns the type field of the given SDL_CDtrack
104 structure.
105
106 CDTrackLength(track)
107 "CDTrackLength" returns the length field of the given SDL_CDtrack
108 structure.
109
110 CDTrackOffset(track)
111 "CDTrackOffset" returns the offset field of the given SDL_CDtrack
112 structure.
113
114 CDStatus(cd)
115 The function "CDStatus" returns the current status of the given
116 SDL_CDrom. "CDStatus"'s return values are:
117
118 · CD_TRAYEMPTY
119
120 · CD_PLAYING
121
122 · CD_STOPPED
123
124 · CD_PAUSED
125
126 · CD_ERROR
127
128 CDPlayTracks(cd,track,tracks,frame,frames)
129 To start playing from an arbitrary portion of a CD, one can provide
130 "SDL::CDPlayTracks" with a CD, a starting track, the number of tracks,
131 a starting frame, and the number of frames to be played.
132
133 CDPlay(cd,track,length)
134 "SDL::CDPlay" plays the next "length" tracks starting from "track"
135
136 CDPause(cd)
137 This function will pause CD playback until resume is called.
138
139 CDResume(cd)
140 This function will resume CD playback if paused.
141
142 CDStop(cd)
143 "SDL::CDStop" will stop CD playback if playing.
144
145 CDEject(cd)
146 This function will eject the CD
147
148 CDClose(cd)
149 This function will release an opened CD.
150
151 CDNumTracks
152 CDCurTrack
153 CDCurFrame
154 CDTrack
155 PumpEvents
156 NewEvent
157 FreeEvent
158 PollEvent
159 WaitEvent
160 EventState
161 IGNORE
162 ENABLE
163 QUERY
164 ACTIVEEVENT
165 KEYDOWN
166 KEYUP
167 MOUSEMOTION
168 MOUSEBUTTONDOWN
169 MOUSEBUTTONUP
170 QUIT
171 SYSWMEVENT
172 EventType
173 ActiveEventGain
174 ActiveEventState
175 APPMOUSEFOCUS
176 APPINPUTFOCUS
177 APPACTIVE
178 KeyEventState
179 SDLK_BACKSPACE
180 SDLK_TAB
181 SDLK_CLEAR
182 SDLK_RETURN
183 SDLK_PAUSE
184 SDLK_ESCAPE
185 SDLK_SPACE
186 SDLK_EXCLAIM
187 SDLK_QUOTEDBL
188 SDLK_HASH
189 SDLK_DOLLAR
190 SDLK_AMPERSAND
191 SDLK_QUOTE
192 SDLK_LEFTPAREN
193 SDLK_RIGHTPAREN
194 SDLK_ASTERISK
195 SDLK_PLUS
196 SDLK_COMMA
197 SDLK_MINUS
198 SDLK_PERIOD
199 SDLK_SLASH
200 SDLK_0
201 SDLK_1
202 SDLK_2
203 SDLK_3
204 SDLK_4
205 SDLK_5
206 SDLK_6
207 SDLK_7
208 SDLK_8
209 SDLK_9
210 SDLK_COLON
211 SDLK_SEMICOLON
212 SDLK_LESS
213 SDLK_EQUALS
214 SDLK_GREATER
215 SDLK_QUESTION
216 SDLK_AT
217 SDLK_LEFTBRACKET
218 SDLK_BACKSLASH
219 SDLK_RIGHTBRACKET
220 SDLK_CARET
221 SDLK_UNDERSCORE
222 SDLK_BACKQUOTE
223 SDLK_a
224 SDLK_b
225 SDLK_c
226 SDLK_d
227 SDLK_e
228 SDLK_f
229 SDLK_g
230 SDLK_h
231 SDLK_i
232 SDLK_j
233 SDLK_k
234 SDLK_l
235 SDLK_m
236 SDLK_n
237 SDLK_o
238 SDLK_p
239 SDLK_q
240 SDLK_r
241 SDLK_s
242 SDLK_t
243 SDLK_u
244 SDLK_v
245 SDLK_w
246 SDLK_x
247 SDLK_y
248 SDLK_z
249 SDLK_DELETE
250 SDLK_KP0
251 SDLK_KP1
252 SDLK_KP2
253 SDLK_KP3
254 SDLK_KP4
255 SDLK_KP5
256 SDLK_KP6
257 SDLK_KP7
258 SDLK_KP8
259 SDLK_KP9
260 SDLK_KP_PERIOD
261 SDLK_KP_DIVIDE
262 SDLK_KP_MULTIPLY
263 SDLK_KP_MINUS
264 SDLK_KP_PLUS
265 SDLK_KP_ENTER
266 SDLK_KP_EQUALS
267 SDLK_UP
268 SDLK_DOWN
269 SDLK_RIGHT
270 SDLK_LEFT
271 SDLK_INSERT
272 SDLK_HOME
273 SDLK_END
274 SDLK_PAGEUP
275 SDLK_PAGEDOWN
276 SDLK_F1
277 SDLK_F2
278 SDLK_F3
279 SDLK_F4
280 SDLK_F5
281 SDLK_F6
282 SDLK_F7
283 SDLK_F8
284 SDLK_F9
285 SDLK_F10
286 SDLK_F11
287 SDLK_F12
288 SDLK_F13
289 SDLK_F14
290 SDLK_F15
291 SDLK_NUMLOCK
292 SDLK_CAPSLOCK
293 SDLK_SCROLLOCK
294 SDLK_RSHIFT
295 SDLK_LSHIFT
296 SDLK_RCTRL
297 SDLK_LCTRL
298 SDLK_RALT
299 SDLK_LALT
300 SDLK_RMETA
301 SDLK_LMETA
302 SDLK_LSUPER
303 SDLK_RSUPER
304 SDLK_MODE
305 SDLK_HELP
306 SDLK_PRINT
307 SDLK_SYSREQ
308 SDLK_BREAK
309 SDLK_MENU
310 SDLK_POWER
311 SDLK_EURO
312 KMOD_NONE
313 KMOD_NUM
314 KMOD_CAPS
315 KMOD_LCTRL
316 KMOD_RCTRL
317 KMOD_RSHIFT
318 KMOD_LSHIFT
319 KMOD_RALT
320 KMOD_LALT
321 KMOD_CTRL
322 KMOD_SHIFT
323 KMOD_ALT
324 KeyEventSym
325 KeyEventMod
326 KeyEventUnicode
327 KeyEventScanCode
328 MouseMotionState
329 MouseMotionX
330 MouseMotionY
331 MouseMotionXrel
332 MouseMotionYrel
333 MouseButtonState
334 MouseButton
335 MouseButtonX
336 MouseButtonY
337 SysWMEventMsg
338 EnableUnicode
339 EnableKeyRepeat
340 GetKeyName
341 PRESSED
342 RELEASED
343 CreateRGBSurface
344 CreateRGBSurfaceFrom
345 IMG_Load
346 FreeSurface
347 SurfacePalette
348 SurfaceBitsPerPixel
349 SurfaceBytesPerPixel
350 SurfaceRshift
351 SurfaceGshift
352 SurfaceBshift
353 SurfaceAshift
354 SurfaceRmask
355 SurfaceGmask
356 SurfaceBmask
357 SurfaceAmask
358 SurfaceColorKey
359 SurfaceAlpha
360 SurfaceW
361 SurfaceH
362 SurfacePitch
363 SurfacePixels
364 SurfacePixel
365 MUSTLOCK
366 SurfaceLock
367 SurfaceUnlock
368 GetVideoSurface
369 VideoInfo
370 NewRect
371 FreeRect
372 RectX
373 RectY
374 RectW
375 RectH
376 NewColor
377 ColorR
378 ColorG
379 CologB
380 FreeColor
381 NewPalette
382 PaletteNColors
383 PaletteColors
384 SWSURFACE
385 HWSURFACE
386 ANYFORMAT
387 HWPALETTE
388 DOUBLEBUF
389 FULLSCREEN
390 ASYNCBLIT
391 OPENGL
392 HWACCEL
393 VideoModeOK
394 SetVideoMode
395 UpdateRects
396 Flip
397 SetColors
398 MapRGB (surface,r,g,b)
399 "SDL::MapRGB" translates the composite red (r), green (g), blue (b)
400 colors according to the given surface to a interger color value. This
401 integer can be used in functions like "SDL::FillRect", and is not the
402 same as the format independent Color object returned by
403 "SDL::NewColor".
404
405 MapRGBA (surface,r,g,b,a)
406 "SDL::MapRGBA" works as "SDL::MapRGB" but takes an additional alpha (a)
407 component for semi-transperant colors.
408
409 GetRGB
410 GetRGBA
411 SaveBMP
412 SetColorKey
413 SRCCOLORKEY
414 RLEACCEL
415 SRCALPHA
416 SetAlpha
417 DisplayFormat
418 BlitSurface
419 FillRect(surface,rect,color)
420 "SDL::FillRect" draws a solid rectangle of color on the given surface.
421 If the rectangle is NULL, the entire surface will be painted.
422
423 WMSetCaption
424 WMGetCaption
425 WMSetIcon
426 WarpMouse
427 NewCursor
428 FreeCursor
429 SetCursor
430 GetCursor
431 ShowCursor
432 NewAudioSpec
433 FreeAudioSpec
434 AUDIO_U8
435 AUDIO_S8
436 AUDIO_U16
437 AUDIO_S16
438 AUDIO_U16MSB
439 AUDIO_S16MSB
440 NewAudioCVT
441 FreeAudioCVT
442 ConvertAudioData
443 OpenAudio
444 PauseAudio
445 UnlockAudio
446 CloseAudio
447 FreeWAV
448 LoadWAV
449 MixAudio
450 MIX_MAX_VOLUME
451 MIX_DEFAULT_FREQUENCY
452 MIX_DEFAULT_FORMAT
453 MIX_DEFAULT_CHANNELS
454 MIX_NO_FADING
455 MIX_FADING_OUT
456 MIX_FADING_IN
457 MixOpenAudio
458 MixAllocateChannels
459 MixQuerySpec
460 MixLoadWAV
461 MixLoadMusic
462 MixQuickLoadWAV
463 MixFreeChunk
464 MixFreeMusic
465 MixSetPostMixCallback
466 MixSetMusicHook
467 MixSetMusicFinishedHook
468 MixGetMusicHookData
469 MixReverseChannels
470 MixGroupChannel
471 MixGroupChannels
472 MixGroupAvailable
473 MixGroupCount
474 MixGroupOldest
475 MixGroupNewer
476 MixPlayChannel
477 MixPlayChannelTimed
478 MixPlayMusic
479 MixFadeInChannel
480 MixFadeInChannelTimed
481 MixFadeInMusic
482 MixVolume
483 MixVolumeChunk
484 MixVolumeMusic
485 MixHaltChannel
486 MixHaltGroup
487 MixHaltMusic
488 MixExpireChannel
489 MixFadeOutChannel
490 MixFadeOutGroup
491 MixFadeOutMusic
492 MixFadingMusic
493 MixFadingChannel
494 MixPause
495 MixResume
496 MixPaused
497 MixPauseMusic
498 MixResumeMusic
499 MixRewindMusic
500 MixPausedMusic
501 MixPlaying
502 MixPlayingMusic
503 MixCloseAudio
504 NewFont
505 UseFont
506 PutString
507 TextWidth
508 GL_RED_SIZE
509 GL_GREEN_SIZE
510 GL_BLUE_SIZE
511 GL_ALPHA_SIZE
512 GL_ACCUM_RED_SIZE
513 GL_ACCUM_GREEN_SIZE
514 GL_ACCUM_BLUE_SIZE
515 GL_ACCUM_ALPHA_SIZE
516 GL_BUFFER_SIZE
517 GL_DEPTH_SIZE
518 GL_STENCIL_SIZE
519 GL_DOUBLEBUFFER
520 GL_SetAttribute
521 GL_GetAttribute
522 GL_SwapBuffers
523 BigEndian
524 NumJoysticks
525 JoystickName
526 JoystickOpen
527 JoystickOpened
528 JoystickIndex
529 JoystickNumAxes
530 JoystickNumBalls
531 JoystickNumHats
532 JoystickNumButtons
533 JoystickUpdate
534 JoystickGetAxis
535 JoystickGetHat
536 JoystickGetButton
537 JoystickGetBall
538 JoystickClose
540 David J. Goehrig
541
543 David J. Goehrig, Wayne Keenan, Guillaume Cottenceau
544
546 perl(1) SDL::App(3) SDL::Surface(3) SDL::Event(3) SDL::Rect(3)
547 SDL::Palette(3) SDL::Mixer(3) SDL::Cdrom(3)
548
550 Hey! The above document had some coding errors, which are explained
551 below:
552
553 Around line 75:
554 =over should be: '=over' or '=over positive_number'
555
556
557
558perl v5.12.0 2010-05-06 SDL(3)