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        let _guard = self.bind();
11        unsafe { sys::ImPlot3D_ShowAllDemos() }
12    }
13
14    /// Show the main ImPlot3D demo window (C++ upstream).
15    ///
16    /// This displays the main demo window with tabs for different plot types.
17    pub fn show_demo_window(&self) {
18        let _guard = self.bind();
19        unsafe { sys::ImPlot3D_ShowDemoWindow(std::ptr::null_mut()) }
20    }
21
22    /// Show the main ImPlot3D demo window with a visibility flag.
23    pub fn show_demo_window_with_flag(&self, p_open: &mut bool) {
24        let _guard = self.bind();
25        unsafe { sys::ImPlot3D_ShowDemoWindow(p_open as *mut bool) }
26    }
27
28    /// Show the ImPlot3D style editor window.
29    ///
30    /// This displays a window for editing ImPlot3D style settings in real time.
31    pub fn show_style_editor(&self) {
32        let _guard = self.bind();
33        unsafe { sys::ImPlot3D_ShowStyleEditor(std::ptr::null_mut()) }
34    }
35
36    /// Show the ImPlot3D metrics/debugger window.
37    ///
38    /// This displays performance metrics and debugging information.
39    pub fn show_metrics_window(&self) {
40        let _guard = self.bind();
41        unsafe { sys::ImPlot3D_ShowMetricsWindow(std::ptr::null_mut()) }
42    }
43
44    /// Show the ImPlot3D metrics/debugger window with a visibility flag.
45    pub fn show_metrics_window_with_flag(&self, p_open: &mut bool) {
46        let _guard = self.bind();
47        unsafe { sys::ImPlot3D_ShowMetricsWindow(p_open as *mut bool) }
48    }
49}