diff --git a/crates/components/src/ais_indicator.rs b/crates/components/src/ais_indicator.rs new file mode 100644 index 0000000..2370e97 --- /dev/null +++ b/crates/components/src/ais_indicator.rs @@ -0,0 +1,5 @@ +use bevy::prelude::*; + +/// AIS indicator component for displaying AIS system status +#[derive(Component)] +pub struct AisIndicator; \ No newline at end of file diff --git a/crates/components/src/compass_gauge.rs b/crates/components/src/compass_gauge.rs new file mode 100644 index 0000000..b5de06f --- /dev/null +++ b/crates/components/src/compass_gauge.rs @@ -0,0 +1,5 @@ +use bevy::prelude::*; + +/// Compass gauge component for displaying vessel heading +#[derive(Component)] +pub struct CompassGauge; \ No newline at end of file diff --git a/crates/components/src/depth_gauge.rs b/crates/components/src/depth_gauge.rs new file mode 100644 index 0000000..9e83264 --- /dev/null +++ b/crates/components/src/depth_gauge.rs @@ -0,0 +1,5 @@ +use bevy::prelude::*; + +/// Depth gauge component for displaying water depth +#[derive(Component)] +pub struct DepthGauge; \ No newline at end of file diff --git a/crates/components/src/engine_status.rs b/crates/components/src/engine_status.rs new file mode 100644 index 0000000..597ab18 --- /dev/null +++ b/crates/components/src/engine_status.rs @@ -0,0 +1,5 @@ +use bevy::prelude::*; + +/// Engine status component for displaying engine information +#[derive(Component)] +pub struct EngineStatus; \ No newline at end of file diff --git a/crates/components/src/gps_indicator.rs b/crates/components/src/gps_indicator.rs new file mode 100644 index 0000000..96432cc --- /dev/null +++ b/crates/components/src/gps_indicator.rs @@ -0,0 +1,5 @@ +use bevy::prelude::*; + +/// GPS indicator component for displaying GPS system status +#[derive(Component)] +pub struct GpsIndicator; \ No newline at end of file diff --git a/crates/components/src/cluster.rs b/crates/components/src/instrument_cluster.rs similarity index 84% rename from crates/components/src/cluster.rs rename to crates/components/src/instrument_cluster.rs index 5c373eb..2801d1d 100644 --- a/crates/components/src/cluster.rs +++ b/crates/components/src/instrument_cluster.rs @@ -1,26 +1,21 @@ use bevy::prelude::*; -use super::instruments::*; use super::theme::*; use super::composition::*; +use super::speed_gauge::SpeedGauge; +use super::depth_gauge::DepthGauge; +use super::compass_gauge::CompassGauge; +use super::engine_status::EngineStatus; +use super::navigation_display::NavigationDisplay; +use super::gps_indicator::GpsIndicator; +use super::radar_indicator::RadarIndicator; +use super::ais_indicator::AisIndicator; +use super::system_display::SystemDisplay; +use super::wind_display::WindDisplay; +/// Main instrument cluster component #[derive(Component)] pub struct InstrumentCluster; -#[derive(Component)] -pub struct GpsIndicator; - -#[derive(Component)] -pub struct RadarIndicator; - -#[derive(Component)] -pub struct AisIndicator; - -#[derive(Component)] -pub struct SystemDisplay; - -#[derive(Component)] -pub struct WindDisplay; - /// Sets up the main instrument cluster UI using composable components pub fn setup_instrument_cluster(mut commands: Commands) { // Spawn camera since we're bypassing the menu system @@ -110,45 +105,39 @@ pub fn setup_instrument_cluster(mut commands: Commands) { grid.spawn(progress_bar_node()) .with_children(|bar| { bar.spawn(create_text("FUEL", FONT_SIZE_SMALL, TEXT_COLOR_PRIMARY)); - bar.spawn(( - progress_bar_background_node(), - BackgroundColor(BACKGROUND_COLOR_PRIMARY), - BorderColor(TEXT_COLOR_PRIMARY), - )) - .with_children(|bar_bg| { - bar_bg.spawn(( + bar.spawn(progress_bar_background_node()) + .with_children(|bg| { + bg.spawn(( progress_bar_fill_node(75.0), BackgroundColor(TEXT_COLOR_SUCCESS), )); }); - bar.spawn(create_text("75%", FONT_SIZE_SMALL, TEXT_COLOR_PRIMARY)); + bar.spawn(create_text("75%", FONT_SIZE_SMALL, TEXT_COLOR_SUCCESS)); }); // Battery Level Bar grid.spawn(progress_bar_node()) .with_children(|bar| { - bar.spawn(create_text("BATTERY", FONT_SIZE_SMALL, TEXT_COLOR_PRIMARY)); - bar.spawn(( - progress_bar_background_node(), - BackgroundColor(BACKGROUND_COLOR_SECONDARY), - BorderColor(BORDER_COLOR_SECONDARY), - )) - .with_children(|bar_bg| { - bar_bg.spawn(( + bar.spawn(create_text("BATT", FONT_SIZE_SMALL, TEXT_COLOR_PRIMARY)); + bar.spawn(progress_bar_background_node()) + .with_children(|bg| { + bg.spawn(( progress_bar_fill_node(88.0), - BackgroundColor(BACKGROUND_COLOR_SECONDARY), + BackgroundColor(TEXT_COLOR_SUCCESS), )); }); - bar.spawn(create_text("88%", FONT_SIZE_SMALL, TEXT_COLOR_PRIMARY)); + bar.spawn(create_text("88%", FONT_SIZE_SMALL, TEXT_COLOR_SUCCESS)); }); - // System Status Indicators - grid.spawn(Node { - flex_direction: FlexDirection::Row, - justify_content: JustifyContent::SpaceBetween, - width: Val::Percent(100.0), - ..default() - }) + // System Indicators Row + grid.spawn(( + Node { + flex_direction: FlexDirection::Row, + justify_content: JustifyContent::SpaceEvenly, + width: Val::Percent(100.0), + ..default() + }, + )) .with_children(|indicators| { // GPS Indicator indicators.spawn(( @@ -225,4 +214,4 @@ pub fn setup_instrument_cluster(mut commands: Commands) { display.spawn(create_text("Select a system above to view details", FONT_SIZE_SMALL, TEXT_COLOR_SECONDARY)); }); }); -} +} \ No newline at end of file diff --git a/crates/components/src/lib.rs b/crates/components/src/lib.rs index a5bf7eb..65f9920 100644 --- a/crates/components/src/lib.rs +++ b/crates/components/src/lib.rs @@ -3,14 +3,38 @@ // Components crate for yacht pit application // This crate contains reusable UI and game components +// Shared modules pub mod ui; -pub mod instruments; pub mod theme; -pub mod cluster; pub mod composition; +// Individual component modules +pub mod speed_gauge; +pub mod depth_gauge; +pub mod compass_gauge; +pub mod engine_status; +pub mod navigation_display; +pub mod yacht_data; +pub mod instrument_cluster; +pub mod gps_indicator; +pub mod radar_indicator; +pub mod ais_indicator; +pub mod system_display; +pub mod wind_display; + +// Re-export everything pub use ui::*; -pub use instruments::*; pub use theme::*; -pub use cluster::*; pub use composition::*; +pub use speed_gauge::*; +pub use depth_gauge::*; +pub use compass_gauge::*; +pub use engine_status::*; +pub use navigation_display::*; +pub use yacht_data::*; +pub use instrument_cluster::*; +pub use gps_indicator::*; +pub use radar_indicator::*; +pub use ais_indicator::*; +pub use system_display::*; +pub use wind_display::*; diff --git a/crates/components/src/navigation_display.rs b/crates/components/src/navigation_display.rs new file mode 100644 index 0000000..91a1ab6 --- /dev/null +++ b/crates/components/src/navigation_display.rs @@ -0,0 +1,5 @@ +use bevy::prelude::*; + +/// Navigation display component for showing navigation information +#[derive(Component)] +pub struct NavigationDisplay; \ No newline at end of file diff --git a/crates/components/src/radar_indicator.rs b/crates/components/src/radar_indicator.rs new file mode 100644 index 0000000..43526e4 --- /dev/null +++ b/crates/components/src/radar_indicator.rs @@ -0,0 +1,5 @@ +use bevy::prelude::*; + +/// Radar indicator component for displaying radar system status +#[derive(Component)] +pub struct RadarIndicator; \ No newline at end of file diff --git a/crates/components/src/speed_gauge.rs b/crates/components/src/speed_gauge.rs new file mode 100644 index 0000000..f27ac9a --- /dev/null +++ b/crates/components/src/speed_gauge.rs @@ -0,0 +1,5 @@ +use bevy::prelude::*; + +/// Speed gauge component for displaying vessel speed +#[derive(Component)] +pub struct SpeedGauge; \ No newline at end of file diff --git a/crates/components/src/system_display.rs b/crates/components/src/system_display.rs new file mode 100644 index 0000000..b68c54d --- /dev/null +++ b/crates/components/src/system_display.rs @@ -0,0 +1,5 @@ +use bevy::prelude::*; + +/// System display component for showing detailed system information +#[derive(Component)] +pub struct SystemDisplay; \ No newline at end of file diff --git a/crates/components/src/wind_display.rs b/crates/components/src/wind_display.rs new file mode 100644 index 0000000..8982825 --- /dev/null +++ b/crates/components/src/wind_display.rs @@ -0,0 +1,5 @@ +use bevy::prelude::*; + +/// Wind display component for showing wind information +#[derive(Component)] +pub struct WindDisplay; \ No newline at end of file diff --git a/crates/components/src/instruments.rs b/crates/components/src/yacht_data.rs similarity index 91% rename from crates/components/src/instruments.rs rename to crates/components/src/yacht_data.rs index 8a00cec..843090e 100644 --- a/crates/components/src/instruments.rs +++ b/crates/components/src/yacht_data.rs @@ -1,20 +1,7 @@ use bevy::prelude::*; - -/// Individual instrument components -#[derive(Component)] -pub struct SpeedGauge; - -#[derive(Component)] -pub struct DepthGauge; - -#[derive(Component)] -pub struct CompassGauge; - -#[derive(Component)] -pub struct EngineStatus; - -#[derive(Component)] -pub struct NavigationDisplay; +use super::speed_gauge::SpeedGauge; +use super::depth_gauge::DepthGauge; +use super::compass_gauge::CompassGauge; /// Yacht data resource containing all sensor readings #[derive(Resource)]