Make the Lives(i32) resource appear on debug UI

This commit is contained in:
2025-07-27 10:25:53 -05:00
parent 584a30f7f8
commit 88db8a868a

View File

@@ -4,6 +4,9 @@ mod title_screen;
use crate::config::{BACKGROUND_COLOR, PLAYER_SHIP_COLOR, SHIP_ROTATION, SHIP_THRUST, WINDOW_SIZE}; use crate::config::{BACKGROUND_COLOR, PLAYER_SHIP_COLOR, SHIP_ROTATION, SHIP_THRUST, WINDOW_SIZE};
use bevy::prelude::*; use bevy::prelude::*;
use bevy_inspector_egui::InspectorOptions;
use bevy_inspector_egui::prelude::ReflectInspectorOptions;
use config::{SHIP_THRUSTER_COLOR_ACTIVE, SHIP_THRUSTER_COLOR_INACTIVE}; use config::{SHIP_THRUSTER_COLOR_ACTIVE, SHIP_THRUSTER_COLOR_INACTIVE};
pub struct AsteroidPlugin; pub struct AsteroidPlugin;
@@ -18,6 +21,7 @@ impl Plugin for AsteroidPlugin {
height: WINDOW_SIZE.y, height: WINDOW_SIZE.y,
}) })
.insert_resource(Lives(3)) .insert_resource(Lives(3))
.register_type::<Lives>()
.insert_resource(Score(0)) .insert_resource(Score(0))
.add_systems( .add_systems(
FixedUpdate, FixedUpdate,
@@ -68,7 +72,8 @@ impl From<Score> for String {
} }
} }
#[derive(Resource, Debug, Deref, Clone, Copy)] #[derive(InspectorOptions, Reflect, Resource, Debug, Deref, Clone, Copy)]
#[reflect(Resource, InspectorOptions)]
struct Lives(i32); struct Lives(i32);
impl From<Lives> for String { impl From<Lives> for String {