1use bevy_app::{App, Startup};
2use bevy_doryen::doryen::{AppOptions, TextAlign};
3use bevy_doryen::prelude::*;
4use bevy_doryen::FpsInfo;
5use bevy_ecs::system::{Res, ResMut};
6
7pub fn main() {
15 App::new()
16 .insert_resource(DoryenPluginSettings {
17 app_options: AppOptions {
18 window_title: String::from("lowfps test"),
19 vsync: false,
20 max_fps: 10,
21 ..Default::default()
22 },
23 ..Default::default()
24 })
25 .add_plugins(DoryenPlugin)
26 .add_systems(Startup, init)
27 .add_systems(Render, render)
28 .run();
29}
30
31fn init(mut root_console: ResMut<RootConsole>) {
32 root_console.register_color("red", (255, 92, 92, 255));
33}
34
35fn render(fps: Res<FpsInfo>, mut root_console: ResMut<RootConsole>) {
36 let fps = fps.fps;
37
38 let x = (root_console.get_width() / 2) as i32;
39 let y = (root_console.get_height() / 2) as i32;
40
41 root_console.print_color(
42 x,
43 y,
44 &format!("Frames since last second : #[red]{}", fps),
45 TextAlign::Center,
46 None,
47 );
48}