X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2FSDL-Tutorial-Animation.html-inc;h=de815d6ca303b6ca063e7ae114360d732fa7b7cc;hb=1f5d808215c3e475e7d752ba28a3f2c3d6f468ad;hp=2fa2c2a433e3e154c0e40137d2c18708d39a49f9;hpb=92e293d6d5adcc910443bf2ef174928e266c625d;p=sdlgit%2FSDL-Site.git diff --git a/pages/SDL-Tutorial-Animation.html-inc b/pages/SDL-Tutorial-Animation.html-inc index 2fa2c2a..de815d6 100644 --- a/pages/SDL-Tutorial-Animation.html-inc +++ b/pages/SDL-Tutorial-Animation.html-inc @@ -59,8 +59,8 @@ frame and saving and restoring the background for every object drawn.

Since you have to draw the screen in the right order once to start with it's pretty easy to make this into a loop and redraw things in the right order for -every frame. Given a SDL::App object $app, a SDL::Rect $rect, and -a SDL::Color $color, you only have to create a new SDL::Rect $bg, +every frame. Given a SDL::App object $app, a SDL::Rect $rect, and +a SDL::Color $color, you only have to create a new SDL::Rect $bg, representing the whole of the background surface and a new SDL::Color $bg_color, representing the background color. You can write a draw_frame() function as follows:

@@ -69,9 +69,9 @@ representing the whole of the background surface and a new SDL::Color { my ($app, %args) = @_; - $app->fill( $args{ bg }, $args{ bg_color } ); - $app->fill( $args{rect}, $args{rect_color} ); - $app->update( $args{bg} ); + SDL::Video::fill_rect($app, $args{bg}, $args{bg_color} ); + SDL::Video::fill_rect($app, $args{rect}, $args{rect_color} ); + SDL::Video::update_rects($app, $args{bg} ); } @@ -118,9 +118,10 @@ figure out the rectangle of the correct size to update(). No thank { my ($app, %args) = @_; - $app->fill( $args{old_rect}, $args{bg_color} ); - $app->fill( $args{rect], $args{rect_color} ); - $app->update( $args{old_rect}, $args{rect} ); + SDL::Video::fill_rect($app, $args{old_rect}, $args{bg_color} ); + SDL::Video::fill_rect($app, $args{rect}, $args{rect_color} ); + SDL::Video::update_rects($app, $args{old_rect} ); + SDL::Video::update_rects($app, $args{rect} ); } @@ -155,11 +156,11 @@ them soon.

SEE ALSO

Top

-
SDL::Tutorial::Drawing
+
SDL::Tutorial::Drawing

basic drawing with SDL Perl

-
SDL::Tutorial::Images
+
SDL::Tutorial::Images

animating images

@@ -169,6 +170,7 @@ them soon.

AUTHOR

Top

chromatic, <chromatic@wgz.org>

+

updated by kthakore, <kthakore@cpan.org>

Written for and maintained by the Perl SDL project, http://sdl.perl.org/.