Skip to main content

dear_implot3d/
demos.rs

1use crate::Plot3DUi;
2use crate::sys;
3
4impl Plot3DUi<'_> {
5    /// Show upstream ImPlot3D demos (from C++ demo).
6    ///
7    /// This displays all available ImPlot3D demos in a single window.
8    /// Useful for learning and testing the library.
9    pub fn show_all_demos(&self) {
10        self.with_bound_context(|| unsafe { sys::ImPlot3D_ShowAllDemos() })
11    }
12
13    /// Show the main ImPlot3D demo window (C++ upstream).
14    ///
15    /// This displays the main demo window with tabs for different plot types.
16    pub fn show_demo_window(&self) {
17        self.with_bound_context(|| unsafe { sys::ImPlot3D_ShowDemoWindow(std::ptr::null_mut()) })
18    }
19
20    /// Show the main ImPlot3D demo window with a visibility flag.
21    pub fn show_demo_window_with_flag(&self, p_open: &mut bool) {
22        self.with_bound_context(|| unsafe { sys::ImPlot3D_ShowDemoWindow(p_open as *mut bool) })
23    }
24
25    /// Show the ImPlot3D style editor window.
26    ///
27    /// This displays a window for editing ImPlot3D style settings in real time.
28    pub fn show_style_editor(&self) {
29        self.with_bound_context(|| unsafe { sys::ImPlot3D_ShowStyleEditor(std::ptr::null_mut()) })
30    }
31
32    /// Show the ImPlot3D metrics/debugger window.
33    ///
34    /// This displays performance metrics and debugging information.
35    pub fn show_metrics_window(&self) {
36        self.with_bound_context(|| unsafe { sys::ImPlot3D_ShowMetricsWindow(std::ptr::null_mut()) })
37    }
38
39    /// Show the ImPlot3D metrics/debugger window with a visibility flag.
40    pub fn show_metrics_window_with_flag(&self, p_open: &mut bool) {
41        self.with_bound_context(|| unsafe { sys::ImPlot3D_ShowMetricsWindow(p_open as *mut bool) })
42    }
43}