From: kthakore This is the manual way of doing things This is the manual way of doing things An alternative to the manual Event processing is the SDLx::App::loop . An alternative to the manual Event processing is the SDLx::App::loop. my $event = SDL::Event->new; # create a new event
SDL::Events::pump_events();
@@ -64,7 +67,7 @@
}
-DESCRIPTION
@@ -83,30 +86,41 @@ manager oriented functions.
SDLx::App::new
initializes the SDL, creates a new screen,
and initializes some of the window manager properties.
SDLx::App::new
takes a series of named parameters:
SDLx::App::title
takes 0, 1, or 2 arguments. It returns the current
-application window title. If one parameter is passed, both the window
-title and icon title will be set to its value. If two parameters are
-passed the window title will be set to the first, and the icon title
-to the second.
SDLx::App::title
takes 0, 1, or 2 arguments. If no parameter is given,
+it returns the current application window title. If one parameter is
+passed, both the window title and icon title will be set to its value.
+If two parameters are passed the window title will be set to the first,
+and the icon title to the second.
SDLx::App::delay
takes 1 argument, and will sleep the application for
that many ms.
SDLx::App::error
returns the last error message set by the SDL.
SDLx::App::resize
takes a new height and width of the application
-if the application was originally created with the resizable option.
SDLx::App::resize
takes a new width and height of the application. Only
+works if the application was originally created with the resizable option.
SDLx::App::iconify
iconifies the applicaiton window.
SDLx::App::iconify
iconifies the application window.
SDLx::App::grab_input
can be used to change the input focus behavior of
-the application. It takes one argument, which should be one of the following:
SDLx::App::loop
is a simple event loop method which takes a reference to a hash
-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 = SDLx::App->new( title => "test.app", @@ -178,14 +189,18 @@ the event object used in the loop.sync
++current video buffer.
SDLx::App::sync
encapsulates the various methods of syncronizing the screen with the -current video buffer.SDLx::App::sync
will do a fullscreen update, using the double buffer -or OpenGL buffer if applicable. This is prefered to calling flip on the application window.SDLx::App::sync
will do a fullscreen update, using the double buffer +or OpenGL buffer if applicable. This is prefered to calling flip on the application window. + +attribute( $attr )
+-attribute ( attr, [value] )
+attribute( $attr, $value )
-diff --git a/pages/SDLx-Layer.html-inc b/pages/SDLx-Layer.html-inc new file mode 100644 index 0000000..556b041 --- /dev/null +++ b/pages/SDLx-Layer.html-inc @@ -0,0 +1,164 @@ +
SDLx::App::attribute
allows one to set and get GL attributes. By passing a value -in addition to the attribute selector, the value will be set.SDL:::App::attribute
+
SDLx::App::attribute
allows one to get and set GL attributes. By passing a value +in addition to the attribute selector, the value will be set.SDL:::App::attribute
always returns the current value of the given attribute, or croaks on failure.+ +\ No newline at end of file diff --git a/pages/SDLx-LayerManager.html-inc b/pages/SDLx-LayerManager.html-inc new file mode 100644 index 0000000..5429bca --- /dev/null +++ b/pages/SDLx-LayerManager.html-inc @@ -0,0 +1,174 @@ +Index
+ +
+ + +NAME
+++SDLx::Layer - Extension ...
+ +CATEGORY
+++Extension
+ +SYNOPSIS
+++use SDLx::Layer; + use SDLx::LayerManager; + ++ +DESCRIPTION
++ + + + + ++METHODS
++ ++new
++ ++index
++ ++x
++ ++y
++ ++w
++ ++h
++ ++surface
++ ++clip
++ ++pos
++ ++data
++ ++ahead
++ ++behind
++ ++attach
++ ++detach_xy
++ ++foreground
++ ++BUGS
+++Report at sdlperl.ath.cx
+ +SUPPORT
+++#sdl irc.perl.org
+ +AUTHOR
+++Tobias Leich + CPAN ID: FROGGS + --- + froggs@cpan.org + http://sdl.perl.org + ++ +COPYRIGHT
+++This program is free software; you can redistribute +it and/or modify it under the same terms as Perl itself.
+The full text of the license can be found in the +LICENSE file included with this module.
+ + + + + +SEE ALSO
+++perl(1), SDL(2).
+ ++ +\ No newline at end of file diff --git a/pages/SDLx-Sound.html-inc b/pages/SDLx-Sound.html-inc new file mode 100644 index 0000000..cb21361 --- /dev/null +++ b/pages/SDLx-Sound.html-inc @@ -0,0 +1,225 @@ +Index
+ +
- NAME
+- CATEGORY
+- SYNOPSIS
+- DESCRIPTION
+- METHODS +
++
- new
+- add
+- layers
+- layer
+- length
+- blit
+- by_position
+- ahead
+- behind
+- attach
+- detach_xy
+- detach_back
+- foreground
+- BUGS
+- SUPPORT
+- AUTHOR
+- COPYRIGHT
+- SEE ALSO +
+
+ + +NAME
+++SDLx::LayerManager - Extension for managing layers in a 2D world
+ +CATEGORY
+++Extension
+ +SYNOPSIS
+++use SDLx::Layer; + use SDLx::LayerManager; + + use SDL::Image; + use SDL::Surface; + use SDL::Video; + + # creating layers + my $layer1 = SDLx::Layer->new( SDL::Image::load('image1.png'), {userdata => '7'} ); + my $layer2 = SDLx::Layer->new( SDL::Image::load('image2.png'), 100, 200, {userdata => '42'} ); + + # creating the manager that holds the layers + my $layermanager = SDLx::LayerManager->new(); + $layermanager->add( $layer1 ); + $layermanager->add( $layer2 ); + + my $display = # create your video surface here + + $layermanager->blit( $display ); + + # accessing the layer at point(x,y) + print( $layermanager->by_position( 150, 200 )->data->{userdata} ); # should print '42' + ++ +DESCRIPTION
+++The LayerManager ...
+ +METHODS
++ ++new
++ ++add
++ ++layers
++ ++layer
++ ++length
++ ++blit
++ ++by_position
+++my $layer = $layermanager->by_position( $x, $y ); + ++ +ahead
++ ++behind
++ ++attach
++ ++detach_xy
++ ++detach_back
++ ++foreground
++ ++BUGS
+++Report at sdlperl.ath.cx
+ +SUPPORT
+++#sdl irc.perl.org
+ +AUTHOR
+++Tobias Leich + CPAN ID: FROGGS + --- + froggs@cpan.org + http://sdl.perl.org + ++ +COPYRIGHT
+++This program is free software; you can redistribute +it and/or modify it under the same terms as Perl itself.
+The full text of the license can be found in the +LICENSE file included with this module.
+ + + + + +SEE ALSO
+++perl(1), SDL(2).
+ ++ +\ No newline at end of file diff --git a/pages/SDLx-Sprite-Animated.html-inc b/pages/SDLx-Sprite-Animated.html-inc index b1bd058..1cb7575 100644 --- a/pages/SDLx-Sprite-Animated.html-inc +++ b/pages/SDLx-Sprite-Animated.html-inc @@ -20,6 +20,8 @@Index
+ +
- NAME
+- VERSION
+- SYNOPSIS
+- DESCRIPTION
+- METHODS + +
+- AUTHOR
+- BUGS
+- SUPPORT
+- ACKNOWLEDGEMENTS
+- LICENSE AND COPYRIGHT +
+
+ + +NAME
+++SDLx::Sound
+ +VERSION
+++Version 0.01_01
+ + + + + +SYNOPSIS
+++use SDLx::Sound; + + my $snd = SDLx::Sound->new(); + + # loads and plays a single sound now + $snd->play('myfile.wav'); + + # load a single file + $snd->load('theSound.aif'); + + # plays it or all loaded files + $snd->play(); + + # more sounds + my %files = ( + chanell_01 => "/my_sound1.wav", + chanell_02 => "/my_sound2.ogg" + ); + + # times sounds bangs + my %times = ( + chanell_01 => 0, # start + chanell_01 => 1256, # miliseconds + chanell_02 => 2345 + ); + + # Load files in channels for realtime play + $snd->load(%files); + + # sets sound channel_01 loudness + $snd->loud('channel_01', 80); # loud at 80% + $snd->play(%times); # play loaded files at times + $snd->play; # play again + + # plays sound channel_01 at 578 miliseconds from now + $snd->play('channel_01', 578); + + # fades sound + $snd->fade('channel_02', 2345, 3456, -20); + + # in a single act do the wole Sound + my $snd = SDLx::Sound->new( + files => ( + chanell_01 => "/my_sound1.wav", + chanell_02 => "/my_sound2.ogg" + + ), + loud => ( + channel_01 => 80, + channel_02 => 75 + ), + times => ( + chanell_01 => 0, # start + chanell_01 => 1256, # miliseconds + chanell_02 => 2345 + ), + fade => ( + chanell_02 => [2345, 3456, -20] + ) + )->play(); + ++ +DESCRIPTION
++ + + + ++You can think about the SDLx::Sound at 2 aproaches.
++
+- * A simple sound or
+- * The sound of your game or app.
+Your application will say what the best aproach.
+In a taste that resembles to perl and to SDL, our SDLx:Sound hooks at SDL::Audio and SDL::Mixer with a gracefull and simple interface that can offer to monks a modern perlish way to manage sounds.
+An SDLx::Sound object can load sounds from filesystem, play it, adjust this loudness level or stops the sound.
+Each sound will play in the next available channel, so it can be handled isolately.
+ +METHODS
++ ++new
+++Returns a new instance of SDLx::Sound
+ +load
++ ++play
++ ++loud
++ ++stop
++ ++AUTHOR
+++Monsenhor,
+ +<ricardo.filipo at mitologica.com.br>
BUGS
+++Please report any bugs or feature requests to
+ + + + + + + + + + + +bug-sdlx-sound at rt.cpan.org
, or through +the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SDLx-Sound. I will be notified, and then you'll +automatically be notified of progress on your bug as I make changes.SUPPORT
+++You can find documentation for this module with the perldoc command.
+perldoc SDLx::Sound + + + + ++You can also look for information at:
++
+ + + + + +- * RT: CPAN's request tracker
+- + +
+- * AnnoCPAN: Annotated CPAN documentation
+- + +
+- * CPAN Ratings
+- + +
+- * Search CPAN
+- + +
+ACKNOWLEDGEMENTS
++ + + + + ++LICENSE AND COPYRIGHT
+++Copyright 2010 Monsenhor.
+This program is free software; you can redistribute it and/or modify it +under the terms of either: the GNU General Public License as published +by the Free Software Foundation; or the Artistic License.
+See http://dev.perl.org/licenses/ for more information.
+ + + + + +
Uses the supplied hashref to define named sequences of frames.
+Uses $string to set the current sequence.
+Default value is 'circular'.
Uses the supplied hashref to define named sequences of frames. Replaces any +previously defined sequences.
+ +Uses $string to set the current sequence. Goes to the first frame in the +sequence and resets the loop counter.
+ +Goes to the next frame in the strip. Calling this method will also reset diff --git a/pages/SDLx-Surface.html-inc b/pages/SDLx-Surface.html-inc index e2b5196..9a7db49 100644 --- a/pages/SDLx-Surface.html-inc +++ b/pages/SDLx-Surface.html-inc @@ -26,6 +26,7 @@
SDLx::Surface
, bu
Returns $self
Draw text using gfx (not pretty but fast) at give vector, color.
+$surf->draw_gfx_text( [0,0], 0xffffffff, "fooo"); + $surf->draw_gfx_text( [10,10], [20,20,20,20], "fooo"); + ++
You can also set the gfx font but passing a hash reference as shown below.
+my $f = ''; + open( my $FH, '<', 'test/data/5x7.fnt'); + binmode ($FH); + read($FH, $f, 4096); + close ($FH); + + my $font = {data=>$f, cw => 5, ch => 7}; + $surf->draw_gfx_text( [0,0], 0xffffffff, "fooo", $font ); + ++
Returns $self
+ +kthakore diff --git a/pages/documentation.html-inc b/pages/documentation.html-inc index 605e3bc..f8096f2 100644 --- a/pages/documentation.html-inc +++ b/pages/documentation.html-inc @@ -1,2 +1,2 @@-+Documentation (latest development branch)
Documentation (latest development branch)
Core | ||
SDL | - Simple DirectMedia Layer for Perl | |
SDL::Credits | - Authors and contributors of the SDL Perl project | |
SDL::Deprecated | - Log of Deprecated items per release | |
SDL::Time | - An 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::OpenGL | - Using SDL with OpenGL | |
SDL::Cookbook::PDL |
Extension | ||
SDLx::App | - a SDL perl extension | |
SDLx::Layer | - Extension ... | |
SDLx::LayerManager | - Extension for managing layers in a 2D world | |
SDLx::Rect | - SDL extension for storing and manipulating rectangular coordinates | |
SDLx::SFont | - Extension making fonts out of images and printing them | |
SDLx::Sprite | - interact with images quick and easily in SDL | |
SDLx::Sprite::Animated | - create animated SDL sprites easily! | |
SDLx::Surface | - Graphic surface matrix 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 | ||
SDL::MPEG | - a SDL perl extension | |
SDL::SMPEG | - a SDL perl extension |
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 |
UNCATEGORIZED | ||
SDLx::Controller | - Handles the loops for event, movement and rendering | |
SDLx::Sound |