laundmo / bevy_screen_diagnostics

On-screen diagnostics
Other
104 stars 12 forks source link

bevy_screen_diagnostics

Display bevy diagnostics on the window without any hassle.

What this can do:

see the examples on how to do this.

Quickstart

This adds the framerate and frametime diagnostics to your window.

use bevy::prelude::*;

use bevy_screen_diagnostics::{ScreenDiagnosticsPlugin, ScreenFrameDiagnosticsPlugin};

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugins(ScreenDiagnosticsPlugin::default())
        .add_plugins(ScreenFrameDiagnosticsPlugin)
        .add_startup_system(setup_camera)
        .run();
}

fn setup_camera(mut commands: Commands) {
    commands.spawn(Camera2dBundle::default());
}

The ScreenFrameDiagnosticsPlugin is a very simple plugin

Plugins

bevy_screen_diagnostics provides the following bevy plugins:

Font

This crate uses bevy's default font (a stripped version of FiraCode) through the builtin-font default feature. You can provide your own font while initialising the ScreenDiagnosticsPlugin by passing it a asset file path.

compatible bevy versions

bevy bevy_screen_diagnostics
0.14 0.6
0.13 0.5
0.12 0.4
0.11 0.3
0.10 0.2
0.9 0.1