Skip to content

Commit

Permalink
Font size fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ayamaev-se committed Dec 6, 2023
1 parent c685177 commit f3912d7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/debug_diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use bevy::prelude::*;

use crate::safe_area::SheepCounter;

const FONT_SIZE: f32 = 24.0;

pub struct DiagnosticPlugin;

impl Plugin for DiagnosticPlugin {
Expand All @@ -26,7 +28,7 @@ pub fn setup_diagnostic_panel(mut commands: Commands) {
style: Style {
top: Val::Px(0.0),
left: Val::Px(0.0),
width: Val::Px(100.0),
width: Val::Px(200.0),
position_type: PositionType::Absolute,
flex_direction: FlexDirection::Column,
justify_content: JustifyContent::Center,
Expand All @@ -45,8 +47,11 @@ pub fn setup_diagnostic_panel(mut commands: Commands) {
pub struct FrameCounter;

pub fn setup_counter(mut commands: Commands, panels: Query<Entity, With<DiagnosticPanel>>) {
let mut text_style = TextStyle::default();
text_style.font_size = FONT_SIZE;

let frame_counter = commands
.spawn(TextBundle::from_section("FPS: ", TextStyle::default()))
.spawn(TextBundle::from_section("FPS: ", text_style))
.insert(FrameCounter)
.id();

Expand All @@ -68,8 +73,10 @@ pub fn setup_sheep_counter(
mut commands: Commands,
panels: Query<Entity, With<DiagnosticPanel>>,
) {
let mut text_style = TextStyle::default();
text_style.font_size = FONT_SIZE;
let sheep_counter = commands
.spawn(TextBundle::from_section("Sheep in safe area: ", TextStyle::default()))
.spawn(TextBundle::from_section("Sheep in safe area: ", text_style))
.insert(ShipDebugCounter)
.id();

Expand Down

0 comments on commit f3912d7

Please sign in to comment.