From: Tobias Leich This is the manual way of doing things An alternative to the manual Event processing is the SDL::App::loop .SYNOPSIS
use SDL;
- use SDL::Event;
- use SDL::App;
-
- my $app = new SDL::App (
- -title => 'Application Title',
- -width => 640,
- -height => 480,
- -depth => 32 );
+
use SDL;
+ use SDL::App;
+ use SDL::Event;
+ use SDL::Events;
+
+ my $app = SDL::App->new(
+ -title => 'Application Title',
+ -width => 640,
+ -height => 480,
+ -depth => 32
+ );
my $event = new SDL::Event; # create a new event
+
my $event = SDL::Event->new; # create a new event
- $event->pump();
- $event->poll();
+ SDL::Events::pump_events();
- while ($event->wait()) {
- my $type = $event->type(); # get event type
- print $type;
- exit if $type == SDL_QUIT;
- }
-An alternative to the manual Event processing is the L<SDL::App::loop> .
+ while ( SDL::Events::poll_event($event) ) {
+ my $type = $event->type(); # get event type
+ print $type;
+ exit if $type == SDL_QUIT;
+ }
+DESCRIPTION
@@ -156,19 +157,20 @@ SDL_GRAB_OFF
of event handler subroutines. The keys of the hash must be SDL event types such
as SDL_QUIT(), SDL_KEYDOWN(), and the like. The event method recieves as its parameter
the event object used in the loop.
Example: - - my $app = new SDL::App -title => "test.app", - -width => 800, - -height => 600, - -depth => 32; - - my %actions = ( - SDL_QUIT() => sub { exit(0); }, - SDL_KEYDOWN() => sub { print "Key Pressed" }, - ); - - $app->loop(\%actions); +Example:
+my $app = SDL::App->new( + -title => "test.app", + -width => 800, + -height => 600, + -depth => 32 + ); + + my %actions = ( + SDL_QUIT() => sub { exit(0); }, + SDL_KEYDOWN() => sub { print "Key Pressed" }, + ); + + $app->loop( \%actions );diff --git a/pages/SDL-Cookbook-PDL.html-inc b/pages/SDL-Cookbook-PDL.html-inc index 5d4c847..6344860 100644 --- a/pages/SDL-Cookbook-PDL.html-inc +++ b/pages/SDL-Cookbook-PDL.html-inc @@ -424,7 +424,7 @@ Some of the particles can drift off the screen. This is no good. What's causing
and then be sure to create an event object amongst the animation initialization code:
-my $event = new SDL::Event; +my $event = SDL::Event->new;Finally, we need to update the application loop so that it examines and responds to events. Replace the current application loop with this code:
@@ -579,7 +579,7 @@ Some of the particles can drift off the screen. This is no good. What's causing my $bg = SDL::Rect->new( 0,0,$side_length, $side_length, ); # event listener - my $event = new SDL::Event->new(); + my $event = SDL::Event->new(); # event dispatch table my $keyname_dispatch_table = { diff --git a/pages/SDL-Credits.html-inc b/pages/SDL-Credits.html-inc index cbe7cb2..2eb12e0 100644 --- a/pages/SDL-Credits.html-inc +++ b/pages/SDL-Credits.html-inc @@ -2,7 +2,8 @@Index
-
SDL::Credits - Authors and contributors of the SDL Perl project
+ +See the impact graph on our github repository.
-Also see our CONTRIBUTERS file.
+Also see our CONTRIBUTORS file.
They can be reached on the SDL-devel\@perl.org mailing list and the #sdl channel on the irc.perl.org network.
- - - -$info = new SDL::MPEG -from => $mpeg; +$info = SDL::MPEG->new( -from => $mpeg );diff --git a/pages/SDL-Mixer-Music.html-inc b/pages/SDL-Mixer-Music.html-inc index a7a9ec8..f6550f1 100644 --- a/pages/SDL-Mixer-Music.html-inc +++ b/pages/SDL-Mixer-Music.html-inc @@ -244,7 +244,9 @@ Passing zero is similar to rewinding the song.Jumps to position seconds from the current position in the stream. So you may want to call SDL::Mixer::Music::rewind_music before this. Does not go in reverse... negative values do nothing.
-Returns:
+ + +0
on success, or-1
if the codec doesn't support this function.Returns:
0
on success, or-1
if the codec doesn't support this function.
my $paused = SDL::Mixer::Music::paused_music();-
Returns 1
if the music is paused, otherwise 0
.
Returns 1
if the music is paused, otherwise 0
.
my $playing_music = SDL::Mixer::Music::playing_music();-
Returns 1
if the music is playing sound, otherwise 0
. It does'nt check if the music is paused.
Returns 1
if the music is playing sound, otherwise 0
. It does'nt check if the music is paused.
Tobias Leich [FROGGS]
+Tobias Leich [FROGGS]
SDL::Music is used to load music files for use with SDL::Mixer. To load a music file one simply creates a new object passing the filename to the constructor:
-my $music = new SDL::Music 'my_song.ogg'; +my $music = SDL::Music->new( 'my_song.ogg' ); diff --git a/pages/SDL-Pango-Context.html-inc b/pages/SDL-Pango-Context.html-inc index a03fd0b..06127f5 100644 --- a/pages/SDL-Pango-Context.html-inc +++ b/pages/SDL-Pango-Context.html-inc @@ -30,7 +30,7 @@new
-my $context = new SDL::Pango::Context; +my $context = SDL::Pango::Context->new;Creates a new SDL::Pango context object. See SDL::Pango.
diff --git a/pages/SDL-Pango.html-inc b/pages/SDL-Pango.html-inc index 5eb28b6..54b8861 100644 --- a/pages/SDL-Pango.html-inc +++ b/pages/SDL-Pango.html-inc @@ -53,7 +53,7 @@ SDL::Pango::init(); - my $context = new SDL::Pango::Context; + my $context = SDL::Pango::Context->new; SDL::Pango::set_default_color($context, 0xA7C344FF, 0); SDL::Pango::set_markup($context, 'Hallo <b>W<span foreground="red">o</span><i>r</i><u>l</u>d</b>!', -1); diff --git a/pages/SDL-SMPEG.html-inc b/pages/SDL-SMPEG.html-inc index ef4328e..084394a 100644 --- a/pages/SDL-SMPEG.html-inc +++ b/pages/SDL-SMPEG.html-inc @@ -25,7 +25,7 @@SYNOPSIS
--$video = new SDL::SMPEG ( -name => 'pr0n.mpg' ); +$video = SDL::SMPEG->new( -name => 'pr0n.mpg' );diff --git a/pages/SDL-Sound.html-inc b/pages/SDL-Sound.html-inc index 2f8dd88..1886d9e 100644 --- a/pages/SDL-Sound.html-inc +++ b/pages/SDL-Sound.html-inc @@ -31,7 +31,7 @@SDL::Sound is a module for loading WAV files for sound effects. The file can be loaded by creating a new SDL::Sound object by passing the filename to the constructor;
-my $sound = new SDL::Sound 'my_sfx.wav'; +my $sound = SDL::Sound->new( 'my_sfx.wav' );diff --git a/pages/SDL-Surface.html-inc b/pages/SDL-Surface.html-inc index da88a7d..83709ba 100644 --- a/pages/SDL-Surface.html-inc +++ b/pages/SDL-Surface.html-inc @@ -24,7 +24,7 @@- Direct Write to Surface Pixel -
- get_pixels
+
- get_pixel
- set_pixels @@ -179,12 +179,13 @@
Disclaimer: This can be very slow, it is suitable for creating surfaces one time and not for animations
get_pixels
--$surface->get_pixels( $offset ) +get_pixel
++my $pixel = $surface->get_pixel( $offset )-Returns the current integer value at (surface->pixels)[offset]
+Returns the pixel value for the given
+$offset
. The pixel value depends on current pixel format.Note: For surfaces with a palette (1 byte per pixel) the palette index is returned instead of color values.
set_pixels
@@ -192,20 +193,19 @@$surface->set_pixels( $offset, $value );-Sets the current integer to $value at (surface->pixels)[offset]
+Sets the current pixel
+$value
to the given$offset
. The pixel value must fit the pixel format of the surface.Note: For surfaces with a palette (1 byte per pixel) the palette index must be passed instead of color values.
Usage
-diff --git a/pages/documentation.html-inc b/pages/documentation.html-inc index ea2719a..74a94b0 100644 --- a/pages/documentation.html-inc +++ b/pages/documentation.html-inc @@ -1,2 +1,2 @@sub putpixel - { - my($x, $y, $color) = @_; - my $lineoffset = $y * ($screen->pitch / $depth_in_bytes); - $screen->set_pixels( $lineoffset+ $x, $color); - } +sub putpixel + { + my($x, $y, $color) = @_; + $screen->set_pixels( $x + $y * $screen->w, $color); + }-Note: $depth_in_bytes for 32 is 4, 16 is 2, 8 is 1;
See also examples/sols/ch02.pl
-Documentation (latest development branch)
Core SDL - Simple DirectMedia Layer for Perl SDL::Time - a SDL perl extension for managing timers.
Audio SDL::Audio - SDL Bindings for Audio
Structure SDL::AudioCVT - Audio Conversion Structure SDL::AudioSpec - SDL Bindings for structure SDL::AudioSpec
CDROM SDL::CDROM - SDL Bindings for the CDROM device
Structure SDL::CD - SDL Bindings for structure SDL_CD SDL::CDTrack - SDL Bindings for structure SDL_CDTrack
Events SDL::Events - Bindings to the Events Category in SDL API
Structure SDL::Event - General event structure
Joystick SDL::Joystick - SDL Bindings for the Joystick device
Mouse SDL::Mouse - SDL Bindings for the Mouse device
Structure SDL::Cursor - Mouse cursor structure
Structure SDL::Version - SDL Bindings for structure SDL_Version
Video SDL::Video - Bindings to the video category in SDL API
Structure SDL::Color - Format independent color description SDL::Overlay - YUV Video overlay SDL::Palette - Color palette for 8-bit pixel formats SDL::PixelFormat - Stores surface format information SDL::Rect - Defines a rectangular area SDL::Surface - Graphic surface structure. SDL::VideoInfo - Video Target Information
Cookbook SDL::Cookbook SDL::Cookbook::PDL
Extension SDL::App - a SDL perl extension
GFX SDL::GFX::Framerate - framerate calculating functions SDL::GFX::Primitives - basic drawing functions
Structure SDL::GFX::FPSManager - data structure used by SDL::GFX::Framerate
Image SDL::Image - Bindings for the SDL_Image library
Mixer SDL::Mixer - Sound and music functions SDL::Mixer::Channels - SDL::Mixer channel functions and bindings SDL::Mixer::Effects - sound effect functions SDL::Mixer::Groups - Audio channel group functions SDL::Mixer::Music - functions for music SDL::Mixer::Samples - functions for loading sound samples
Structure SDL::Mixer::MixChunk - SDL Bindings for structure SDL_MixChunk SDL::Mixer::MixMusic - SDL Bindings for structure SDL_MixMusic
Pango SDL::Pango - Text rendering engine
Structure SDL::Pango::Context - Context object for SDL::Pango
TODO
Core
MultiThread SDL::MultiThread - Bindings to the MultiThread category in SDL API
Structure SDL::RWOps - SDL Bindings to SDL_RWOPs
GFX SDL::GFX::BlitFunc - blitting functions SDL::GFX::ImageFilter - image filtering functions SDL::GFX::Rotozoom - rotation and zooming functions for surfaces
TTF SDL::TTF - True Type Font functions (libfreetype)
Structure SDL::TTF::Font - Font object type for SDL_ttf
Tutorials SDL::Tutorial - introduction to Perl SDL SDL::Tutorial::Animation SDL::Tutorial::LunarLander - a small tutorial on Perl SDL SDL::Tutorial::Tetris - Let's Make Tetris +
UNCATEGORIZED SDL::Credits SDL::Game::Palette - a perl extension SDL::MPEG - a SDL perl extension SDL::Music - a perl extension SDL::OpenGL - a perl extension SDL::SMPEG - a SDL perl extension SDL::Sound - a perl extension SDL::Tool::Font - a perl extension SDL::Tool::Graphic Documentation (latest development branch)
Core SDL - Simple DirectMedia Layer for Perl SDL::Time - a SDL perl extension for managing timers.
Audio SDL::Audio - SDL Bindings for Audio
Structure SDL::AudioCVT - Audio Conversion Structure SDL::AudioSpec - SDL Bindings for structure SDL::AudioSpec
CDROM SDL::CDROM - SDL Bindings for the CDROM device
Structure SDL::CD - SDL Bindings for structure SDL_CD SDL::CDTrack - SDL Bindings for structure SDL_CDTrack
Events SDL::Events - Bindings to the Events Category in SDL API
Structure SDL::Event - General event structure
Joystick SDL::Joystick - SDL Bindings for the Joystick device
Mouse SDL::Mouse - SDL Bindings for the Mouse device
Structure SDL::Cursor - Mouse cursor structure
Structure SDL::Version - SDL Bindings for structure SDL_Version
Video SDL::Video - Bindings to the video category in SDL API
Structure SDL::Color - Format independent color description SDL::Overlay - YUV Video overlay SDL::Palette - Color palette for 8-bit pixel formats SDL::PixelFormat - Stores surface format information SDL::Rect - Defines a rectangular area SDL::Surface - Graphic surface structure. SDL::VideoInfo - Video Target Information
Cookbook SDL::Cookbook SDL::Cookbook::PDL
Extension SDL::App - a SDL perl extension
GFX SDL::GFX::Framerate - framerate calculating functions SDL::GFX::Primitives - basic drawing functions
Structure SDL::GFX::FPSManager - data structure used by SDL::GFX::Framerate
Image SDL::Image - Bindings for the SDL_Image library
Mixer SDL::Mixer - Sound and music functions SDL::Mixer::Channels - SDL::Mixer channel functions and bindings SDL::Mixer::Effects - sound effect functions SDL::Mixer::Groups - Audio channel group functions SDL::Mixer::Music - functions for music SDL::Mixer::Samples - functions for loading sound samples
Structure SDL::Mixer::MixChunk - SDL Bindings for structure SDL_MixChunk SDL::Mixer::MixMusic - SDL Bindings for structure SDL_MixMusic
Pango SDL::Pango - Text rendering engine
Structure SDL::Pango::Context - Context object for SDL::Pango
TODO
Core
MultiThread SDL::MultiThread - Bindings to the MultiThread category in SDL API
Structure SDL::RWOps - SDL Bindings to SDL_RWOPs
GFX SDL::GFX::BlitFunc - blitting functions SDL::GFX::ImageFilter - image filtering functions SDL::GFX::Rotozoom - rotation and zooming functions for surfaces
TTF SDL::TTF - True Type Font functions (libfreetype)
Structure SDL::TTF::Font - Font object type for SDL_ttf
Tutorials SDL::Tutorial - introduction to Perl SDL SDL::Tutorial::Animation SDL::Tutorial::LunarLander - a small tutorial on Perl SDL diff --git a/tools/PM-Pod2html-snippet.pl b/tools/PM-Pod2html-snippet.pl index d45d28d..34dd814 100644 --- a/tools/PM-Pod2html-snippet.pl +++ b/tools/PM-Pod2html-snippet.pl @@ -7,7 +7,7 @@ use Pod::Xhtml; use File::Copy; use File::Spec::Functions qw(rel2abs splitpath splitdir catpath catdir catfile canonpath); -my $input_path = 'C:/SDL_perl/lib/pods'; +my $input_path = 'D:/dev/SDL_perl/lib/pods'; $input_path = $ARGV[0] if $ARGV[0]; my ($volume, $dirs) = splitpath(rel2abs(__FILE__));
UNCATEGORIZED SDL::Credits - Authors and contributors of the SDL Perl project SDL::Game::Palette - a perl extension SDL::MPEG - a SDL perl extension SDL::Music - a perl extension SDL::OpenGL - a perl extension SDL::SMPEG - a SDL perl extension SDL::Sound - a perl extension SDL::Tool::Font - a perl extension SDL::Tool::Graphic