better end-screen font

main
Elijah C. Voigt 1 year ago
parent f522c2cbbf
commit ad864adc1b

@ -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::<KeyboardInput>()),
display_diagnostics.run_if(in_state(DebugState::Enabled)),
toggle_debug_ui.run_if(state_changed::<DebugState>),
aspect_ratio.run_if(on_event::<WindowResized>())
),
);
}
@ -257,3 +260,15 @@ fn debug_piece(
}
}
}
fn aspect_ratio(
mut debug_info: ResMut<DebugInfo>,
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);
})
}

@ -1177,6 +1177,7 @@ fn set_endgame(
mut commands: Commands,
tweaks_file: Res<tweak::GameTweaks>,
tweaks: Res<Assets<tweak::Tweaks>>,
ui_font: Res<ui::UiFont>,
) {
let tweak = tweaks.get(tweaks_file.handle.clone()).expect("Load tweaks");
let button_handle = tweak.get_handle::<Image>("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(),
},
));

Loading…
Cancel
Save