Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Added a more description of show and move handlers

  • Loading branch information...
commit 533f42b624ca25b376e7932bac753d6c3aa12f2f 1 parent c953333
@kthakore kthakore authored
Showing with 14 additions and 5 deletions.
  1. +2 −2 src/02-drawing.pod
  2. +12 −3 src/04-game.pod
4 src/02-drawing.pod
@@ -76,8 +76,8 @@ specifying the same value for each of the Red, Green, and Blue color
channels. The fourth and final value designates the transparency (or Alpha
channel) where a 0 value makes the resulting color fully transparent and
255 makes it entirely opaque. A transparency value somewhere in between
-will allow underlying colors to be blended with the specified RGB values
-into the final color output.
+will allow underlying (pixel data of surfaces below the current one) colors to
+be blended with the specified RGB values into the final color output.
You may also represent a color as hexadecimal values, where the values of the
numbers range from 0-255 for 32 bit depth in RGBA format:
15 src/04-game.pod
@@ -274,7 +274,7 @@ Better solutions are available.
=head1 Integrating Physics
-=for author
+=for editor
Describe movement and show handlers.
@@ -285,9 +285,9 @@ solution. Instead of updating object positions based on how fast the computer
can get through the game loop, derive their positions from a physical model
based on the passage of time. Objects moving according to real world time will
have consistent behavior at all CPU speeds and smooth interpolation between
-frames. SDLx::App provides this behavior through movement and show handlers.
+frames. C<SDLx::App> provides this behavior through movement and show handlers.
-A simple physics model for the laser has a consistent horizontal velocity in
+Consider a simple physics model for the laser has a consistent horizontal velocity in
pixels per time step at the window's mid-point:
X = Velocity * time step,
@@ -310,6 +310,15 @@ objects and callbacks. The implementation of such complex models is
non-trivial; see the lengthy discussion in the documentation of the
C<SDLx::Controller> module.
+C<SDLx::App> using the C<SDLx::Controller> module provide callbacks to handle both
+aspects of this type of game loop. One is the the movement handler, which is a
+callback where calculations of the next step for each relevant data point is calculated.
+In the above example the movement handler would calculate the C<X> and C<Y> values, for
+each time step between the frames of animations.
+When we are ready to render the frame it is handled by the show handler. In the above
+example that would mean the show handler would print or render the C<X, Y> values.
=head2 Laser in Real Time
This version of the laser example demonstrates the use of movement, show
Please sign in to comment.
Something went wrong with that request. Please try again.