crying at ui stuff
This commit is contained in:
parent
9de729fb7f
commit
38ab92fa59
2 changed files with 59 additions and 26 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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<AssetServer>,
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
mut materials: ResMut<Assets<ColorMaterial>>,
|
||||
mut images: ResMut<Assets<Image>>,
|
||||
) {
|
||||
commands.spawn((
|
||||
// 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),
|
||||
));
|
||||
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),
|
||||
));
|
||||
))
|
||||
.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(),
|
||||
)]
|
||||
)],
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue