shanesveller / bevy_framepace

Framepacing and framelimiting for Bevy

Home Page:https://crates.io/crates/bevy_framepace

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bevy_framepace⏱️

Framepacing and framelimiting for Bevy

crates.io docs.rs CI Bevy tracking

Framepacing.Demo.mp4

Usage

It's as simple as adding the plugin to your app:

app.add_plugin(bevy_framepace::FramepacePlugin::default())

By default, the plugin will automatically measure your framerate and use this for framepacing.

You can adjust the framerate limit when adding the plugin, or at runtime by modifying theFramepacePlugin resource. For example, to set the framerate limit to 30fps:

settings.framerate_limit = FramerateLimit::Manual(30),

See demo.rs in the examples folder, or run with:

cargo run --release --example demo

How it works

image

The plugin works by recording how long it takes to render each frame, and sleeping the main thread until the desired frametime is reached.

The spin_sleep dependency is needed for precise sleep times. The sleep function in the standard library is not accurate enough for this application, especially on Windows.

Bevy Version Support

I intend to track the main branch of Bevy. PRs supporting this are welcome!

bevy bevy_mod_picking
0.7 0.4
0.6 0.3

License

Bevy_framepace is free and open source! All code in this repository is dual-licensed under either:

at your option. This means you can select the license you prefer! This dual-licensing approach is the de-facto standard in the Rust ecosystem and there are very good reasons to include both.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Framepacing and framelimiting for Bevy

https://crates.io/crates/bevy_framepace

License:Other


Languages

Language:Rust 100.0%