@@ -4,7 +4,6 @@ use bevy::prelude::*;
4
4
use bevy_pixel_buffer:: bevy_egui:: egui:: { Color32 , Frame , Margin , Vec2 } ;
5
5
use bevy_pixel_buffer:: bevy_egui:: EguiContexts ;
6
6
use bevy_pixel_buffer:: prelude:: * ;
7
- use egui:: ImageSource ;
8
7
use egui_plot:: { Line , Plot , PlotBounds , PlotPoints } ;
9
8
10
9
use crate :: components:: gizmo:: GizmoComponent ;
@@ -15,7 +14,6 @@ use crate::components::wall::{CircWall, RectWall};
15
14
use crate :: events:: { LoadScene , LoadWav , New , Reset , Save , UpdateWalls } ;
16
15
use crate :: math:: constants:: * ;
17
16
use crate :: render:: gradient:: Gradient ;
18
- use crate :: simulation:: grid:: Grid ;
19
17
use crate :: ui:: state:: * ;
20
18
use crate :: undo:: UndoEvent ;
21
19
@@ -112,25 +110,15 @@ pub const CTRL_KEY_TEXT: &str = if cfg!(target_os = "macos") {
112
110
"Ctrl"
113
111
} ;
114
112
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
-
122
113
pub fn draw_egui (
123
- mut commands : Commands ,
124
114
pixel_buffer : QueryPixelBuffer ,
125
115
mut egui_context : EguiContexts ,
126
116
mut ui_state : ResMut < UiState > ,
127
- mut grid : ResMut < Grid > ,
128
117
gradient : ResMut < Gradient > ,
129
118
mut events : EventSystemParams ,
130
119
sets : QuerySystemParams ,
131
120
sim_time : Res < SimTime > ,
132
121
diagnostics : Res < DiagnosticsStore > ,
133
- mut tool_settings_height : Local < f32 > ,
134
122
) {
135
123
let QuerySystemParams {
136
124
mut rect_wall_set,
@@ -146,161 +134,6 @@ pub fn draw_egui(
146
134
// ctx.set_zoom_factor(2.0);
147
135
// println!("zoom factor: {}", ctx.zoom_factor());
148
136
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
-
304
137
// Quick Settings
305
138
egui:: TopBottomPanel :: bottom ( "quick_settings_bottom_panel" ) . show ( ctx, |ui| {
306
139
ui. add_space ( 12. ) ;
0 commit comments