Adonthell  0.4
gametime.h File Reference

Declares the gametime class. More...

#include "types.h"
Include dependency graph for gametime.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  gametime
 Tehe gametime class makes the speed of the game independent of the machine it runs on. More...
 

Macros

#define CYCLE_LENGTH   13
 Length of a game cycle, in milliseconds. More...
 
#define FRAME_RATE   50
 Number of maximum displayed frames per second. More...
 
#define FTS_LIMIT   20
 Defines the maximum number of frames to skip in order to keep the game's speed constant on slow machines. More...
 

Detailed Description

Declares the gametime class.

Author
Kai Sterker

Definition in file gametime.h.

Macro Definition Documentation

§ CYCLE_LENGTH

#define CYCLE_LENGTH   13

Length of a game cycle, in milliseconds.

Decrease it to speed up the game, increase it to slow the game down. This constant defines how often the state of the game world is updated. A cycle length of 13 means 1000/13 = 76.9 updates per second.

Definition at line 37 of file gametime.h.

§ FRAME_RATE

#define FRAME_RATE   50

Number of maximum displayed frames per second.

This value affects the renderer only, not the speed of the game itself. Limiting the frame rate prevents Adonthell from using all the CPU of the machine it runs on (as long as the machine is fast enough).

Definition at line 45 of file gametime.h.

§ FTS_LIMIT

#define FTS_LIMIT   20

Defines the maximum number of frames to skip in order to keep the game's speed constant on slow machines.

If updating the game state and drawing everything on screen takes longer than CYCLE_LENGTH, we skip frames so that the correct number of updates can be performed, thus keeping the speed constant. However, we can't skip too many frames, since that would result in jerky animations and eventually render the game unplayable.

Definition at line 56 of file gametime.h.