1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use comfy::*;

simple_game!(
    "Framerate & VSync config options",
    GameState,
    config,
    setup,
    update
);

fn config(config: GameConfig) -> GameConfig {
    GameConfig { vsync_enabled: false, target_framerate: 500, ..config }
}

pub struct GameState {}

impl GameState {
    pub fn new(_c: &EngineState) -> Self {
        Self {}
    }
}


fn setup(_state: &mut GameState, _c: &mut EngineContext) {
    game_config_mut().dev.show_fps = true;
}

fn update(_state: &mut GameState, _c: &mut EngineContext) {
    draw_circle(vec2(0.0, 0.0), 0.5, RED, 0);

    let config = game_config();

    draw_text(
        &format!(
            "VSync: {} ... Target FPS: {} ... Real FPS: {}",
            config.vsync_enabled,
            config.target_framerate,
            get_fps()
        ),
        vec2(0.0, -2.0),
        WHITE,
        TextAlign::Center,
    );
}