dear_imgui_rs/ui/debug_tools.rs
1use super::*;
2
3impl Ui {
4 /// Renders a demo window (previously called a test window), which demonstrates most
5 /// Dear ImGui features.
6 #[doc(alias = "ShowDemoWindow")]
7 pub fn show_demo_window(&self, opened: &mut bool) {
8 unsafe {
9 crate::sys::igShowDemoWindow(opened);
10 }
11 }
12
13 /// Renders an about window.
14 ///
15 /// Displays the Dear ImGui version/credits, and build/system information.
16 #[doc(alias = "ShowAboutWindow")]
17 pub fn show_about_window(&self, opened: &mut bool) {
18 unsafe {
19 crate::sys::igShowAboutWindow(opened);
20 }
21 }
22
23 /// Renders a metrics/debug window.
24 ///
25 /// Displays Dear ImGui internals: draw commands (with individual draw calls and vertices),
26 /// window list, basic internal state, etc.
27 #[doc(alias = "ShowMetricsWindow")]
28 pub fn show_metrics_window(&self, opened: &mut bool) {
29 unsafe {
30 crate::sys::igShowMetricsWindow(opened);
31 }
32 }
33
34 /// Renders a basic help/info block (not a window)
35 #[doc(alias = "ShowUserGuide")]
36 pub fn show_user_guide(&self) {
37 unsafe {
38 crate::sys::igShowUserGuide();
39 }
40 }
41
42 // ============================================================================
43 // Additional Demo, Debug, Information (non-duplicate methods)
44 // ============================================================================
45
46 /// Renders a debug log window.
47 ///
48 /// Displays a simplified log of important dear imgui events.
49 #[doc(alias = "ShowDebugLogWindow")]
50 pub fn show_debug_log_window(&self, opened: &mut bool) {
51 unsafe {
52 sys::igShowDebugLogWindow(opened);
53 }
54 }
55
56 /// Renders an ID stack tool window.
57 ///
58 /// Hover items with mouse to query information about the source of their unique ID.
59 #[doc(alias = "ShowIDStackToolWindow")]
60 pub fn show_id_stack_tool_window(&self, opened: &mut bool) {
61 unsafe {
62 sys::igShowIDStackToolWindow(opened);
63 }
64 }
65
66 /// Returns the Dear ImGui version string
67 #[doc(alias = "GetVersion")]
68 pub fn get_version(&self) -> &str {
69 unsafe {
70 let version_ptr = sys::igGetVersion();
71 if version_ptr.is_null() {
72 return "Unknown";
73 }
74 let c_str = std::ffi::CStr::from_ptr(version_ptr);
75 c_str.to_str().unwrap_or("Unknown")
76 }
77 }
78}