diff --git a/assets/font/pypx-B.ttf b/assets/font/pypx-B.ttf index 8e2f579..08a260e 100644 Binary files a/assets/font/pypx-B.ttf and b/assets/font/pypx-B.ttf differ diff --git a/assets/font/pypx-T.ttf b/assets/font/pypx-T.ttf index 8eb67a7..e43646f 100644 Binary files a/assets/font/pypx-T.ttf and b/assets/font/pypx-T.ttf differ diff --git a/assets/font/pypx.ttf b/assets/font/pypx.ttf index cb0d071..a2cd90b 100644 Binary files a/assets/font/pypx.ttf and b/assets/font/pypx.ttf differ diff --git a/src/state/editor_screen/code_panel.rs b/src/state/editor_screen/code_panel.rs index f9373ff..d2ff671 100644 --- a/src/state/editor_screen/code_panel.rs +++ b/src/state/editor_screen/code_panel.rs @@ -25,6 +25,7 @@ pub fn spawn_light_code_panel( NodeBundle { style: Style { width: Percent(100.0), + height: Val::ZERO, min_height: config.code_panel_height, padding: UiRect::all(VMin(2.0)), ..default() diff --git a/src/state/editor_screen/info_bar.rs b/src/state/editor_screen/info_bar.rs index b5abb89..b66b7b6 100644 --- a/src/state/editor_screen/info_bar.rs +++ b/src/state/editor_screen/info_bar.rs @@ -29,6 +29,7 @@ pub fn spawn_info_bar( NodeBundle { style: Style { width: Percent(100.0), + height: Val::ZERO, min_height: config.info_bar_height, padding: UiRect::horizontal(Px(16.0)), align_items: AlignItems::Center, diff --git a/src/state/editor_screen/outline_panel.rs b/src/state/editor_screen/outline_panel.rs index 6c3308f..7e1c78f 100644 --- a/src/state/editor_screen/outline_panel.rs +++ b/src/state/editor_screen/outline_panel.rs @@ -45,7 +45,6 @@ impl Plugin for OutlinePanelPlugin { #[reflect(Resource)] pub struct UpgradeOutline(pub HashMap); -// TODO: Add scrollbar pub fn spawn_outline_panel( commands: &mut Commands, config: &EditorScreenConfig, @@ -56,6 +55,7 @@ pub fn spawn_outline_panel( Name::new("OutlinePanel"), NodeBundle { style: Style { + width: Val::ZERO, min_width: config.outline_panel_width, height: Percent(100.0), padding: UiRect::new(Px(12.0), Px(8.0), Px(12.0), Px(12.0)), diff --git a/src/state/editor_screen/upgrade_panel.rs b/src/state/editor_screen/upgrade_panel.rs index ea4e9f0..2781d74 100644 --- a/src/state/editor_screen/upgrade_panel.rs +++ b/src/state/editor_screen/upgrade_panel.rs @@ -57,6 +57,7 @@ pub fn spawn_upgrade_panel( Name::new("UpgradePanel"), NodeBundle { style: Style { + width: Val::ZERO, min_width: config.upgrade_panel_width, height: Percent(100.0), align_items: AlignItems::Center, @@ -95,6 +96,7 @@ pub fn spawn_upgrade_panel( NodeBundle { style: Style { width: Percent(100.0), + align_items: AlignItems::Center, flex_direction: FlexDirection::Column, flex_grow: 1.0, ..default() @@ -248,29 +250,23 @@ fn spawn_separator( commands: &mut Commands, config: &EditorScreenConfig, theme: &EditorScreenTheme, - parent: Entity, -) { +) -> Entity { commands .spawn(( Name::new("Separator"), NodeBundle { style: Style { + width: Percent(100.0), max_height: Px(0.0), border: UiRect::top(config.separator_width), - margin: UiRect { - left: Px(0.0), - right: Px(0.0), - // 16 vertical margin, compensates for buttons - top: Px(6.0), - bottom: Px(16.0), - }, + margin: UiRect::vertical(Px(16.0)), ..default() }, border_color: theme.separator_color.into(), ..default() }, )) - .set_parent(parent); + .id() } fn spawn_submit_button(commands: &mut Commands, config: &EditorScreenConfig) -> Entity { @@ -348,7 +344,7 @@ fn offer_next_upgrades( ) { let config = &config.editor_screen; let theme = &theme.0; - for (entity, buttons) in &container_query { + for (container, buttons) in &container_query { // Despawn old upgrade options for &button in buttons.into_iter().flatten() { despawn.recursive(button); @@ -359,7 +355,8 @@ fn offer_next_upgrades( for kind in next_upgrades { if kind == UpgradeKind::RefreshUpgradeList { // Add a separator. - spawn_separator(&mut commands, config, theme, entity); + let separator = spawn_separator(&mut commands, config, theme); + commands.entity(separator).set_parent(container); } let upgrade_button = spawn_upgrade_button( &mut commands, @@ -369,29 +366,29 @@ fn offer_next_upgrades( kind, &simulation, ); - commands.entity(upgrade_button).set_parent(entity); + commands.entity(upgrade_button).set_parent(container); } // Show description if present. if !desc.is_empty() { - spawn_separator(&mut commands, config, theme, entity); - let mut text_bundle = TextBundle::from_section( - desc, - TextStyle { - font: FONT_HANDLE, - color: theme.outline_panel_text_color, - ..default() - }, - ); - // Panel width - horizontal padding - text_bundle.style.max_width = Px(280.0 - 24.0); + let separator = spawn_separator(&mut commands, config, theme); + commands.entity(separator).set_parent(container); + commands .spawn(( Name::new("Description"), - text_bundle, + TextBundle::from_section( + desc, + TextStyle { + font: FONT_HANDLE, + color: theme.outline_panel_text_color, + ..default() + }, + ) + .with_text_alignment(TextAlignment::Center), FontSize::new(config.outline_panel_font_size), )) - .set_parent(entity); + .set_parent(container); } } } diff --git a/src/upgrade.rs b/src/upgrade.rs index f2996b5..829d7f2 100644 --- a/src/upgrade.rs +++ b/src/upgrade.rs @@ -334,7 +334,7 @@ fn load_upgrade_sequence(mut commands: Commands) { ), ( vec![TouchOfLifePlugin], - "\"I don't know what I'm making, but I should start spawning entities.\"".to_string(), + "\"I don't know what I'm making, but I should start by spawning some entities.\"".to_string(), ), // Reward