make buttons functional

This commit is contained in:
geoffsee
2025-07-02 19:49:50 -04:00
parent f5de8e943b
commit 6f94c38080
4 changed files with 35 additions and 27 deletions

View File

@@ -6,10 +6,7 @@ use super::depth_gauge::DepthGauge;
use super::compass_gauge::CompassGauge; use super::compass_gauge::CompassGauge;
use super::engine_status::EngineStatus; use super::engine_status::EngineStatus;
use super::navigation_display::NavigationDisplay; use super::navigation_display::NavigationDisplay;
use super::gps_indicator::GpsIndicator; use super::system_display::{SystemDisplay, SystemIndicator, SystemDisplayArea};
use super::radar_indicator::RadarIndicator;
use super::ais_indicator::AisIndicator;
use super::system_display::SystemDisplay;
use super::wind_display::WindDisplay; use super::wind_display::WindDisplay;
/// Main instrument cluster component /// Main instrument cluster component
@@ -145,11 +142,12 @@ pub fn setup_instrument_cluster(mut commands: Commands) {
system_indicator_node(), system_indicator_node(),
BackgroundColor(BACKGROUND_COLOR_SECONDARY), BackgroundColor(BACKGROUND_COLOR_SECONDARY),
BorderColor(BORDER_COLOR_SECONDARY), BorderColor(BORDER_COLOR_SECONDARY),
GpsIndicator, SystemIndicator {
system_id: "gps".to_string(),
},
)) ))
.with_children(|indicator| { .with_children(|indicator| {
indicator.spawn(create_text("🛰️", FONT_SIZE_NORMAL, TEXT_COLOR_PRIMARY)); indicator.spawn(create_text("GPS", FONT_SIZE_NORMAL, TEXT_COLOR_PRIMARY));
indicator.spawn(create_text("GPS", FONT_SIZE_SMALL, TEXT_COLOR_PRIMARY));
}); });
// RADAR Indicator // RADAR Indicator
@@ -158,11 +156,12 @@ pub fn setup_instrument_cluster(mut commands: Commands) {
system_indicator_node(), system_indicator_node(),
BackgroundColor(BACKGROUND_COLOR_SECONDARY), BackgroundColor(BACKGROUND_COLOR_SECONDARY),
BorderColor(BORDER_COLOR_SECONDARY), BorderColor(BORDER_COLOR_SECONDARY),
RadarIndicator, SystemIndicator {
system_id: "radar".to_string(),
},
)) ))
.with_children(|indicator| { .with_children(|indicator| {
indicator.spawn(create_text("📡", FONT_SIZE_NORMAL, Color::linear_rgb(0.0, 1.0, 0.0))); indicator.spawn(create_text("RADAR", FONT_SIZE_NORMAL, Color::linear_rgb(0.0, 1.0, 0.0)));
indicator.spawn(create_text("RADAR", FONT_SIZE_SMALL, TEXT_COLOR_PRIMARY));
}); });
// AIS Indicator // AIS Indicator
@@ -171,11 +170,12 @@ pub fn setup_instrument_cluster(mut commands: Commands) {
system_indicator_node(), system_indicator_node(),
BackgroundColor(BACKGROUND_COLOR_SECONDARY), BackgroundColor(BACKGROUND_COLOR_SECONDARY),
BorderColor(BORDER_COLOR_SECONDARY), BorderColor(BORDER_COLOR_SECONDARY),
AisIndicator, SystemIndicator {
system_id: "ais".to_string(),
},
)) ))
.with_children(|indicator| { .with_children(|indicator| {
indicator.spawn(create_text("🚢", FONT_SIZE_NORMAL, TEXT_COLOR_PRIMARY)); indicator.spawn(create_text("AIS", FONT_SIZE_NORMAL, TEXT_COLOR_PRIMARY));
indicator.spawn(create_text("AIS", FONT_SIZE_SMALL, TEXT_COLOR_PRIMARY));
}); });
}); });
}); });
@@ -211,7 +211,15 @@ pub fn setup_instrument_cluster(mut commands: Commands) {
SystemDisplay, SystemDisplay,
)) ))
.with_children(|display| { .with_children(|display| {
display.spawn(create_text("Select a system above to view details", FONT_SIZE_SMALL, TEXT_COLOR_SECONDARY)); display.spawn((
Text::new("Select a system above to view details"),
TextFont {
font_size: FONT_SIZE_SMALL,
..default()
},
TextColor(TEXT_COLOR_SECONDARY),
SystemDisplayArea,
));
}); });
}); });
} }

View File

@@ -3,3 +3,13 @@ use bevy::prelude::*;
/// System display component for showing detailed system information /// System display component for showing detailed system information
#[derive(Component)] #[derive(Component)]
pub struct SystemDisplay; pub struct SystemDisplay;
/// Component for marking UI elements as system indicators
#[derive(Component)]
pub struct SystemIndicator {
pub system_id: String,
}
/// Component for marking the main system display area
#[derive(Component)]
pub struct SystemDisplayArea;

View File

@@ -5,7 +5,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<title>yachtpit</title> <title>yachtpit</title>
<link data-trunk rel="copy-dir" href="assets"/> <link data-trunk rel="copy-dir" href="assets"/>
<link data-trunk rel="copy-dir" href="credits"/>
<link data-trunk rel="copy-file" href="build/windows/icon.ico"/> <link data-trunk rel="copy-file" href="build/windows/icon.ico"/>
<link rel="icon" href="icon.ico"> <link rel="icon" href="icon.ico">
<link data-trunk rel="inline" href="build/web/styles.css"/> <link data-trunk rel="inline" href="build/web/styles.css"/>

View File

@@ -7,7 +7,7 @@
use bevy::prelude::*; use bevy::prelude::*;
use std::collections::HashMap; use std::collections::HashMap;
use systems::{YachtSystem, SystemInteraction, SystemStatus}; use systems::{YachtSystem, SystemInteraction, SystemStatus};
use components::YachtData; use components::{YachtData, SystemIndicator, SystemDisplayArea};
/// Resource for managing all yacht systems /// Resource for managing all yacht systems
#[derive(Resource)] #[derive(Resource)]
@@ -91,15 +91,6 @@ impl Default for SystemManager {
} }
} }
/// Component for marking UI elements as system indicators
#[derive(Component)]
pub struct SystemIndicator {
pub system_id: String,
}
/// Component for marking the main system display area
#[derive(Component)]
pub struct SystemDisplayArea;
/// Plugin for the system manager /// Plugin for the system manager
pub struct SystemManagerPlugin; pub struct SystemManagerPlugin;