Function macroquad::window::next_frame
source · pub fn next_frame() -> FrameFuture
Expand description
Block execution until the next frame.
Examples found in repository?
More examples
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
}
}
Additional examples can be found in:
- examples/audio.rs
- examples/camera.rs
- examples/input_keys.rs
- examples/input_touch.rs
- examples/screen_texture.rs
- examples/exit_dialog.rs
- examples/custom_material.rs
- examples/3d.rs
- examples/post_processing.rs
- examples/events.rs
- examples/raw_miniquad.rs
- examples/rustaceanmark.rs
- examples/text.rs
- examples/letterbox.rs
- examples/life.rs
- examples/first_person.rs
- examples/arkanoid.rs
- examples/camera_transformations.rs
- examples/ui.rs
- examples/snake.rs
- examples/asteroids.rs
- examples/ui_skins.rs
- examples/shadertoy.rs