#diagnostics #bevy #fps #log #logging #bevy-plugin

bevy_window_title_diagnostics

Logs Bevy diagnostics into the primary window title

10 releases (breaking)

0.13.1 Feb 19, 2024
0.12.0 Dec 6, 2023
0.6.0 Nov 6, 2023
0.4.0 Mar 25, 2023
0.1.1 Jun 16, 2022

#310 in Game dev

Download history 217/week @ 2024-02-15 73/week @ 2024-02-22 10/week @ 2024-02-29 2/week @ 2024-03-07 1/week @ 2024-03-14 43/week @ 2024-03-28 22/week @ 2024-04-04

67 downloads per month

MIT license

28KB
71 lines

Bevy window title diagnostics

This crate writes Bevy diagnostics into primary window title.

Made for little bit more convenient usage of the FrameTimeDiagnosticsPlugin

Install

Add to your Cargo.toml

For bevy 0.13:

bevy_window_title_diagnostics = 0.13

Usage

Just add WindowTitleLoggerDiagnosticsPlugin from this crate alongside with default FrameTimeDiagnosticsPlugin

use bevy::diagnostic::FrameTimeDiagnosticsPlugin;
use bevy::prelude::*;
use bevy_window_title_diagnostics::WindowTitleLoggerDiagnosticsPlugin;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_startup_system(setup)
        .add_plugin(FrameTimeDiagnosticsPlugin)
        // Insert same way as usual LogDiagnosticsPlugin
        .add_plugin(WindowTitleLoggerDiagnosticsPlugin {
            // It is possible to filter Diagnostics same way as default LogDiagnosticsPlugin
            // filter: Some(vec![FrameTimeDiagnosticsPlugin::FPS]),
            ..Default::default()
        })
        // Works with any diagnostics
        // .add_plugin(bevy::diagnostic::EntityCountDiagnosticsPlugin::default())
        .run();
}

fn setup(mut commands: Commands) {
    commands.spawn(Camera2dBundle::new_with_far(10.0));
    commands.spawn(SpriteBundle {
        sprite: Sprite {
            color: Color::CYAN,
            custom_size: Some(Vec2::new(50.0, 50.0)),
            ..default()
        },
        ..default()
    });
}

Bevy compatibility table

Bevy version bevy_window_title_diagnostics version
0.8 0.2
0.9 0.3
0.10 0.4
0.11 0.5
0.12 0.6

Starting from bevy 0.12 library will have the same semantic version as bevy

Dependencies

~18–48MB
~734K SLoC