<!-- INDEX START -->
<h3 id="TOP">Index</h3>
-<ul><li><a href="#NAME">NAME</a></li>
+<ul><li><a href="#NAME">NAME</a>
+<ul><li><a href="#CATEGORY">CATEGORY</a></li>
+</ul>
+</li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
<li><a href="#ANIMATING_A_RECTANGLE">ANIMATING A RECTANGLE</a>
<ul><li><a href="#Redrawing_the_Screen">Redrawing the Screen</a></li>
<li><a href="#COPYRIGHT">COPYRIGHT</a>
</li>
</ul><hr />
-<!-- INDEX END -->
+<!-- INDEX END --><a href="assets/Animation.jpg" target="_blank"><img src="assets/Animation.jpg" style="height: 160px" alt="Animation.jpg"/></a><hr />
<h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="NAME_CONTENT">
<p>SDL::Tutorial::Animation</p>
</div>
+<h2 id="CATEGORY">CATEGORY</h2>
+<div id="CATEGORY_CONTENT">
+<p>Tutorials</p>
+
+</div>
<h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="SYNOPSIS_CONTENT">
<pre> # to read this tutorial
<div id="Redrawing_the_Screen_CONTENT">
<p>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 <cite>SDL::App</cite> object <code>$app</code>, a <cite>SDL::Rect</cite> <code>$rect</code>, and
-a <cite>SDL::Color</cite> <code>$color</code>, you only have to create a new SDL::Rect <code>$bg</code>,
-representing the whole of the background surface and a new SDL::Color
-<code>$bg_color</code>, representing the background color. You can write a
-<code>draw_frame()</code> function as follows:</p>
+every frame. Given a <a href="http://search.cpan.org/perldoc?SDLx::App">SDLx::App</a> object <code>$app</code>, a <a href="SDL-Rect.html">SDL::Rect</a> <code>$rect</code>, and
+a <a href="SDL-Color.html">SDL::Color</a> <code>$color</code>, you only have to create a new SDL::Rect <code>$bg</code>,
+representing the whole of the background surface and a new mapped color
+<code>$bg_color</code>, representing the background color. The colors need to be mapped
+to the format of the current display. This is done by <a href="/SDL-Video.html#map_RGB">SDL::Video::map_RGB</a>.</p>
+<p> </p>
+<p>my $color = SDL::Video::map_RGB (
+ $app->format,
+ $rect_r,
+ $rect_g,
+ $rect_b,
+);</p>
+<p>my $bg_color = SDL::Video::map_RGB (
+ $app->format,
+ $bg_r,
+ $bg_g,
+ $bg_b,
+);</p>
+<p> </p>
+
+
+
+
+
+
+
+<p>You can write a <code>draw_frame()</code> function as follows:</p>
<p> </p>
<pre> sub draw_frame
{
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} );
}
</pre>
{
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} );
}
</pre>
<h1 id="SEE_ALSO">SEE ALSO</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="SEE_ALSO_CONTENT">
<dl>
- <dt><cite>SDL::Tutorial::Drawing</cite></dt>
+ <dt><a href="SDL-Tutorial-Drawing.html">SDL::Tutorial::Drawing</a></dt>
<dd>
<p>basic drawing with SDL Perl</p>
</dd>
- <dt><cite>SDL::Tutorial::Images</cite></dt>
+ <dt><a href="SDL-Tutorial-Images.html">SDL::Tutorial::Images</a></dt>
<dd>
<p>animating images</p>
</dd>
<h1 id="AUTHOR">AUTHOR</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="AUTHOR_CONTENT">
<p>chromatic, <chromatic@wgz.org></p>
-<p>Written for and maintained by the Perl SDL project, <a href="http://sdl.perl.org/">http://sdl.perl.org/</a>.</p>
+<p>Written for and maintained by the Perl SDL project, <a href="http://sdl.perl.org/">http://sdl.perl.org/</a>.
+See <b>AUTHORS</b> in <cite>SDL</cite>.</p>
</div>
<h1 id="BUGS">BUGS</h1><p><a href="#TOP" class="toplink">Top</a></p>