Skip To Content

Athabasca University

5.1. Timers

Learning Objectives

When you have finished section 5.1, you should be able to:

  1. Explain what timers are.
  2. Use timers in your game.

Required Tasks

  1. Study the Timers section of Chapter 11, Programming the Perfect Game Loop, in the eTextbook.
  2. Carefully study all the routines for the use of timers.
  3. Type the source code of the TimerTest program into your Dev-C++, and study carefully.

Optional Tasks

  1. Load the TimerTest example program from the Files link below, and play with the code.
  2. Build and run the program.

Files (TimerTest)

Review Questions

  1. Why do you need to slow a game down to a fixed rate?
  2. What routine does Allegro provide to time a game?
  3. What routine do you use to install a timer?
  4. What routine do you use to remove a timer?
  5. How do you calculate the frame rate of a game program using a timer?

Updated May 24 2016 by FST Course Production