shape editing works now!(also moved to using Transform)

This commit is contained in:
RustyStriker 2022-07-28 11:33:02 +03:00
parent 01f7cfb6b7
commit f52c7b9057
4 changed files with 323 additions and 65 deletions

View file

@ -1,4 +1,5 @@
use bevy::ecs::schedule::ShouldRun;
use bevy::math::Vec3Swizzles;
use bevy::{prelude::*, window::PresentMode, winit::WinitSettings};
use bevy_egui::{egui, EguiContext, EguiPlugin};
use bevy_prototype_lyon::prelude::*;
@ -20,6 +21,7 @@ fn main() {
})
.insert_resource(ButtonsColors::default())
.insert_resource(UiState::default())
.insert_resource(PointSize(5.0))
;
app
@ -72,6 +74,11 @@ fn action_bar_sys(
if m.clicked() {
state.current_action = Action::Modify;
}
let r = hui.button(egui::RichText::new("R").color(state.current_action_color(&colors, Action::Rotate)))
.on_hover_text("Rotate");
if r.clicked() {
state.current_action = Action::Rotate;
}
let c = hui.button(egui::RichText::new("C").color(state.current_action_color(&colors, Action::Create)))
.on_hover_text("Create");
if c.clicked() {
@ -103,11 +110,6 @@ fn action_bar_sys(
if squ.clicked() {
state.create_shape = CreateShape::Square;
}
let sce = hui.button(egui::RichText::new("SqC").color(state.create_shape_color(&colors, CreateShape::SquareCenter)))
.on_hover_text("Square - from center point and edge");
if sce.clicked() {
state.create_shape = CreateShape::SquareCenter;
}
let cir = hui.button(egui::RichText::new("Cir").color(state.create_shape_color(&colors, CreateShape::Circle)))
.on_hover_text("Circle - center point and radius");
if cir.clicked() {
@ -123,19 +125,3 @@ fn action_bar_sys(
});
}
fn modify_sys(
mouse: Res<Input<MouseButton>>,
wnds: Res<Windows>,
q_cam: Query<(&Camera, &GlobalTransform), With<MainCamera>>,
mut paths: Query<&mut Path>,
mut transforms: Query<&mut Transform>,
shapes: Query<&ShapeData>,
) {
let mouse_pos = get_mouse_pos(&q_cam, &wnds);
if let Some(mouse_pos) = mouse_pos {
}
}