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;
|
pub struct PlayerVWBus;
|
||||||
|
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
#[require(Camera2d)]
|
|
||||||
struct MainCamera;
|
struct MainCamera;
|
||||||
|
|
||||||
pub fn setup_scene(
|
pub fn setup_scene(
|
||||||
|
|
@ -44,6 +43,7 @@ pub fn setup_scene(
|
||||||
|
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
MainCamera,
|
MainCamera,
|
||||||
|
Camera2d,
|
||||||
Camera {
|
Camera {
|
||||||
order: 1,
|
order: 1,
|
||||||
// clear_color: ClearColorConfig::None,
|
// clear_color: ClearColorConfig::None,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
use bevy::{
|
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::{
|
use crate::{
|
||||||
|
|
@ -31,7 +36,6 @@ impl Plugin for PausePlugin {
|
||||||
pub struct PauseMenuRoot;
|
pub struct PauseMenuRoot;
|
||||||
|
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
#[require(Camera2d)]
|
|
||||||
struct PauseCamera;
|
struct PauseCamera;
|
||||||
|
|
||||||
fn setup_pause(
|
fn setup_pause(
|
||||||
|
|
@ -39,40 +43,69 @@ fn setup_pause(
|
||||||
assets: Res<AssetServer>,
|
assets: Res<AssetServer>,
|
||||||
mut meshes: ResMut<Assets<Mesh>>,
|
mut meshes: ResMut<Assets<Mesh>>,
|
||||||
mut materials: ResMut<Assets<ColorMaterial>>,
|
mut materials: ResMut<Assets<ColorMaterial>>,
|
||||||
|
mut images: ResMut<Assets<Image>>,
|
||||||
) {
|
) {
|
||||||
commands.spawn((
|
// commands.spawn((
|
||||||
PauseCamera,
|
// Mesh2d(meshes.add(Triangle2d::new(
|
||||||
Camera {
|
// Vec2::new(-100., -100.),
|
||||||
order: 3,
|
// Vec2::new(-100., 100.),
|
||||||
clear_color: ClearColorConfig::None,
|
// Vec2::new(-100., 100.),
|
||||||
|
// ))),
|
||||||
|
// MeshMaterial2d(materials.add(Color::srgb(0.2, 0.2, 0.3))),
|
||||||
|
// RenderLayers::layer(3),
|
||||||
|
// ));
|
||||||
|
|
||||||
..default()
|
let cam = commands
|
||||||
},
|
.spawn((
|
||||||
// Bloom::NATURAL,
|
PauseCamera,
|
||||||
RenderLayers::layer(3),
|
Camera2d,
|
||||||
));
|
Camera {
|
||||||
commands.spawn((
|
order: 3,
|
||||||
Mesh2d(meshes.add(Triangle2d::new(
|
clear_color: ClearColorConfig::None,
|
||||||
Vec2::new(-100., -100.),
|
..default()
|
||||||
Vec2::new(-100., 100.),
|
},
|
||||||
Vec2::new(-100., 100.),
|
// Bloom::NATURAL,
|
||||||
))),
|
RenderLayers::layer(3),
|
||||||
MeshMaterial2d(materials.add(Color::srgb(0.2, 0.2, 0.3))),
|
))
|
||||||
RenderLayers::layer(3),
|
.id();
|
||||||
));
|
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
Node {
|
Node {
|
||||||
position_type: PositionType::Absolute,
|
position_type: PositionType::Relative,
|
||||||
width: percent(80),
|
width: px(200),
|
||||||
height: percent(80),
|
height: px(700),
|
||||||
align_items: AlignItems::Center,
|
align_items: AlignItems::Center,
|
||||||
justify_content: JustifyContent::Center,
|
justify_content: JustifyContent::Center,
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
UiTransform::from_translation(Val2::px(0., 0.)),
|
// UiTransform::from_translation(Val2::px(0., 0.)),
|
||||||
BackgroundColor(COLOR_BG),
|
BackgroundColor(COLOR_BG),
|
||||||
Visibility::Visible,
|
Visibility::Visible,
|
||||||
PauseMenuRoot,
|
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