4 releases

0.2.0 Jun 30, 2020
0.1.2 Jun 8, 2020
0.1.1 Jun 8, 2020
0.1.0 Jun 8, 2020

#1041 in Game dev

Download history 19/week @ 2024-02-19 19/week @ 2024-02-26 8/week @ 2024-03-04 22/week @ 2024-03-11 7/week @ 2024-03-18

57 downloads per month
Used in push2_pong

MIT license

11KB
93 lines

gameloop-rs

Build Status Documentation Version License

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 */
        }
    }
}

lib.rs:

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 */
        }
    }
}

Dependencies

~87KB