From: Tobias Leich Date: Thu, 25 Mar 2010 22:32:18 +0000 (+0100) Subject: fixed docs for callbacks X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=sdlgit%2FSDL-Site.git;a=commitdiff_plain;h=09d3d3cea1d78106a6284e2a928d737875936240 fixed docs for callbacks --- diff --git a/pages/SDL-AudioSpec.html-inc b/pages/SDL-AudioSpec.html-inc index 61a5757..ca1efb1 100644 --- a/pages/SDL-AudioSpec.html-inc +++ b/pages/SDL-AudioSpec.html-inc @@ -10,7 +10,8 @@ @@ -36,10 +37,16 @@ my $audio_spec = SDL::AudioSpec->new(); - $audio_spec->freq(22050); # 22050Hz - FM Radio quality - $audio_spec->format(AUDIO_S16SYS); # 16-bit signed audio - $audio_spec->samples(8192); # Large audio buffer reduces risk of dropouts but increases response time - $audio_spec->channels(1); # Mono + $audio_spec->freq(22050); # 22050Hz - FM Radio quality + $audio_spec->format(AUDIO_S16SYS); # 16-bit signed audio + $audio_spec->samples(8192); # Large audio buffer reduces risk of dropouts but increases response time + $audio_spec->channels(1); # Mono + $audio_spec->callback('main::callback'); + + sub callback + { + # do something here + } @@ -112,4 +119,9 @@ size specified in format multiplied by the number of channels. When the SD set to 4096.

+

callback

+
+

To be documented.

+ +
\ No newline at end of file diff --git a/pages/SDL-Mixer-Music.html-inc b/pages/SDL-Mixer-Music.html-inc index 69c059b..5f97a0e 100644 --- a/pages/SDL-Mixer-Music.html-inc +++ b/pages/SDL-Mixer-Music.html-inc @@ -54,10 +54,6 @@
 SDL::Mixer::Music::hook_music( $callback, $position );
 
- or
-
- SDL::Mixer::Music::hook_music( &callback, $position );
-
 

This sets up a custom music player function, so you can pass your own audio stream data into the SDL::Mixer. The function will be called with position passed into the first parameter when the callback is called. @@ -69,7 +65,7 @@ Using a custom music player and the internal music player is not possible, the c

Note: NEVER call SDL::Mixer functions, nor SDL::Audio::lock, from a callback function.

Note: At program termination also call SDL::Mixer::Music::hook_music() to stop this callback.

Example:

-
 my $callback = sub
+
 sub callback
  {
      my $position = shift; # position (first time its 0, on each call $length is added)
      my $length   = shift; # length of bytes we have to put in stream
@@ -83,9 +79,9 @@ Using a custom music player and the internal music player is not possible, the c
      }
 
      return @stream;
- };
+ }
 
- SDL::Mixer::Music::hook_music( $callback, 0 );
+ SDL::Mixer::Music::hook_music( 'main::callback', 0 );
 
 
@@ -101,8 +97,12 @@ This happens when the music is over or is fading out.

Example:

 my $music_is_playing = 0;
  my @music            = qw(first.mp3 next.mp3 other.mp3 last.mp3);
- my $callback         = sub{ $music_is_playing = 0; };
- SDL::Mixer::Music::hook_music_finished( $callback );
+ sub callback
+ {
+     $music_is_playing = 0;
+ }
+
+ SDL::Mixer::Music::hook_music_finished( 'main::callback' );
 
  foreach my $this_song ( @music )
  {
diff --git a/pages/documentation.html-inc b/pages/documentation.html-inc
index 74908b5..2c10aaf 100644
--- a/pages/documentation.html-inc
+++ b/pages/documentation.html-inc
@@ -1,2 +1,2 @@
 
-

Documentation (latest development branch)

Core
thumbSDL- Simple DirectMedia Layer for Perl
thumbSDL::Time- a SDL perl extension for managing timers.
Audio
thumbSDL::Audio- SDL Bindings for Audio
Structure
thumbSDL::AudioCVT- Audio Conversion Structure
thumbSDL::AudioSpec- SDL Bindings for structure SDL::AudioSpec
CDROM
thumbSDL::CDROM- SDL Bindings for the CDROM device
Structure
thumbSDL::CD- SDL Bindings for structure SDL_CD
thumbSDL::CDTrack- SDL Bindings for structure SDL_CDTrack
Events
thumbSDL::Events- Bindings to the Events Category in SDL API
Structure
thumbSDL::Event- General event structure
Joystick
thumbSDL::Joystick- SDL Bindings for the Joystick device
Mouse
thumbSDL::Mouse- SDL Bindings for the Mouse device
Structure
thumbSDL::Cursor- Mouse cursor structure
Structure
thumbSDL::Version- SDL Bindings for structure SDL_Version
Video
thumbSDL::Video- Bindings to the video category in SDL API
Structure
thumbSDL::Color- Format independent color description
thumbSDL::Overlay- YUV Video overlay
thumbSDL::Palette- Color palette for 8-bit pixel formats
thumbSDL::PixelFormat- Stores surface format information
thumbSDL::Rect- Defines a rectangular area
thumbSDL::Surface- Graphic surface structure.
thumbSDL::VideoInfo- Video Target Information

Cookbook
thumbSDL::Cookbook
thumbSDL::Cookbook::PDL

Extension
thumbSDL::App- a SDL perl extension

GFX
thumbSDL::GFX::Framerate- framerate calculating functions
thumbSDL::GFX::Primitives- basic drawing functions
Structure
thumbSDL::GFX::FPSManager- data structure used by SDL::GFX::Framerate

Image
thumbSDL::Image- Bindings for the SDL_Image library

Mixer
thumbSDL::Mixer- Sound and music functions
thumbSDL::Mixer::Channels- SDL::Mixer channel functions and bindings
thumbSDL::Mixer::Effects- sound effect functions
thumbSDL::Mixer::Groups- Audio channel group functions
thumbSDL::Mixer::Music- functions for music
thumbSDL::Mixer::Samples- functions for loading sound samples
Structure
thumbSDL::Mixer::MixChunk- SDL Bindings for structure SDL_MixChunk
thumbSDL::Mixer::MixMusic- SDL Bindings for structure SDL_MixMusic

Pango
thumbSDL::Pango- Text rendering engine
Structure
thumbSDL::Pango::Context- Context object for SDL::Pango
TODO
Core
MultiThread
thumbSDL::MultiThread- Bindings to the MultiThread category in SDL API
Structure
thumbSDL::RWOps- SDL Bindings to SDL_RWOPs
GFX
thumbSDL::GFX::BlitFunc- blitting functions
thumbSDL::GFX::ImageFilter- image filtering functions
thumbSDL::GFX::Rotozoom- rotation and zooming functions for surfaces

TTF
thumbSDL::TTF- True Type Font functions (libfreetype)
Structure
thumbSDL::TTF::Font- Font object type for SDL_ttf

Tutorials
thumbSDL::Tutorial- introduction to Perl SDL
thumbSDL::Tutorial::Animation
thumbSDL::Tutorial::Images
thumbSDL::Tutorial::LunarLander- a small tutorial on Perl SDL
thumbSDL::Tutorial::Pong- Get started pong
thumbSDL::Tutorial::Tetris- Let's Make Tetris

UNCATEGORIZED
thumbSDL::Credits
thumbSDL::Font- a SDL perl extension
thumbSDL::Game::Palette- a perl extension
thumbSDL::MPEG- a SDL perl extension
thumbSDL::Music- a perl extension
thumbSDL::OpenGL- a perl extension
thumbSDL::SFont- a perl extension
thumbSDL::SMPEG- a SDL perl extension
thumbSDL::Sound- a perl extension
thumbSDL::TTFont- a SDL perl extension
thumbSDL::Tool::Font- a perl extension
thumbSDL::Tool::Graphic
+

Documentation (latest development branch)

Core
thumbSDL- Simple DirectMedia Layer for Perl
thumbSDL::Time- a SDL perl extension for managing timers.
Audio
thumbSDL::Audio- SDL Bindings for Audio
Structure
thumbSDL::AudioCVT- Audio Conversion Structure
thumbSDL::AudioSpec- SDL Bindings for structure SDL::AudioSpec
CDROM
thumbSDL::CDROM- SDL Bindings for the CDROM device
Structure
thumbSDL::CD- SDL Bindings for structure SDL_CD
thumbSDL::CDTrack- SDL Bindings for structure SDL_CDTrack
Events
thumbSDL::Events- Bindings to the Events Category in SDL API
Structure
thumbSDL::Event- General event structure
Joystick
thumbSDL::Joystick- SDL Bindings for the Joystick device
Mouse
thumbSDL::Mouse- SDL Bindings for the Mouse device
Structure
thumbSDL::Cursor- Mouse cursor structure
Structure
thumbSDL::Version- SDL Bindings for structure SDL_Version
Video
thumbSDL::Video- Bindings to the video category in SDL API
Structure
thumbSDL::Color- Format independent color description
thumbSDL::Overlay- YUV Video overlay
thumbSDL::Palette- Color palette for 8-bit pixel formats
thumbSDL::PixelFormat- Stores surface format information
thumbSDL::Rect- Defines a rectangular area
thumbSDL::Surface- Graphic surface structure.
thumbSDL::VideoInfo- Video Target Information

Cookbook
thumbSDL::Cookbook
thumbSDL::Cookbook::PDL

Extension
thumbSDL::App- a SDL perl extension

GFX
thumbSDL::GFX::Framerate- framerate calculating functions
thumbSDL::GFX::Primitives- basic drawing functions
Structure
thumbSDL::GFX::FPSManager- data structure used by SDL::GFX::Framerate

Image
thumbSDL::Image- Bindings for the SDL_Image library

Mixer
thumbSDL::Mixer- Sound and music functions
thumbSDL::Mixer::Channels- SDL::Mixer channel functions and bindings
thumbSDL::Mixer::Effects- sound effect functions
thumbSDL::Mixer::Groups- Audio channel group functions
thumbSDL::Mixer::Music- functions for music
thumbSDL::Mixer::Samples- functions for loading sound samples
Structure
thumbSDL::Mixer::MixChunk- SDL Bindings for structure SDL_MixChunk
thumbSDL::Mixer::MixMusic- SDL Bindings for structure SDL_MixMusic

Pango
thumbSDL::Pango- Text rendering engine
Structure
thumbSDL::Pango::Context- Context object for SDL::Pango
TODO
Core
MultiThread
thumbSDL::MultiThread- Bindings to the MultiThread category in SDL API
Structure
thumbSDL::RWOps- SDL Bindings to SDL_RWOPs
GFX
thumbSDL::GFX::BlitFunc- blitting functions
thumbSDL::GFX::ImageFilter- image filtering functions
thumbSDL::GFX::Rotozoom- rotation and zooming functions for surfaces

TTF
thumbSDL::TTF- True Type Font functions (libfreetype)
Structure
thumbSDL::TTF::Font- Font object type for SDL_ttf

Tutorials
thumbSDL::Tutorial- introduction to Perl SDL
thumbSDL::Tutorial::Animation
thumbSDL::Tutorial::Images
thumbSDL::Tutorial::LunarLander- a small tutorial on Perl SDL
thumbSDL::Tutorial::Pong- Get started pong
thumbSDL::Tutorial::Tetris- Let's Make Tetris

UNCATEGORIZED
thumbSDL::Credits
thumbSDL::Font- a SDL perl extension
thumbSDL::Game::Palette- a perl extension
thumbSDL::MPEG- a SDL perl extension
thumbSDL::Music- a perl extension
thumbSDL::OpenGL- a perl extension
thumbSDL::SFont- a perl extension
thumbSDL::SMPEG- a SDL perl extension
thumbSDL::Sound- a perl extension
thumbSDL::TTFont- a SDL perl extension
thumbSDL::Tool::Font- a perl extension
thumbSDL::Tool::Graphic