1SDL(3)                User Contributed Perl Documentation               SDL(3)
2
3
4

NAME

6       SDL_perl - Simple DirectMedia Layer for Perl
7

SYNOPSIS

9         use SDL;
10

DESCRIPTION

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 pro‐
17       gramming interface please see the documentation provided on a per class
18       basis.
19
20       Init(flags)
21
22       As with the C language API, SDL_perl initializes the SDL environment
23       through the "SDL::Init" subroutine.  This routine takes a mode flag
24       constructed through the bitwise OR product of the following functions:
25
26       * INIT_VIDEO()
27       * INIT_CDROM()
28       * INIT_EVERYTHING()
29       * INIT_NOPARACHUTE()
30       * INIT_JOYSTICK()
31       * INIT_TIMER()
32
33       "SDL::Init" returns 0 on success, or -1 on error.
34
35       GetError()
36
37       The last error message set by the SDL library can be retrieved using
38       the subroutine "SDL::GetError", which returns a scalar containing the
39       text of the message if any.
40
41       Delay(ms)
42
43       This subroutine allows an application to delay further operations for
44       atleast a number of milliseconds provided as the argument.  The actual
45       delay may be longer than the specified depending on the underlying OS.
46
47       GetTicks()
48
49       An application may retrieve the number of milliseconds expired since
50       the initilization of the application through this subroutine.  This
51       value resets rougly ever 49 days.
52
53       AddTimer(interval,callback,param)
54
55       "AddTimer" will register a SDL_NewTimerCallback function to be executed
56       after "interval" milliseconds, with parameter "param".  SDL_NewTimer‐
57       Callback objects can be constructed with the "NewTimer" subroutine.
58       "SDL::PerlTimerCallback" will return a valid callback for executing a
59       perl subroutine or closure.  This subroutine returns a SDL_TimerID for
60       the newly registered callback, or NULL on error.
61
62       NewTimer(interval,subroutine)
63
64       The "NewTimer" takes an interval in milliseconds and a reference to a
65       subroutine to call at that interval.  The subroutine will be invoked in
66       a void context and accepts no parameters.  The callback used is that
67       returned by "SDL::PerlTimerCallback".  "NewTimer" returns the
68       SDL_TimerID for the new timer or NULL on error.
69
70       RemoveTimer(id)
71
72       This subroutine taks a SDL_TimerID and removes it from the list of
73       active callbacks.  RemoveTimer returns false on failure.
74
75       SetTimer
76
77       This subroutine is depreciated, please use "NewTimer" or "AddTimer"
78       instead.
79
80       CDNumDrives()
81
82       "SDL::CDNumDrives" returns the number of available CD-ROM drives in the
83       system.
84
85       CDName(drive)
86
87       The subroutine "SDL::CDName" returns the system specific human readable
88       device name for the given CD-ROM drive.
89
90       CDOpen(drive)
91
92       This subroutine opens a CD-ROM drive for access, returning NULL if the
93       drive is busy or otherwise unavailable.  On success this subroutine
94       returns a handle to the CD-ROM drive.
95
96       CDTrackListing(cd)
97
98       "SDL::CDTrackListing" returns a human readable description of a CD-ROM.
99       For each track one line will be produced with the following format:
100
101               Track index: %d, id %d, %2d.%2d
102
103       This is provided to ease the creation of human readable descriptions
104       and debugging.
105
106       CDTrackId(track)
107
108       "CDTrackId" returns the id field of the given SDL_CDtrack structure.
109
110       CDTrackType(track)
111
112       "CDTrackType" returns the type field of the given SDL_CDtrack struc‐
113       ture.
114
115       CDTrackLength(track)
116
117       "CDTrackLength" returns the length field of the given SDL_CDtrack
118       structure.
119
120       CDTrackOffset(track)
121
122       "CDTrackOffset" returns the offset field of the given SDL_CDtrack
123       structure.
124
125       CDStatus(cd)
126
127       The function "CDStatus" returns the current status of the given
128       SDL_CDrom.  "CDStatus"'s return values are:
129
130       * CD_TRAYEMPTY
131       * CD_PLAYING
132       * CD_STOPPED
133       * CD_PAUSED
134       * CD_ERROR
135
136       CDPlayTracks(cd,track,tracks,frame,frames)
137
138       To start playing from an arbitrary portion of a CD, one can provide
139       "SDL::CDPlayTracks" with a CD, a starting track, the number of tracks,
140       a starting frame, and the number of frames to be played.
141
142       CDPlay(cd,track,length)
143
144       "SDL::CDPlay" plays the next "length" tracks starting from "track"
145
146       CDPause(cd)
147
148       This function will pause CD playback until resume is called.
149
150       CDResume(cd)
151
152       This function will resume CD playback if paused.
153
154       CDStop(cd)
155
156       "SDL::CDStop" will stop CD playback if playing.
157
158       CDEject(cd)
159
160       This function will eject the CD
161
162       CDClose(cd)
163
164       This function will release an opened CD.
165
166       CDNumTracks
167
168       CDCurTrack
169
170       CDCurFrame
171
172       CDTrack
173
174       PumpEvents
175
176       NewEvent
177
178       FreeEvent
179
180       PollEvent
181
182       WaitEvent
183
184       EventState
185
186       IGNORE
187
188       ENABLE
189
190       QUERY
191
192       ACTIVEEVENT
193
194       KEYDOWN
195
196       KEYUP
197
198       MOUSEMOTION
199
200       MOUSEBUTTONDOWN
201
202       MOUSEBUTTONUP
203
204       QUIT
205
206       SYSWMEVENT
207
208       EventType
209
210       ActiveEventGain
211
212       ActiveEventState
213
214       APPMOUSEFOCUS
215
216       APPINPUTFOCUS
217
218       APPACTIVE
219
220       KeyEventState
221
222       SDLK_BACKSPACE
223
224       SDLK_TAB
225
226       SDLK_CLEAR
227
228       SDLK_RETURN
229
230       SDLK_PAUSE
231
232       SDLK_ESCAPE
233
234       SDLK_SPACE
235
236       SDLK_EXCLAIM
237
238       SDLK_QUOTEDBL
239
240       SDLK_HASH
241
242       SDLK_DOLLAR
243
244       SDLK_AMPERSAND
245
246       SDLK_QUOTE
247
248       SDLK_LEFTPAREN
249
250       SDLK_RIGHTPAREN
251
252       SDLK_ASTERISK
253
254       SDLK_PLUS
255
256       SDLK_COMMA
257
258       SDLK_MINUS
259
260       SDLK_PERIOD
261
262       SDLK_SLASH
263
264       SDLK_0
265
266       SDLK_1
267
268       SDLK_2
269
270       SDLK_3
271
272       SDLK_4
273
274       SDLK_5
275
276       SDLK_6
277
278       SDLK_7
279
280       SDLK_8
281
282       SDLK_9
283
284       SDLK_COLON
285
286       SDLK_SEMICOLON
287
288       SDLK_LESS
289
290       SDLK_EQUALS
291
292       SDLK_GREATER
293
294       SDLK_QUESTION
295
296       SDLK_AT
297
298       SDLK_LEFTBRACKET
299
300       SDLK_BACKSLASH
301
302       SDLK_RIGHTBRACKET
303
304       SDLK_CARET
305
306       SDLK_UNDERSCORE
307
308       SDLK_BACKQUOTE
309
310       SDLK_a
311
312       SDLK_b
313
314       SDLK_c
315
316       SDLK_d
317
318       SDLK_e
319
320       SDLK_f
321
322       SDLK_g
323
324       SDLK_h
325
326       SDLK_i
327
328       SDLK_j
329
330       SDLK_k
331
332       SDLK_l
333
334       SDLK_m
335
336       SDLK_n
337
338       SDLK_o
339
340       SDLK_p
341
342       SDLK_q
343
344       SDLK_r
345
346       SDLK_s
347
348       SDLK_t
349
350       SDLK_u
351
352       SDLK_v
353
354       SDLK_w
355
356       SDLK_x
357
358       SDLK_y
359
360       SDLK_z
361
362       SDLK_DELETE
363
364       SDLK_KP0
365
366       SDLK_KP1
367
368       SDLK_KP2
369
370       SDLK_KP3
371
372       SDLK_KP4
373
374       SDLK_KP5
375
376       SDLK_KP6
377
378       SDLK_KP7
379
380       SDLK_KP8
381
382       SDLK_KP9
383
384       SDLK_KP_PERIOD
385
386       SDLK_KP_DIVIDE
387
388       SDLK_KP_MULTIPLY
389
390       SDLK_KP_MINUS
391
392       SDLK_KP_PLUS
393
394       SDLK_KP_ENTER
395
396       SDLK_KP_EQUALS
397
398       SDLK_UP
399
400       SDLK_DOWN
401
402       SDLK_RIGHT
403
404       SDLK_LEFT
405
406       SDLK_INSERT
407
408       SDLK_HOME
409
410       SDLK_END
411
412       SDLK_PAGEUP
413
414       SDLK_PAGEDOWN
415
416       SDLK_F1
417
418       SDLK_F2
419
420       SDLK_F3
421
422       SDLK_F4
423
424       SDLK_F5
425
426       SDLK_F6
427
428       SDLK_F7
429
430       SDLK_F8
431
432       SDLK_F9
433
434       SDLK_F10
435
436       SDLK_F11
437
438       SDLK_F12
439
440       SDLK_F13
441
442       SDLK_F14
443
444       SDLK_F15
445
446       SDLK_NUMLOCK
447
448       SDLK_CAPSLOCK
449
450       SDLK_SCROLLOCK
451
452       SDLK_RSHIFT
453
454       SDLK_LSHIFT
455
456       SDLK_RCTRL
457
458       SDLK_LCTRL
459
460       SDLK_RALT
461
462       SDLK_LALT
463
464       SDLK_RMETA
465
466       SDLK_LMETA
467
468       SDLK_LSUPER
469
470       SDLK_RSUPER
471
472       SDLK_MODE
473
474       SDLK_HELP
475
476       SDLK_PRINT
477
478       SDLK_SYSREQ
479
480       SDLK_BREAK
481
482       SDLK_MENU
483
484       SDLK_POWER
485
486       SDLK_EURO
487
488       KMOD_NONE
489
490       KMOD_NUM
491
492       KMOD_CAPS
493
494       KMOD_LCTRL
495
496       KMOD_RCTRL
497
498       KMOD_RSHIFT
499
500       KMOD_LSHIFT
501
502       KMOD_RALT
503
504       KMOD_LALT
505
506       KMOD_CTRL
507
508       KMOD_SHIFT
509
510       KMOD_ALT
511
512       KeyEventSym
513
514       KeyEventMod
515
516       KeyEventUnicode
517
518       KeyEventScanCode
519
520       MouseMotionState
521
522       MouseMotionX
523
524       MouseMotionY
525
526       MouseMotionXrel
527
528       MouseMotionYrel
529
530       MouseButtonState
531
532       MouseButton
533
534       MouseButtonX
535
536       MouseButtonY
537
538       SysWMEventMsg
539
540       EnableUnicode
541
542       EnableKeyRepeat
543
544       GetKeyName
545
546       PRESSED
547
548       RELEASED
549
550       CreateRGBSurface
551
552       CreateRGBSurfaceFrom
553
554       IMG_Load
555
556       FreeSurface
557
558       SurfacePalette
559
560       SurfaceBitsPerPixel
561
562       SurfaceBytesPerPixel
563
564       SurfaceRshift
565
566       SurfaceGshift
567
568       SurfaceBshift
569
570       SurfaceAshift
571
572       SurfaceRmask
573
574       SurfaceGmask
575
576       SurfaceBmask
577
578       SurfaceAmask
579
580       SurfaceColorKey
581
582       SurfaceAlpha
583
584       SurfaceW
585
586       SurfaceH
587
588       SurfacePitch
589
590       SurfacePixels
591
592       SurfacePixel
593
594       MUSTLOCK
595
596       SurfaceLock
597
598       SurfaceUnlock
599
600       GetVideoSurface
601
602       VideoInfo
603
604       NewRect
605
606       FreeRect
607
608       RectX
609
610       RectY
611
612       RectW
613
614       RectH
615
616       NewColor
617
618       ColorR
619
620       ColorG
621
622       CologB
623
624       FreeColor
625
626       NewPalette
627
628       PaletteNColors
629
630       PaletteColors
631
632       SWSURFACE
633
634       HWSURFACE
635
636       ANYFORMAT
637
638       HWPALETTE
639
640       DOUBLEBUF
641
642       FULLSCREEN
643
644       ASYNCBLIT
645
646       OPENGL
647
648       HWACCEL
649
650       VideoModeOK
651
652       SetVideoMode
653
654       UpdateRects
655
656       Flip
657
658       SetColors
659
660       MapRGB (surface,r,g,b)
661
662       "SDL::MapRGB" translates the composite red (r), green (g), blue (b)
663       colors according to the given surface to a interger color value.  This
664       integer can be used in functions like "SDL::FillRect", and is not the
665       same as the format independent Color object returned by "SDL::New‐
666       Color".
667
668       MapRGBA (surface,r,g,b,a)
669
670       "SDL::MapRGBA" works as "SDL::MapRGB" but takes an additional alpha (a)
671       component for semi-transperant colors.
672
673       GetRGB
674
675       GetRGBA
676
677       SaveBMP
678
679       SetColorKey
680
681       SRCCOLORKEY
682
683       RLEACCEL
684
685       SRCALPHA
686
687       SetAlpha
688
689       DisplayFormat
690
691       BlitSurface
692
693       FillRect(surface,rect,color)
694
695       "SDL::FillRect" draws a solid rectangle of color on the given surface.
696       If the rectangle is NULL, the entire surface will be painted.
697
698       WMSetCaption
699
700       WMGetCaption
701
702       WMSetIcon
703
704       WarpMouse
705
706       NewCursor
707
708       FreeCursor
709
710       SetCursor
711
712       GetCursor
713
714       ShowCursor
715
716       NewAudioSpec
717
718       FreeAudioSpec
719
720       AUDIO_U8
721
722       AUDIO_S8
723
724       AUDIO_U16
725
726       AUDIO_S16
727
728       AUDIO_U16MSB
729
730       AUDIO_S16MSB
731
732       NewAudioCVT
733
734       FreeAudioCVT
735
736       ConvertAudioData
737
738       OpenAudio
739
740       PauseAudio
741
742       UnlockAudio
743
744       CloseAudio
745
746       FreeWAV
747
748       LoadWAV
749
750       MixAudio
751
752       MIX_MAX_VOLUME
753
754       MIX_DEFAULT_FREQUENCY
755
756       MIX_DEFAULT_FORMAT
757
758       MIX_DEFAULT_CHANNELS
759
760       MIX_NO_FADING
761
762       MIX_FADING_OUT
763
764       MIX_FADING_IN
765
766       MixOpenAudio
767
768       MixAllocateChannels
769
770       MixQuerySpec
771
772       MixLoadWAV
773
774       MixLoadMusic
775
776       MixQuickLoadWAV
777
778       MixFreeChunk
779
780       MixFreeMusic
781
782       MixSetPostMixCallback
783
784       MixSetMusicHook
785
786       MixSetMusicFinishedHook
787
788       MixGetMusicHookData
789
790       MixReverseChannels
791
792       MixGroupChannel
793
794       MixGroupChannels
795
796       MixGroupAvailable
797
798       MixGroupCount
799
800       MixGroupOldest
801
802       MixGroupNewer
803
804       MixPlayChannel
805
806       MixPlayChannelTimed
807
808       MixPlayMusic
809
810       MixFadeInChannel
811
812       MixFadeInChannelTimed
813
814       MixFadeInMusic
815
816       MixVolume
817
818       MixVolumeChunk
819
820       MixVolumeMusic
821
822       MixHaltChannel
823
824       MixHaltGroup
825
826       MixHaltMusic
827
828       MixExpireChannel
829
830       MixFadeOutChannel
831
832       MixFadeOutGroup
833
834       MixFadeOutMusic
835
836       MixFadingMusic
837
838       MixFadingChannel
839
840       MixPause
841
842       MixResume
843
844       MixPaused
845
846       MixPauseMusic
847
848       MixResumeMusic
849
850       MixRewindMusic
851
852       MixPausedMusic
853
854       MixPlaying
855
856       MixPlayingMusic
857
858       MixCloseAudio
859
860       NewFont
861
862       UseFont
863
864       PutString
865
866       TextWidth
867
868       GL_RED_SIZE
869
870       GL_GREEN_SIZE
871
872       GL_BLUE_SIZE
873
874       GL_ALPHA_SIZE
875
876       GL_ACCUM_RED_SIZE
877
878       GL_ACCUM_GREEN_SIZE
879
880       GL_ACCUM_BLUE_SIZE
881
882       GL_ACCUM_ALPHA_SIZE
883
884       GL_BUFFER_SIZE
885
886       GL_DEPTH_SIZE
887
888       GL_STENCIL_SIZE
889
890       GL_DOUBLEBUFFER
891
892       GL_SetAttribute
893
894       GL_GetAttribute
895
896       GL_SwapBuffers
897
898       BigEndian
899
900       NumJoysticks
901
902       JoystickName
903
904       JoystickOpen
905
906       JoystickOpened
907
908       JoystickIndex
909
910       JoystickNumAxes
911
912       JoystickNumBalls
913
914       JoystickNumHats
915
916       JoystickNumButtons
917
918       JoystickUpdate
919
920       JoystickGetAxis
921
922       JoystickGetHat
923
924       JoystickGetButton
925
926       JoystickGetBall
927
928       JoystickClose
929

AUTHOR

931       David J. Goehrig
932

CONTRIBUTORS

934       David J. Goehrig, Wayne Keenan, Guillaume Cottenceau
935

SEE ALSO

937               perl(1) SDL::App(3) SDL::Surface(3) SDL::Event(3) SDL::Rect(3)
938               SDL::Palette(3) SDL::Mixer(3) SDL::Cdrom(3)
939
940
941
942perl v5.8.8                       2006-08-28                            SDL(3)
Impressum