diff --git a/src/main.rs b/src/main.rs index 7928a22..53f8ed9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -107,6 +107,7 @@ fn main() { .init_state::() .add_systems(Startup, star_setup) .add_systems(Startup, cons_setup) + .add_systems(Startup, start_ui_setup) .add_systems(Update, start_menu_system.run_if(in_state(GameState::Start))) .add_systems(OnExit(GameState::Start), despawn_screen::) .add_systems(OnEnter(GameState::Game), game_ui_setup) @@ -115,6 +116,59 @@ fn main() { .run(); } +fn start_ui_setup(mut commands: Commands, _asset_server: Res) { + // Create a container node that places its children (text areas) in a vertical column and centers them + let container_node = NodeBundle { + style: Style { + width: Val::Percent(100.0), // Full width of the screen + height: Val::Percent(100.0), // Full height of the screen + flex_direction: FlexDirection::Column, // Arrange children in a column (vertical) + justify_content: JustifyContent::Center, // Center vertically + align_items: AlignItems::Center, // Center horizontally + ..default() + }, + ..default() + }; + + // Create the container for the text areas + let container = commands.spawn(container_node).id(); + + // TextStyle for the top text (larger font) + let top_text_style = TextStyle { + font_size: 50.0, // Larger font size + color: Color::WHITE, + // font: asset_server.load("fonts/FiraSans-Bold.ttf"), // Load font if needed + ..default() + }; + + // TextStyle for the bottom text (smaller font) + let bottom_text_style = TextStyle { + font_size: 30.0, // Smaller font size + color: Color::WHITE, + // font: asset_server.load("fonts/FiraSans-Regular.ttf"), // Load font if needed + ..default() + }; + + // TextBundle for the top text + let top_text_node = TextBundle::from_section( + "Astraea", // Text for the top section + top_text_style, + ); + + // TextBundle for the bottom text + let bottom_text_node = TextBundle::from_section( + "Press Space to Begin", // Text for the bottom section + bottom_text_style, + ); + + // Spawn the text nodes and add them as children to the container + let top_text = commands.spawn((top_text_node, StartMenu)).id(); + let bottom_text = commands.spawn((bottom_text_node, StartMenu)).id(); + + commands.entity(container).push_children(&[top_text, bottom_text]); +} + + fn spawn_cons_lines( mut commands: Commands, mut meshes: ResMut>, @@ -124,7 +178,7 @@ fn spawn_cons_lines( ) { // Create a material for the line let line_material = materials.add(StandardMaterial { - emissive: LinearRgba::rgb(1.0, 0.5, 0.5), // Red color for the line + emissive: LinearRgba::rgb(0.5, 0.5, 1.0), // Red color for the line ..default() }); @@ -327,51 +381,63 @@ fn game_ui_setup(mut commands: Commands, _asset_server: Res) { } } -fn player_input( - keys: Res>, - mut player_query: Query<(&mut Player, &mut Transform)>, // Query to get Player and Transform - sky: Res, // Res to access the Sky resource +fn choose_constellation( + player: &mut Player, + sky: Res, // Res to access the Sky resource mut text_query: Query<&mut Text, With>, mut button_query: Query<(&mut BackgroundColor, &mut BorderColor), With