feat: editor paint undone
This commit is contained in:
parent
a3752a6496
commit
fb0e374f17
4 changed files with 144 additions and 13 deletions
|
|
@ -4,6 +4,7 @@ use bevy::prelude::*;
|
|||
|
||||
use crate::grid::{Grid, GridElement};
|
||||
use crate::simulation::SimulationStatus;
|
||||
use crate::view::editor::EditorTools;
|
||||
|
||||
pub struct UIPlugin;
|
||||
|
||||
|
|
@ -22,6 +23,9 @@ struct WaterLabel;
|
|||
#[derive(Component, Clone, Default)]
|
||||
struct SpeedLabel;
|
||||
|
||||
#[derive(Component, Clone, Default)]
|
||||
struct ToolLabel;
|
||||
|
||||
const MAX_FREQUENCY: u32 = 512;
|
||||
const MIN_FREQUENCY: u32 = 1;
|
||||
|
||||
|
|
@ -52,6 +56,7 @@ fn ui() -> impl Scene {
|
|||
}
|
||||
Children [
|
||||
debug_column()
|
||||
editor_column()
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -79,6 +84,42 @@ fn debug_column() -> impl Scene {
|
|||
}
|
||||
}
|
||||
|
||||
fn editor_column() -> impl Scene {
|
||||
bsn! {
|
||||
Node {
|
||||
display: Display::Flex,
|
||||
flex_direction: FlexDirection::Column,
|
||||
align_items: AlignItems::Stretch,
|
||||
justify_content: JustifyContent::Start,
|
||||
padding: px(8),
|
||||
row_gap: px(8),
|
||||
width: px(256),
|
||||
min_width: px(256),
|
||||
}
|
||||
pane()
|
||||
pane_header()
|
||||
pane_body()
|
||||
Children [
|
||||
label("Tools")
|
||||
ToolLabel,
|
||||
@FeathersButton {
|
||||
@caption: bsn!{label("None")}
|
||||
}
|
||||
on(|_activate: On<Activate>, mut tool: ResMut<EditorTools>, mut label: Single<&mut Text, With<ToolLabel>>| {
|
||||
*tool = EditorTools::None;
|
||||
label.0 = "Current tool: None".to_string();
|
||||
}),
|
||||
@FeathersButton {
|
||||
@caption: bsn!{label("Paint")}
|
||||
}
|
||||
on(|_activate: On<Activate>, mut tool: ResMut<EditorTools>, mut label: Single<&mut Text, With<ToolLabel>>| {
|
||||
*tool = EditorTools::Paint { position: UVec3::default(), block: GridElement::Solid };
|
||||
label.0 = "Current tool: Paint".to_string();
|
||||
}),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
fn water_amount_label() -> impl Scene {
|
||||
bsn! {
|
||||
Node {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue