Function macroquad::window::next_frame

source ·
pub fn next_frame() -> FrameFuture
Expand description

Block execution until the next frame.

Examples found in repository?
examples/window_conf.rs (line 19)
16
17
18
19
20
21
async fn main() {
    loop {
        clear_background(WHITE);
        next_frame().await
    }
}
More examples
Hide additional examples
examples/texture.rs (line 10)
4
5
6
7
8
9
10
11
12
async fn main() {
    let texture: Texture2D = load_texture("examples/ferris.png").await.unwrap();

    loop {
        clear_background(LIGHTGRAY);
        draw_texture(&texture, 0., 0., WHITE);
        next_frame().await
    }
}
examples/logs.rs (line 19)
8
9
10
11
12
13
14
15
16
17
18
19
20
21
async fn main() {
    debug!("This is a debug message");
    info!("and info message");
    error!("and errors, the red ones!");
    warn!("Or warnings, the yellow ones.");

    loop {
        clear_background(LIGHTGRAY);

        debug!("Still alive!");

        next_frame().await
    }
}
examples/text_measures.rs (line 92)
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
async fn main() {
    let font = load_ttf_font("./examples/DancingScriptRegular.ttf")
        .await
        .unwrap();

    loop {
        clear_background(BLACK);

        let text = "abcdIj";

        draw_text_annotated(text, None, 40.0, 200.0);
        draw_text_annotated(text, Some(&font), 400.0, 400.0);

        next_frame().await
    }
}
examples/tree.rs (line 44)
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
async fn main() {
    let camera = Camera2D {
        zoom: vec2(1., 1.),
        target: vec2(0.0, 0.5),
        ..Default::default()
    };

    set_camera(&camera);
    loop {
        clear_background(LIGHTGRAY);

        draw_circle(0., 0., 0.03, DARKGRAY);
        tree(unsafe { get_internal_gl().quad_gl }, get_time(), 0, 1., 0.3);

        next_frame().await
    }
}
examples/basic_shapes.rs (line 14)
4
5
6
7
8
9
10
11
12
13
14
15
16
async fn main() {
    loop {
        clear_background(LIGHTGRAY);

        draw_line(40.0, 40.0, 100.0, 200.0, 15.0, BLUE);
        draw_rectangle(screen_width() / 2.0 - 60.0, 100.0, 120.0, 60.0, GREEN);
        draw_circle(screen_width() - 30.0, screen_height() - 30.0, 15.0, YELLOW);

        draw_text("HELLO", 20.0, 20.0, 30.0, DARKGRAY);

        next_frame().await
    }
}