diff --git a/src/debug.rs b/src/debug.rs index 5caff6a..49f8b4d 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -1,3 +1,5 @@ +use bevy::window::WindowResized; + use crate::prelude::*; pub(crate) struct DebugPlugin; @@ -29,6 +31,7 @@ impl Plugin for DebugPlugin { toggle_debug_mode.run_if(on_event::()), display_diagnostics.run_if(in_state(DebugState::Enabled)), toggle_debug_ui.run_if(state_changed::), + aspect_ratio.run_if(on_event::()) ), ); } @@ -257,3 +260,15 @@ fn debug_piece( } } } + +fn aspect_ratio( + mut debug_info: ResMut, + window: Query<&Window>, +) { + window.iter().for_each(|window| { + let x = window.resolution.width(); + let y = window.resolution.height(); + let aspect_ratio = format!("{}x{}", x, y); + debug_info.set("aspect Ratio".into(), aspect_ratio); + }) +} \ No newline at end of file diff --git a/src/game.rs b/src/game.rs index b1dfa15..00c8f6e 100644 --- a/src/game.rs +++ b/src/game.rs @@ -1177,6 +1177,7 @@ fn set_endgame( mut commands: Commands, tweaks_file: Res, tweaks: Res>, + ui_font: Res, ) { let tweak = tweaks.get(tweaks_file.handle.clone()).expect("Load tweaks"); let button_handle = tweak.get_handle::("buttons_image_resting").unwrap(); @@ -1202,11 +1203,11 @@ fn set_endgame( )) .with_children(|parent| { parent.spawn(TextBundle::from_section( - "S C O R E", + "SCORE", TextStyle { font_size: 48.0, color: Color::ORANGE_RED, - ..default() + font: ui_font.handle.clone(), }, )); parent.spawn(TextBundle::from_section( @@ -1214,7 +1215,7 @@ fn set_endgame( TextStyle { font_size: 32.0, color: Color::BLUE, - ..default() + font: ui_font.handle.clone(), }, )); parent.spawn(TextBundle::from_section( @@ -1222,7 +1223,7 @@ fn set_endgame( TextStyle { font_size: 32.0, color: Color::RED, - ..default() + font: ui_font.handle.clone(), }, ));