Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Explanation of basic game loop

  • Loading branch information...
commit 12e32c23fdc82b923610de7dbd9b848c301139c8 1 parent 49f25f3
@kthakore kthakore authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/04-game.pod
View
7 src/04-game.pod
@@ -2,17 +2,22 @@
=head1 Simplest Game Loop
+The simplest game loop can be boiled down to the following.
+
=for programlisting
while($quit)
{
- do_events();
+ get_events();
calculate_next_positions();
render();
}
=for programlisting
+In C<get_events()> we get events from what input devices that we need. It is important to process events first to prevent lag.
+In C<calculate_next_positions> we update the game state according to animations and the events captured. In C<render()> we will update the screen and show the game to the player.
+
=head2 Problems
Not good.
Please sign in to comment.
Something went wrong with that request. Please try again.