Skip to content

Commit a2bf749

Browse files
committed
big tool remove, idk if good
1 parent a0d424c commit a2bf749

File tree

2 files changed

+1
-168
lines changed

2 files changed

+1
-168
lines changed

src/ui/draw.rs

-167
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use bevy::prelude::*;
44
use bevy_pixel_buffer::bevy_egui::egui::{Color32, Frame, Margin, Vec2};
55
use bevy_pixel_buffer::bevy_egui::EguiContexts;
66
use bevy_pixel_buffer::prelude::*;
7-
use egui::ImageSource;
87
use egui_plot::{Line, Plot, PlotBounds, PlotPoints};
98

109
use crate::components::gizmo::GizmoComponent;
@@ -15,7 +14,6 @@ use crate::components::wall::{CircWall, RectWall};
1514
use crate::events::{LoadScene, LoadWav, New, Reset, Save, UpdateWalls};
1615
use crate::math::constants::*;
1716
use crate::render::gradient::Gradient;
18-
use crate::simulation::grid::Grid;
1917
use crate::ui::state::*;
2018
use crate::undo::UndoEvent;
2119

@@ -112,25 +110,15 @@ pub const CTRL_KEY_TEXT: &str = if cfg!(target_os = "macos") {
112110
"Ctrl"
113111
};
114112

115-
pub const IMAGES: [ImageSource; 4] = [
116-
egui::include_image!("../../assets/select.png"),
117-
egui::include_image!("../../assets/place.png"),
118-
egui::include_image!("../../assets/move.png"),
119-
egui::include_image!("../../assets/resize_wall.png"),
120-
];
121-
122113
pub fn draw_egui(
123-
mut commands: Commands,
124114
pixel_buffer: QueryPixelBuffer,
125115
mut egui_context: EguiContexts,
126116
mut ui_state: ResMut<UiState>,
127-
mut grid: ResMut<Grid>,
128117
gradient: ResMut<Gradient>,
129118
mut events: EventSystemParams,
130119
sets: QuerySystemParams,
131120
sim_time: Res<SimTime>,
132121
diagnostics: Res<DiagnosticsStore>,
133-
mut tool_settings_height: Local<f32>,
134122
) {
135123
let QuerySystemParams {
136124
mut rect_wall_set,
@@ -146,161 +134,6 @@ pub fn draw_egui(
146134
// ctx.set_zoom_factor(2.0);
147135
// println!("zoom factor: {}", ctx.zoom_factor());
148136

149-
// Tool Options
150-
// egui::TopBottomPanel::bottom("tool_options_panel").show(ctx, |ui| {
151-
// *tool_settings_height = ui.available_height();
152-
153-
// ui.add_space(3.);
154-
// ui.heading("Tool Options");
155-
// ui.separator();
156-
157-
// if ui_state.render_abc_area {
158-
// ui.disable();
159-
// }
160-
161-
// match ui_state.current_tool {
162-
// ToolType::Place(_) => {
163-
// egui::ComboBox::from_label("Select object to place")
164-
// .selected_text(format!("{}", ui_state.cur_place_type))
165-
// .show_ui(ui, |ui| {
166-
// ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Wrap);
167-
// ui.selectable_value(
168-
// &mut ui_state.cur_place_type,
169-
// PlaceType::Source,
170-
// "Source",
171-
// );
172-
// ui.selectable_value(
173-
// &mut ui_state.cur_place_type,
174-
// PlaceType::Mic,
175-
// "Microphone",
176-
// );
177-
// ui.selectable_value(
178-
// &mut ui_state.cur_place_type,
179-
// PlaceType::RectWall,
180-
// "Rectangular Wall",
181-
// );
182-
// ui.selectable_value(
183-
// &mut ui_state.cur_place_type,
184-
// PlaceType::CircWall,
185-
// "Circular Wall",
186-
// );
187-
// });
188-
189-
// if matches!(
190-
// ui_state.cur_place_type,
191-
// PlaceType::RectWall | PlaceType::CircWall
192-
// ) {
193-
// ui.add(
194-
// egui::Slider::new(&mut ui_state.wall_reflection_factor, 0.0..=1.0)
195-
// .text("Reflection factor"),
196-
// );
197-
// ui.checkbox(&mut ui_state.wall_is_hollow, "Hollow");
198-
// }
199-
// ui_state.current_tool = ToolType::Place(ui_state.cur_place_type);
200-
// }
201-
// _ => {
202-
// ui.add_space(10.);
203-
// ui.vertical_centered(|ui| ui.label("Select another tool to see its options"));
204-
// }
205-
// }
206-
207-
// ui.add_space(10.);
208-
// });
209-
210-
// Tool Panel
211-
egui::TopBottomPanel::bottom("tool_panel")
212-
.frame(
213-
Frame::default()
214-
.inner_margin(Margin {
215-
left: 8., //looks better
216-
right: 10.,
217-
top: 10.,
218-
bottom: 10.,
219-
})
220-
.fill(Color32::from_rgb(25, 25, 25)),
221-
)
222-
// .default_width(35.)
223-
.resizable(false)
224-
.show(ctx, |ui| {
225-
if !ui_state.tools_enabled {
226-
ui.disable();
227-
}
228-
229-
let select_icon = &IMAGES[0];
230-
let place_icon = &IMAGES[1];
231-
let move_icon = &IMAGES[2];
232-
//let resize_wall_icon = &IMAGES[3];
233-
234-
ui.horizontal(|ui| {
235-
ui.columns(3, |columns| {
236-
columns[0].vertical_centered(|ui| {
237-
if ui
238-
.add(
239-
egui::Button::image(
240-
egui::Image::new(select_icon.clone())
241-
.fit_to_exact_size(Vec2::new(50., 50.)),
242-
)
243-
.fill(if matches!(ui_state.current_tool, ToolType::Select) {
244-
Color32::DARK_GRAY
245-
} else {
246-
Color32::TRANSPARENT
247-
})
248-
.min_size(Vec2::new(150., 150.))
249-
.rounding(15.),
250-
)
251-
.on_hover_text(format!("{}", ToolType::Select))
252-
.clicked()
253-
{
254-
ui_state.current_tool = ToolType::Select;
255-
}
256-
});
257-
columns[1].vertical_centered(|ui| {
258-
if ui
259-
.add(
260-
egui::Button::image(
261-
// TODO: change image depending on cur_place_type??
262-
egui::Image::new(place_icon.clone())
263-
.fit_to_exact_size(Vec2::new(50., 50.)),
264-
)
265-
.fill(if matches!(ui_state.current_tool, ToolType::Place(..)) {
266-
Color32::DARK_GRAY
267-
} else {
268-
Color32::TRANSPARENT
269-
})
270-
.min_size(Vec2::new(150., 150.))
271-
.rounding(15.),
272-
)
273-
.on_hover_text(format!("{}", ToolType::Place(PlaceType::Source)))
274-
.clicked()
275-
{
276-
ui_state.current_tool = ToolType::Place(ui_state.cur_place_type);
277-
}
278-
});
279-
columns[2].vertical_centered(|ui| {
280-
if ui
281-
.add(
282-
egui::Button::image(
283-
egui::Image::new(move_icon.clone())
284-
.fit_to_exact_size(Vec2::new(50., 50.)),
285-
)
286-
.fill(if matches!(ui_state.current_tool, ToolType::Edit) {
287-
Color32::DARK_GRAY
288-
} else {
289-
Color32::TRANSPARENT
290-
})
291-
.min_size(Vec2::new(150., 150.))
292-
.rounding(15.),
293-
)
294-
.on_hover_text(format!("{}", ToolType::Edit))
295-
.clicked()
296-
{
297-
ui_state.current_tool = ToolType::Edit;
298-
}
299-
});
300-
});
301-
});
302-
});
303-
304137
// Quick Settings
305138
egui::TopBottomPanel::bottom("quick_settings_bottom_panel").show(ctx, |ui| {
306139
ui.add_space(12.);

src/ui/state.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl Default for UiState {
101101
boundary_width: 50,
102102
render_abc_area: false,
103103
image_rect: egui::Rect::NOTHING,
104-
current_tool: ToolType::Place(PlaceType::Source),
104+
current_tool: ToolType::Select,
105105
cur_place_type: PlaceType::Source,
106106
wall_reflection_factor: 1.,
107107
wall_is_hollow: false,

0 commit comments

Comments
 (0)