misc
This commit is contained in:
@@ -2,9 +2,7 @@ use bevy::core_pipeline::experimental::taa::{TemporalAntiAliasBundle, TemporalAn
|
|||||||
use bevy::core_pipeline::prepass::DepthPrepass;
|
use bevy::core_pipeline::prepass::DepthPrepass;
|
||||||
use bevy::input::mouse::{MouseMotion, MouseScrollUnit, MouseWheel};
|
use bevy::input::mouse::{MouseMotion, MouseScrollUnit, MouseWheel};
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy::render::view::RenderLayers;
|
|
||||||
use bevy::window::{CursorGrabMode, PrimaryWindow};
|
use bevy::window::{CursorGrabMode, PrimaryWindow};
|
||||||
use bevy_lunex::prelude::MainUi;
|
|
||||||
use shared::sets::GameplaySet;
|
use shared::sets::GameplaySet;
|
||||||
use shared::tags::MainCamera;
|
use shared::tags::MainCamera;
|
||||||
use world_generation::hex_utils::HexCoord;
|
use world_generation::hex_utils::HexCoord;
|
||||||
@@ -22,13 +20,9 @@ impl Plugin for PhosCameraPlugin {
|
|||||||
|
|
||||||
app.add_systems(PreStartup, setup);
|
app.add_systems(PreStartup, setup);
|
||||||
|
|
||||||
// app.add_systems(Update, rts_camera_system.in_set(GameplaySet));
|
|
||||||
// app.add_systems(PostUpdate, limit_camera_bounds.in_set(GameplaySet));
|
|
||||||
app.add_systems(Update, orbit_camera_upate.in_set(GameplaySet));
|
app.add_systems(Update, orbit_camera_upate.in_set(GameplaySet));
|
||||||
|
|
||||||
app.add_systems(Update, init_bounds.run_if(in_state(GeneratorState::SpawnMap)));
|
app.add_systems(Update, init_bounds.run_if(in_state(GeneratorState::SpawnMap)));
|
||||||
//Free Cam
|
|
||||||
//app.add_systems(Update, (grab_mouse, (update_camera, update_camera_mouse).chain()));
|
|
||||||
|
|
||||||
app.add_plugins(TemporalAntiAliasPlugin);
|
app.add_plugins(TemporalAntiAliasPlugin);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use bevy::{prelude::*, sprite::Anchor};
|
use bevy::{prelude::*, render::view::RenderLayers, sprite::Anchor};
|
||||||
use bevy_lunex::prelude::*;
|
use bevy_lunex::prelude::*;
|
||||||
|
|
||||||
pub struct BuildUiPlugin;
|
pub struct BuildUiPlugin;
|
||||||
@@ -18,6 +18,7 @@ fn setup_ui(mut commands: Commands, assets: Res<AssetServer>, mut material: ResM
|
|||||||
},
|
},
|
||||||
Name::new("Build UI"),
|
Name::new("Build UI"),
|
||||||
SourceFromCamera,
|
SourceFromCamera,
|
||||||
|
RenderLayers::layer(1),
|
||||||
))
|
))
|
||||||
.with_children(|ui| {
|
.with_children(|ui| {
|
||||||
ui.spawn((
|
ui.spawn((
|
||||||
@@ -26,6 +27,7 @@ fn setup_ui(mut commands: Commands, assets: Res<AssetServer>, mut material: ResM
|
|||||||
.pos1((Rl(0.), Rl(0.)))
|
.pos1((Rl(0.), Rl(0.)))
|
||||||
.pos2((Rl(100.), Rl(100.)))
|
.pos2((Rl(100.), Rl(100.)))
|
||||||
.pack::<Base>(),
|
.pack::<Base>(),
|
||||||
|
RenderLayers::layer(1),
|
||||||
));
|
));
|
||||||
|
|
||||||
ui.spawn((
|
ui.spawn((
|
||||||
@@ -35,6 +37,7 @@ fn setup_ui(mut commands: Commands, assets: Res<AssetServer>, mut material: ResM
|
|||||||
.size((Ab(800.), Rl(100.)))
|
.size((Ab(800.), Rl(100.)))
|
||||||
.pos((Rl(50.), Rl(100.)))
|
.pos((Rl(50.), Rl(100.)))
|
||||||
.pack::<Base>(),
|
.pack::<Base>(),
|
||||||
|
RenderLayers::layer(1),
|
||||||
));
|
));
|
||||||
|
|
||||||
ui.spawn((
|
ui.spawn((
|
||||||
@@ -43,21 +46,29 @@ fn setup_ui(mut commands: Commands, assets: Res<AssetServer>, mut material: ResM
|
|||||||
.align_y(Align::END)
|
.align_y(Align::END)
|
||||||
.size((Rl(100.), Ab(30.)))
|
.size((Rl(100.), Ab(30.)))
|
||||||
.pack::<Base>(),
|
.pack::<Base>(),
|
||||||
|
RenderLayers::layer(1),
|
||||||
));
|
));
|
||||||
|
|
||||||
for i in 1..5 {
|
for i in 0..5 {
|
||||||
let path = format!("Root/MainRect/Categories/Button{}", i);
|
let path = format!("Root/MainRect/Categories/Button{}", i);
|
||||||
ui.spawn((
|
ui.spawn((
|
||||||
UiLink::<MainUi>::path(path),
|
UiLink::<MainUi>::path(path),
|
||||||
UiLayout::div()
|
UiLayout::window()
|
||||||
.margin_x(Ab(5.))
|
.size((Rl(100. / 5.), Ab(30.)))
|
||||||
.height(Sizing::Max)
|
.x(Rl((100. / 5.) * i as f32))
|
||||||
.min_height(Ab(30.))
|
|
||||||
.min_width(Sp(10.))
|
|
||||||
.max_width(Sp(100.))
|
|
||||||
.pack::<Base>(),
|
.pack::<Base>(),
|
||||||
|
UiLayout::window()
|
||||||
|
.size((Rl(100. / 5.), Ab(20.)))
|
||||||
|
.x(Rl((100. / 5.) * i as f32))
|
||||||
|
.pack::<Hover>(),
|
||||||
UiImage2dBundle::from(assets.load("textures/world/test2.png")),
|
UiImage2dBundle::from(assets.load("textures/world/test2.png")),
|
||||||
|
RenderLayers::layer(1),
|
||||||
));
|
));
|
||||||
|
// ui.spawn((
|
||||||
|
// UiLink::<MainUi>::path(format!("{}/img", path)),
|
||||||
|
// UiLayout::solid().size((Ab(30.), Ab(100.))).pack::<Base>(),
|
||||||
|
// UiImage2dBundle::from(assets.load("textures/world/test2.png")),
|
||||||
|
// ));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
use bevy::{
|
use bevy::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
render::render_resource::{Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages},
|
render::{
|
||||||
|
render_resource::{Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages},
|
||||||
|
view::RenderLayers,
|
||||||
|
},
|
||||||
window::PrimaryWindow,
|
window::PrimaryWindow,
|
||||||
};
|
};
|
||||||
use bevy_lunex::prelude::*;
|
use bevy_lunex::prelude::*;
|
||||||
@@ -21,7 +24,7 @@ impl Plugin for LunexSetupPlugin {
|
|||||||
fn setup_cameras(
|
fn setup_cameras(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
assets: Res<AssetServer>,
|
assets: Res<AssetServer>,
|
||||||
mut camera_query: Query<&mut Camera, With<MainCamera>>,
|
mut main_3d_camera_q: Query<&mut Camera, With<MainCamera>>,
|
||||||
window_query: Query<&Window, With<PrimaryWindow>>,
|
window_query: Query<&Window, With<PrimaryWindow>>,
|
||||||
) {
|
) {
|
||||||
//Prepare Render Texture
|
//Prepare Render Texture
|
||||||
@@ -48,7 +51,7 @@ fn setup_cameras(
|
|||||||
image.resize(size);
|
image.resize(size);
|
||||||
|
|
||||||
//Configure 3D Camera
|
//Configure 3D Camera
|
||||||
let mut cam = camera_query.single_mut();
|
let mut cam = main_3d_camera_q.single_mut();
|
||||||
let render_image = assets.add(image);
|
let render_image = assets.add(image);
|
||||||
cam.target = render_image.clone().into();
|
cam.target = render_image.clone().into();
|
||||||
cam.order = -1;
|
cam.order = -1;
|
||||||
@@ -56,20 +59,26 @@ fn setup_cameras(
|
|||||||
|
|
||||||
//Add Render Texture image
|
//Add Render Texture image
|
||||||
commands
|
commands
|
||||||
.spawn((UiTreeBundle::<MainUi>::from(UiTree::new2d("Main UI")), SourceFromCamera))
|
.spawn((
|
||||||
|
UiTreeBundle::<MainUi>::from(UiTree::new2d("Main UI")),
|
||||||
|
SourceFromCamera,
|
||||||
|
RenderLayers::layer(1),
|
||||||
|
))
|
||||||
.with_children(|ui| {
|
.with_children(|ui| {
|
||||||
ui.spawn((
|
ui.spawn((
|
||||||
UiLink::<MainUi>::path("Root"),
|
UiLink::<MainUi>::path("Root"),
|
||||||
UiLayout::window_full().size((win.width(), win.height())).pack::<Base>(),
|
UiLayout::window_full().size((Rl(100.), Rl(100.))).pack::<Base>(),
|
||||||
|
RenderLayers::layer(1),
|
||||||
));
|
));
|
||||||
ui.spawn((
|
ui.spawn((
|
||||||
UiLink::<MainUi>::path("Root/Camera3D"),
|
UiLink::<MainUi>::path("Root/Camera3D"),
|
||||||
UiLayout::solid()
|
UiLayout::solid()
|
||||||
.size((win.width(), win.height()))
|
.size((Rl(100.), Rl(100.)))
|
||||||
.scaling(Scaling::Fill)
|
.scaling(Scaling::Fill)
|
||||||
.pack::<Base>(),
|
.pack::<Base>(),
|
||||||
UiImage2dBundle::from(render_image),
|
UiImage2dBundle::from(render_image),
|
||||||
PickingPortal,
|
PickingPortal,
|
||||||
|
RenderLayers::layer(1),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -80,5 +89,6 @@ fn setup_cameras(
|
|||||||
transform: Transform::from_xyz(0.0, 0.0, 1000.0),
|
transform: Transform::from_xyz(0.0, 0.0, 1000.0),
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
|
RenderLayers::from_layers(&[1]),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ impl Plugin for DebugPlugin {
|
|||||||
.run_if(in_state(DebugState::Verbose)),
|
.run_if(in_state(DebugState::Verbose)),
|
||||||
);
|
);
|
||||||
|
|
||||||
app.add_systems(Update, camera_debug.in_set(GameplaySet));
|
// app.add_systems(Update, camera_debug.in_set(GameplaySet));
|
||||||
app.add_systems(Update, regenerate_map.run_if(in_state(GeneratorState::Idle)));
|
app.add_systems(Update, regenerate_map.run_if(in_state(GeneratorState::Idle)));
|
||||||
|
|
||||||
app.insert_resource(Shape(Polyline3d::new([
|
app.insert_resource(Shape(Polyline3d::new([
|
||||||
|
|||||||
Reference in New Issue
Block a user