X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2FSDLx-LayerManager.html-inc;h=648d91c111ff251ae391b7570cba00a1757fbc34;hb=c7e8d3c612049580c9a96b3006c4c89a00410643;hp=5429bca8ecd8653cf8072293255053558a082cd0;hpb=285d0cd289790209bcd9d141d63fd6fce74a2ee4;p=sdlgit%2FSDL-Site.git diff --git a/pages/SDLx-LayerManager.html-inc b/pages/SDLx-LayerManager.html-inc index 5429bca..648d91c 100644 --- a/pages/SDLx-LayerManager.html-inc +++ b/pages/SDLx-LayerManager.html-inc @@ -24,7 +24,7 @@
The LayerManager ...
+SDLx::LayerManager is a package to handle a bunch of layers. A layer (see SDLx::Layer) is an SDL::Surface, the position of the surface on screen and some additional information.
+The layermanager gives you the opportunity to obtain the layer at a given point on screen and get the layers that are ahead or behind a layer.
+You will even be able to attach one or more layers to the mouse, e.g. for simulation some drag&drop functionality.
my $layermanager = SDLx::LayerManager->new(); + ++
This creates your layermanager object. It doesn't take any parameters.
$layermanager->add( $layer ); + $layermanager->add( SDLx::Layer->new( $surface, $x, $y, $options ) ); + ++
Call add
to push an SDLx::Layer object to the layermanager.
my @layers = @{ $layermanager->layers }; + my $first_layer = $layermanager->layers->[0]; + ++
The method layers
returns all layers that were added before.
my $layer = $layermanager->layer( $index ); + ++
To obtain only one layer at index $index
use this function. $index
ranges from 0
to lenght - 1
.
my $length = $layermanager->length(); + ++
This method returns the count of the added layers.
$layermanager->blit( $surface ); + ++
This method blits all layers to the surface (e.g. your video surface).
my $layer = $layermanager->by_position( $x, $y );+
by_position
returns the SDLx::Layer
object at point $x $y
, which is not fully transparent at this pixel.
my @layers = @{ $layermanager->ahead( $index ) }; + ++
This method returns all layers that are ahead of the given layer indicated by $index
.
+Ahead means that a layer has a higher z-index and is blitted over the given layer.
Note: This method doesn't check for transparency. This will change in future versions.
my @layers = @{ $layermanager->behind( $index ) }; + ++
This method returns all layers that are behind of the given layer indicated by $index
.
+Behind means that a layer has a lower z-index and is blitted before the given layer.
Note: This method doesn't check for transparency. This will change in future versions.
$layermanager->attach( $layer, $x, $y ); + $layermanager->attach( @layers, $x, $y ); + ++
This function makes the given layer(s) sticky to the mouse. If you move the mouse the layer(s) will follow. +The layermanager blits these layers at last, so they will appear on top of all layers.
+$x
and $y
should be set to the coords of the mouse, e.g. the coords of the mouse click.
+If you omit $x
and $y
the layermanager obtains them via SDL::Events::get_mouse_state.
Note: The z-index is not changed for the given layers.
$layermanager->detach_xy( $x, $y ); + ++
detach_xy
detaches the prevously attached layers to the given coords. The upper left corner of the backmost layer will be at $x
and $y
.
+The other layers are positioned relative to the backmost layer just like before.
$layermanager->detach_back( ); + ++
detach_back
detaches the prevously attached layers back to the position where they were attached.
$layermanager->foreground( $layer ); + $layermanager->foreground( @layers ); + ++
This method moves the given layer(s) to the foreground so that they are blittet on top of the other layers.
#sdl irc.perl.org
-