Expand description
An implementation of deWiTTERS game loop.
§Usage
// run at 20 ticks per second, with max frame skip of 5
let game_loop = GameLoop::new(20, 5).unwrap();
// begin core game loop
loop {
// ... handle window events ...
for action in game_loop.actions() {
match action {
FrameAction::Tick => /* simulate 1 game tick */
FrameAction::Render { interpolation } => /* render the game state interpolated
between previous and next tick */
}
}
}
Structs§
- Frame
Actions - Iterator of
FrameAction
s, returned byGameLoop::actions
. - Game
Loop - Represents the core loop for the duration of the game.
Enums§
- Frame
Action - Represents a tick or render instruction, to be interpreted by your game.
- Game
Loop Error - Errors possible when initializing
GameLoop
.