X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2FSDLx-Surface.html-inc;h=7dea9f4d20943e36f4d5077d845df78fef7ae9a3;hb=d5943b684b1240307fbf0a103abbf18dd93998f4;hp=873310b64c05ae944fb7a036fa531bcf1fa23e48;hpb=505f308d8b092747da8b2f5e9781475a1f06dfe8;p=sdlgit%2FSDL-Site.git diff --git a/pages/SDLx-Surface.html-inc b/pages/SDLx-Surface.html-inc index 873310b..7dea9f4 100644 --- a/pages/SDLx-Surface.html-inc +++ b/pages/SDLx-Surface.html-inc @@ -19,15 +19,17 @@
  • EXTENSIONS -
    @@ -139,6 +141,30 @@
    +

    load

    +
    +
     my $surface = SDLx::Surface->load( 'hero.png' );
    + my $surface = SDLx::Surface->load( 'hero.dat', 'bmp' );
    +
    +
    +

    Loads the given image file into a new SDLx::Surface surface. A new +surface is always created, even if you call it from an already crafted +object. Croaks on errors such as no support built for that image extension +or a file reading error (the error message is SDL::get_error and should +give more details).

    +

    Note that load() will automatically figure out the extension based on the +filename you provide. If you wish to force an extension for whatever reason +(like having a filename with a different extension or none at all), you can +optionally pass the file type as a second parameter. Case is not relevant.

    +

    If you don't have SDL_image in your build, only bitmap images will be +supported.

    +

    Returns the new Surface.

    + + + + + +

    blit

     $sdlx_surface->blit( $dest, $src_rect, $dest_rect );
    @@ -200,11 +226,30 @@ This is useful when the surface you have isn't an SDLx::Surface, bu
     

    Returns $self

    -

    AUTHOR

    Top

    -
    -
     kthakore 
    +

    draw_gfx_text

    +
    +

    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

    + +
    +

    AUTHORS

    Top

    +
    +

    See AUTHORS in SDL.

    \ No newline at end of file