diff --git a/src/gameplay/navi.rs b/src/gameplay/navi.rs index 93ccb24..cb57c84 100644 --- a/src/gameplay/navi.rs +++ b/src/gameplay/navi.rs @@ -29,7 +29,6 @@ impl Plugin for NaviGameplayPlugin { pub struct PlayerVWBus; #[derive(Component)] -#[require(Camera2d)] struct MainCamera; pub fn setup_scene( @@ -44,6 +43,7 @@ pub fn setup_scene( commands.spawn(( MainCamera, + Camera2d, Camera { order: 1, // clear_color: ClearColorConfig::None, diff --git a/src/gameplay/pause.rs b/src/gameplay/pause.rs index 774dc2b..1fb5aa0 100644 --- a/src/gameplay/pause.rs +++ b/src/gameplay/pause.rs @@ -1,5 +1,10 @@ use bevy::{ - camera::visibility::RenderLayers, post_process::bloom::Bloom, prelude::*, sprite::Anchor, + asset::RenderAssetUsages, + camera::visibility::RenderLayers, + post_process::bloom::Bloom, + prelude::*, + render::render_resource::{Extent3d, TextureDimension, TextureFormat}, + sprite::Anchor, }; use crate::{ @@ -31,7 +36,6 @@ impl Plugin for PausePlugin { pub struct PauseMenuRoot; #[derive(Component)] -#[require(Camera2d)] struct PauseCamera; fn setup_pause( @@ -39,40 +43,69 @@ fn setup_pause( assets: Res, mut meshes: ResMut>, mut materials: ResMut>, + mut images: ResMut>, ) { - commands.spawn(( - PauseCamera, - Camera { - order: 3, - clear_color: ClearColorConfig::None, + // commands.spawn(( + // Mesh2d(meshes.add(Triangle2d::new( + // Vec2::new(-100., -100.), + // Vec2::new(-100., 100.), + // Vec2::new(-100., 100.), + // ))), + // MeshMaterial2d(materials.add(Color::srgb(0.2, 0.2, 0.3))), + // RenderLayers::layer(3), + // )); - ..default() - }, - // Bloom::NATURAL, - RenderLayers::layer(3), - )); - commands.spawn(( - Mesh2d(meshes.add(Triangle2d::new( - Vec2::new(-100., -100.), - Vec2::new(-100., 100.), - Vec2::new(-100., 100.), - ))), - MeshMaterial2d(materials.add(Color::srgb(0.2, 0.2, 0.3))), - RenderLayers::layer(3), - )); + let cam = commands + .spawn(( + PauseCamera, + Camera2d, + Camera { + order: 3, + clear_color: ClearColorConfig::None, + ..default() + }, + // Bloom::NATURAL, + RenderLayers::layer(3), + )) + .id(); commands.spawn(( Node { - position_type: PositionType::Absolute, - width: percent(80), - height: percent(80), + position_type: PositionType::Relative, + width: px(200), + height: px(700), align_items: AlignItems::Center, justify_content: JustifyContent::Center, ..default() }, - UiTransform::from_translation(Val2::px(0., 0.)), + // UiTransform::from_translation(Val2::px(0., 0.)), BackgroundColor(COLOR_BG), Visibility::Visible, PauseMenuRoot, + children![( + Button, + Node { + width: px(150), + height: px(65), + border: UiRect::all(px(5)), + justify_content: JustifyContent::Center, + align_items: AlignItems::Center, + position_type: PositionType::Relative, + ..default() + }, + BorderColor::all(Color::WHITE), + BorderRadius::MAX, + BackgroundColor(COLOR_HL1), + children![( + Text::new("Button"), + TextFont { + font: assets.load("fonts/GloriaHalleluja.ttf"), + font_size: 33.0, + ..default() + }, + TextColor(Color::srgb(0.9, 0.9, 0.9)), + TextShadow::default(), + )] + )], )); }