Adonthell
0.4
|
Declares the gametime class. More...
#include "types.h"
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... | |
Defines | |
#define | CYCLE_LENGTH 13 |
Length of a game cycle, in milliseconds. | |
#define | FRAME_RATE 50 |
Number of maximum displayed frames per second. | |
#define | FTS_LIMIT 20 |
Defines the maximum number of frames to skip in order to keep the game's speed constant on slow machines. |
Declares the gametime class.
Definition in file gametime.h.
#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 33 of file gametime.h.
#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 41 of file gametime.h.
#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 52 of file gametime.h.