SDLx::LayerManager - Extension for managing layers in a 2D world
Extension
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'
The LayerManager ...
my $layer = $layermanager->by_position( $x, $y );
Report at sdlperl.ath.cx
#sdl irc.perl.org
Tobias Leich CPAN ID: FROGGS --- froggs@cpan.org http://sdl.perl.org
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.
perl(1), SDL(2).