From: Tobias Leich Date: Fri, 27 Aug 2010 15:28:54 +0000 (+0200) Subject: updated docs for layermanager and layer X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3030a264d15d5b4d56772f42b1fb2d645aa70e29;p=sdlgit%2FSDL-Site.git updated docs for layermanager and layer --- diff --git a/pages/SDL.html-inc b/pages/SDL.html-inc index 865ff4e..c5147c2 100644 --- a/pages/SDL.html-inc +++ b/pages/SDL.html-inc @@ -251,6 +251,7 @@ The actual delay may be longer than specified depending on the underlying OS.

Fedora

Gabor Szabo (szabgab) <szabgab@gmail.com>

Guillaue Cottenceau (gc) <gc@mandrakesoft.com>

+

Heikki Meht&195;nen (hmehta/hejki) <heikki@mehtanen.fi>

James King

James Wright <jwright@cpan.org>

Jeffrey T. Palmer (jtpalmer) <jeffrey.t.palmer@gmail.com>

diff --git a/pages/SDLx-Layer.html-inc b/pages/SDLx-Layer.html-inc index bdfbd1e..4bfcbd6 100644 --- a/pages/SDLx-Layer.html-inc +++ b/pages/SDLx-Layer.html-inc @@ -14,8 +14,8 @@
  • w
  • h
  • surface
  • -
  • clip
  • pos
  • +
  • clip
  • data
  • ahead
  • behind
  • @@ -48,15 +48,30 @@
      use SDLx::Layer;
       use SDLx::LayerManager;
     
    -
    + use SDL::Image; + use SDL::Surface; + use SDL::Video; - -

    DESCRIPTION

    Top

    -
    + # 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 + $layer1->foreground; + printf( "%s\n", $layer1->behind->[0]->data->{userdata} ); # prints 42 + +
    +

    DESCRIPTION

    Top

    +
    +

    A layer (see SDLx::Layer) is an SDL::Surface, the position of the surface on screen and some additional information, e.g. ingame states.

    METHODS

    Top

    @@ -65,62 +80,150 @@

    new

    +
      my $layer = SDLx::Layer->new( $surface );
    +  my $layer = SDLx::Layer->new( $surface,                                   %data );
    +  my $layer = SDLx::Layer->new( $surface, $pos_x,                           %data );
    +  my $layer = SDLx::Layer->new( $surface, $pos_x, $pos_y,                   %data );
    +  my $layer = SDLx::Layer->new( $surface, $pos_x, $pos_y, $clip_w,          %data );
    +  my $layer = SDLx::Layer->new( $surface, $pos_x, $pos_y, $clip_w, $clip_h, %data );
    +
    +
    +

    This constructs the layer object. See how you can omit the position and dimension of the layer. The hash %data is for your use only. +The layer object just pass it through.

    index

    +
      my $index = $layer->index;
    +
    +
    +

    The method index represents the z-index ot this layer within its layermanager.

    x

    +
      my $x = $layer->x;
    +
    +
    +

    This is a shortcut for $layer->pos->x.

    y

    +
      my $y = $layer->y;
    +
    +
    +

    This is a shortcut for $layer->pos->y.

    w

    +
      my $w = $layer->w;
    +
    +
    +

    This is a shortcut for $layer->clip->w.

    h

    +
      my $h = $layer->h;
    +
    +
    +

    This is a shortcut for $layer->pos->h.

    surface

    +
      my $surface = $layer->surface;
    +  my $surface = $layer->surface( $new_surface );
     
    -
    -

    clip

    -
    + +

    Example:

    +
      SDL::Video::blit_surface( $layer->surface, $layer->clip, $destination_surface, $layer->pos );
    +
    +
    +

    This method let you retrive the current or set a new surface.

    pos

    +
      my $rect = $layer->pos;
    +
    +
    +

    The method pos returns an SDL::Rect object. The pos x and y are stored there.

    +

    Example:

    +
      SDL::Video::blit_surface( $layer->surface, $layer->clip, $destination_surface, $layer->pos );
    +
    +
    + +
    +

    clip

    +
    +
      my $rect = $layer->clip;
    +
    +
    +

    The method clip returns an SDL::Rect object. The clip width and height are stored there.

    +

    Example:

    +
      SDL::Video::blit_surface( $layer->surface, $layer->clip, $destination_surface, $layer->pos );
    +
    +

    data

    +
      my %data = %{ $layer->data };
    +  my %data = %{ $layer->data( %new_data) };
    +
    +
    +

    This method returns the hash %data. You can set %data by passing a hash.

    ahead

    +
      my @layers = $layer->ahead;
    +
    +
    +

    This method returns all layers that are ahead of the given layer. +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.

    behind

    +
      my @layers = $layer->behind;
    +
    +
    +

    This method returns all layers that are behind of the given layer. +Behind means that a layer has a lower z-index and is blitted over the given layer.

    +

    Note: This method doesn't check for transparency. This will change in future versions.

    attach

    +
      $layer->attach( $x, $y );
    +
    +
    +

    This function makes the given layer sticky to the mouse. If you move the mouse the layer will follow. +The layermanager blits this layer 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 layer obtains them via SDL::Events::get_mouse_state.

    +

    Note: The z-index is not changed for the given layer.

    detach_xy

    +
      $layer->detach_xy( $x, $y );
    +
    +
    +

    detach_xy detaches the prevously attached layer to the given coords. The upper left corner of this layer will be at $x and $y.

    foreground

    +
      $layer->foreground;
    +
    +
    +

    This method moves the given layer to the foreground so that it is blittet on top of the other layers.

    BUGS

    Top

    diff --git a/pages/SDLx-LayerManager.html-inc b/pages/SDLx-LayerManager.html-inc index 4aed8af..648d91c 100644 --- a/pages/SDLx-LayerManager.html-inc +++ b/pages/SDLx-LayerManager.html-inc @@ -160,18 +160,41 @@ Behind means that a layer has a lower z-index and is blitted before the given la

    attach

    +
      $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.

    detach_xy

    +
      $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.

    detach_back

    +
      $layermanager->detach_back( );
    +
    +
    +

    detach_back detaches the prevously attached layers back to the position where they were attached.

    foreground

    +
      $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.

    BUGS

    Top

    diff --git a/pages/documentation.html-inc b/pages/documentation.html-inc index 85260d8..2e79eac 100644 --- a/pages/documentation.html-inc +++ b/pages/documentation.html-inc @@ -1,2 +1,2 @@
    -

    Documentation (latest development branch)

    Core
    thumbSDL- Simple DirectMedia Layer for Perl
    thumbSDL::Credits- Authors and contributors of the SDL Perl project
    thumbSDL::Deprecated- Log of Deprecated items per release
    thumbSDL::Time- An SDL Perl extension for managing timers
    Audio
    thumbSDL::Audio- SDL Bindings for Audio
    Structure
    thumbSDL::AudioCVT- Audio Conversion Structure
    thumbSDL::AudioSpec- SDL Bindings for structure SDL::AudioSpec
    CDROM
    thumbSDL::CDROM- SDL Bindings for the CDROM device
    Structure
    thumbSDL::CD- SDL Bindings for structure SDL_CD
    thumbSDL::CDTrack- SDL Bindings for structure SDL_CDTrack
    Events
    thumbSDL::Events- Bindings to the Events Category in SDL API
    Structure
    thumbSDL::Event- General event structure
    Joystick
    thumbSDL::Joystick- SDL Bindings for the Joystick device
    Mouse
    thumbSDL::Mouse- SDL Bindings for the Mouse device
    Structure
    thumbSDL::Cursor- Mouse cursor structure
    Structure
    thumbSDL::Version- SDL Bindings for structure SDL_Version
    Video
    thumbSDL::Video- Bindings to the video category in SDL API
    Structure
    thumbSDL::Color- Format independent color description
    thumbSDL::Overlay- YUV Video overlay
    thumbSDL::Palette- Color palette for 8-bit pixel formats
    thumbSDL::PixelFormat- Stores surface format information
    thumbSDL::Rect- Defines a rectangular area
    thumbSDL::Surface- Graphic surface structure
    thumbSDL::VideoInfo- Video Target Information

    Cookbook
    thumbSDL::Cookbook
    thumbSDL::Cookbook::OpenGL- Using SDL with OpenGL
    thumbSDL::Cookbook::PDL

    Extension
    thumbSDLx::App- a SDL perl extension
    thumbSDLx::Layer- Extension ...
    thumbSDLx::LayerManager- Extension for managing layers in a 2D world
    thumbSDLx::Rect- SDL extension for storing and manipulating rectangular coordinates
    thumbSDLx::SFont- Extension making fonts out of images and printing them
    thumbSDLx::Sprite- interact with images quick and easily in SDL
    thumbSDLx::Sprite::Animated- create animated SDL sprites easily!
    thumbSDLx::Surface- Graphic surface matrix extension

    GFX
    thumbSDL::GFX::Framerate- framerate calculating functions
    thumbSDL::GFX::Primitives- basic drawing functions
    Structure
    thumbSDL::GFX::FPSManager- data structure used by SDL::GFX::Framerate

    Image
    thumbSDL::Image- Bindings for the SDL_Image library

    Mixer
    thumbSDL::Mixer- Sound and music functions
    thumbSDL::Mixer::Channels- SDL::Mixer channel functions and bindings
    thumbSDL::Mixer::Effects- sound effect functions
    thumbSDL::Mixer::Groups- Audio channel group functions
    thumbSDL::Mixer::Music- functions for music
    thumbSDL::Mixer::Samples- functions for loading sound samples
    Structure
    thumbSDL::Mixer::MixChunk- SDL Bindings for structure SDL_MixChunk
    thumbSDL::Mixer::MixMusic- SDL Bindings for structure SDL_MixMusic

    Pango
    thumbSDL::Pango- Text rendering engine
    Structure
    thumbSDL::Pango::Context- Context object for SDL::Pango

    TODO
    thumbSDL::MPEG- a SDL perl extension
    thumbSDL::SMPEG- a SDL perl extension
    MultiThread
    thumbSDL::MultiThread- Bindings to the MultiThread category in SDL API
    Structure
    thumbSDL::RWOps- SDL Bindings to SDL_RWOPs
    GFX
    thumbSDL::GFX::BlitFunc- blitting functions
    thumbSDL::GFX::ImageFilter- image filtering functions
    thumbSDL::GFX::Rotozoom- rotation and zooming functions for surfaces

    TTF
    thumbSDL::TTF- True Type Font functions (libfreetype)
    Structure
    thumbSDL::TTF::Font- Font object type for SDL_ttf

    Tutorials
    thumbSDL::Tutorial- introduction to Perl SDL
    thumbSDL::Tutorial::Animation
    thumbSDL::Tutorial::LunarLander- a small tutorial on Perl SDL

    UNCATEGORIZED
    thumbSDLx::Controller- Handles the loops for event, movement and rendering
    +

    Documentation (latest development branch)

    Core
    thumbSDL- Simple DirectMedia Layer for Perl
    thumbSDL::Credits- Authors and contributors of the SDL Perl project
    thumbSDL::Deprecated- Log of Deprecated items per release
    thumbSDL::Time- An SDL Perl extension for managing timers
    Audio
    thumbSDL::Audio- SDL Bindings for Audio
    Structure
    thumbSDL::AudioCVT- Audio Conversion Structure
    thumbSDL::AudioSpec- SDL Bindings for structure SDL::AudioSpec
    CDROM
    thumbSDL::CDROM- SDL Bindings for the CDROM device
    Structure
    thumbSDL::CD- SDL Bindings for structure SDL_CD
    thumbSDL::CDTrack- SDL Bindings for structure SDL_CDTrack
    Events
    thumbSDL::Events- Bindings to the Events Category in SDL API
    Structure
    thumbSDL::Event- General event structure
    Joystick
    thumbSDL::Joystick- SDL Bindings for the Joystick device
    Mouse
    thumbSDL::Mouse- SDL Bindings for the Mouse device
    Structure
    thumbSDL::Cursor- Mouse cursor structure
    Structure
    thumbSDL::Version- SDL Bindings for structure SDL_Version
    Video
    thumbSDL::Video- Bindings to the video category in SDL API
    Structure
    thumbSDL::Color- Format independent color description
    thumbSDL::Overlay- YUV Video overlay
    thumbSDL::Palette- Color palette for 8-bit pixel formats
    thumbSDL::PixelFormat- Stores surface format information
    thumbSDL::Rect- Defines a rectangular area
    thumbSDL::Surface- Graphic surface structure
    thumbSDL::VideoInfo- Video Target Information

    Cookbook
    thumbSDL::Cookbook
    thumbSDL::Cookbook::OpenGL- Using SDL with OpenGL
    thumbSDL::Cookbook::PDL

    Extension
    thumbSDLx::App- a SDL perl extension
    thumbSDLx::Layer- Extension ...
    thumbSDLx::LayerManager- Extension for managing layers in a 2D world
    thumbSDLx::Rect- SDL extension for storing and manipulating rectangular coordinates
    thumbSDLx::SFont- Extension making fonts out of images and printing them
    thumbSDLx::Sprite- interact with images quick and easily in SDL
    thumbSDLx::Sprite::Animated- create animated SDL sprites easily!
    thumbSDLx::Surface- Graphic surface matrix extension

    GFX
    thumbSDL::GFX::Framerate- framerate calculating functions
    thumbSDL::GFX::Primitives- basic drawing functions
    Structure
    thumbSDL::GFX::FPSManager- data structure used by SDL::GFX::Framerate

    Image
    thumbSDL::Image- Bindings for the SDL_Image library

    Mixer
    thumbSDL::Mixer- Sound and music functions
    thumbSDL::Mixer::Channels- SDL::Mixer channel functions and bindings
    thumbSDL::Mixer::Effects- sound effect functions
    thumbSDL::Mixer::Groups- Audio channel group functions
    thumbSDL::Mixer::Music- functions for music
    thumbSDL::Mixer::Samples- functions for loading sound samples
    Structure
    thumbSDL::Mixer::MixChunk- SDL Bindings for structure SDL_MixChunk
    thumbSDL::Mixer::MixMusic- SDL Bindings for structure SDL_MixMusic

    Pango
    thumbSDL::Pango- Text rendering engine
    Structure
    thumbSDL::Pango::Context- Context object for SDL::Pango

    TODO
    thumbSDL::MPEG- a SDL perl extension
    thumbSDL::SMPEG- a SDL perl extension
    MultiThread
    thumbSDL::MultiThread- Bindings to the MultiThread category in SDL API
    Structure
    thumbSDL::RWOps- SDL Bindings to SDL_RWOPs
    GFX
    thumbSDL::GFX::BlitFunc- blitting functions
    thumbSDL::GFX::ImageFilter- image filtering functions
    thumbSDL::GFX::Rotozoom- rotation and zooming functions for surfaces

    TTF
    thumbSDL::TTF- True Type Font functions (libfreetype)
    Structure
    thumbSDL::TTF::Font- Font object type for SDL_ttf

    Tutorials
    thumbSDL::Tutorial- introduction to Perl SDL
    thumbSDL::Tutorial::Animation
    thumbSDL::Tutorial::LunarLander- a small tutorial on Perl SDL

    UNCATEGORIZED
    thumbSDLx::Controller- Handles the loops for event, movement and rendering