From c80fec0dd4db8ad9dcaaf8e007ce881ec68228a0 Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 17 Mar 2024 21:29:27 +0100 Subject: [PATCH] add some player vars and display them in gauges --- src/hud.rs | 51 ++++++++++++++++++++++++++++++++++++++++++++++----- src/main.rs | 4 ++++ src/player.rs | 24 ++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 5 deletions(-) diff --git a/src/hud.rs b/src/hud.rs index 4914cd9..df2c592 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -1,4 +1,4 @@ -use crate::settings; +use crate::{settings, player}; use bevy::prelude::*; use bevy::diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin}; @@ -14,7 +14,7 @@ impl Plugin for OutFlyHudPlugin { const FONT: &str = "tmp/fonts/NotoSansSC-Thin.ttf"; #[derive(Component)] -struct FpsText; +struct GaugesText; #[derive(Resource)] struct FPSUpdateTimer(Timer); @@ -48,19 +48,56 @@ fn setup( ..default() } ), + TextSection::new( + "\n OXYGEN ", + TextStyle { + font: asset_server.load(FONT), + font_size: settings.font_size_hud, + color: Color::GRAY, + ..default() + }, + ), + TextSection::new( + "", + TextStyle { + font: asset_server.load(FONT), + font_size: settings.font_size_hud, + color: Color::GRAY, + ..default() + } + ), + TextSection::new( + "\n Adren水平 ", + TextStyle { + font: asset_server.load(FONT), + font_size: settings.font_size_hud, + color: Color::GRAY, + ..default() + }, + ), + TextSection::new( + "", + TextStyle { + font: asset_server.load(FONT), + font_size: settings.font_size_hud, + color: Color::GRAY, + ..default() + } + ), ]); bundle_fps.visibility = visibility; commands.spawn(( bundle_fps, - FpsText, + GaugesText, )); } fn update( diagnostics: Res, time:Res