tirbofish/dropbear
main / crates / eucalyptus-editor / src / debug.rs · 1901 bytes
crates/eucalyptus-editor/src/debug.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Used to aid with debugging any issues with the editor.
mod window;
use crate::debug::window::DebugWindow;
use crate::editor::Signal;
use dropbear_engine::DropbearWindowBuilder;
use egui::Ui;
use parking_lot::RwLock;
use std::collections::VecDeque;
use std::rc::Rc;
use winit::window::WindowAttributes;
pub(crate) fn show_menu_bar(ui: &mut Ui, signal: &mut VecDeque<Signal>) {
ui.menu_button("Debug", |ui_debug| {
if ui_debug.button("Panic").clicked() {
log::warn!("Panic caused on purpose from Menu Button Click");
panic!("Testing out panicking with new panic module, this is a test")
}
if ui_debug.button("size_of::<Editor>()").clicked() {
log::debug!("size_of::<Editor>() is clicked");
let size = size_of::<crate::editor::Editor>();
log::info!("size_of::<Editor>() is {}", size);
log::debug!("I'm so fat - editor")
}
if ui_debug.button("Launch new debug test window").clicked() {
let debug_window = Rc::new(RwLock::new(DebugWindow::new()));
let window_data = DropbearWindowBuilder::new()
.with_attributes(
WindowAttributes::default().with_title("eucalyptus-editor debug window"),
)
.add_scene_with_input(debug_window, "debug_window")
.set_initial_scene("debug_window")
.build();
signal.push_back(Signal::RequestNewWindow(window_data));
}
if ui_debug.button("Show TypeID of components").clicked() {
if crate::features::is_enabled(crate::features::ShowComponentTypeIDInEditor) {
crate::features::disable(crate::features::ShowComponentTypeIDInEditor);
} else {
crate::features::enable(crate::features::ShowComponentTypeIDInEditor);
}
}
});
}