From: kthakore METHODS
+title()
@@ -170,30 +173,6 @@ 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. When called, the event method recieves
-as its parameter the event object used in the loop.
Example:
-my $app = SDLx::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 ); - -- -
SDLx::App::sync
encapsulates the various methods of syncronizing the screen with the
@@ -212,6 +191,31 @@ in addition to the attribute selector, the value will be set. SDL:::App::a
always returns the current value of the given attribute, or croaks on failure.
SDLx::App
is a SDLx::Controller
. Use the event, show and handlers to run the app.
use SDL; + use SDLx::App; + + use SDL::Event; #Where ever the event call back is processed + + my $app = SDLx::App->new( width => 200, height => 200); + + $app->add_event_handler( sub{ return 0 if $_[0]->type == SDL_QUIT; return 1}); + + $app->add_show_handler( sub{ $app->update() } ); + + $app->add_move_handler( + sub{ + #calc your physics here + } ); + + $app->run(); + ++
see SDLx::Controller for more details.
+ +See AUTHORS in SDL.
diff --git a/pages/documentation.html-inc b/pages/documentation.html-inc index 7630ff9..6fa7069 100644 --- a/pages/documentation.html-inc +++ b/pages/documentation.html-inc @@ -1,2 +1,2 @@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 | - Storage object for surface and position information | |
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 |
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 | - Storage object for surface and position information | |
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 |