bevy_screen_diags

Crates.iobevy_screen_diags
lib.rsbevy_screen_diags
version0.6.0
sourcesrc
created_at2021-01-30 03:35:33.266376
updated_at2023-08-01 07:30:59.122722
descriptionAn on-screen FPS display for bevyengine.org
homepage
repositoryhttps://github.com/jomala/bevy_screen_diags/
max_upload_size
id348342
size557,761
Lemon (LemonjamesD)

documentation

https://docs.rs/bevy_screen_diags/

README

Bevy diagnostics overlay

Crates.io Bevy tracking

bevy_screen_diags adds a very simple frames-per-second (FPS) display to your screen in Bevy.

It was inspired by (and copied from) https://github.com/bevyengine/bevy/blob/main/examples/ui/text.rs.

Usage

Put the crate into your Cargo.toml.

bevy_screen_diags = "0.6.0"

Include the plugin when you build your App.

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugin(bevy_screen_diags::ScreenDiagsTextPlugin)
        //If a UI camera is already in your game remove the next line
        .add_systems(Startup, |mut commands: Commands| {
            commands.spawn_bundle(Camera2dBundle::default());
        });
}

Put the font you want to use in assets/fonts/screen-diags-font.ttf. If you want, you can use the font at that path in this project (which is FiraSans-Bold).

Example screen showing the FPS

The basic example just shows the FPS count on a grey background, but you can click your mouse on the window to add or remove the display.

The customized example uses the ScreenDiagsText marker component to tweak the font and position of the FPS display.

Contributions to the crate are welcome.

Commit count: 76

cargo fmt