dear_imgui_rs/ui.rs
1//! Per-frame UI entry point
2//!
3//! The `Ui` type exposes most user-facing Dear ImGui APIs for a single frame:
4//! creating windows, drawing widgets, accessing draw lists, showing built-in
5//! tools and more. Obtain it from [`Context::frame`].
6//!
7//! Example:
8//! ```no_run
9//! # use dear_imgui_rs::*;
10//! let mut ctx = Context::create();
11//! let ui = ctx.frame();
12//! ui.text("Hello, world!");
13//! ```
14//!
15mod core;
16mod debug_tools;
17mod draw;
18mod navigation;
19mod style;
20mod viewport;
21mod widgets;
22mod window;
23
24use crate::Id;
25use crate::context::ContextAliveToken;
26use crate::draw::DrawListMut;
27use crate::input::MouseCursor;
28use crate::internal::RawWrapper;
29use crate::string::UiBuffer;
30use crate::sys;
31use crate::texture::TextureRef;
32use std::cell::UnsafeCell;
33
34/// Represents the Dear ImGui user interface for one frame
35#[derive(Debug)]
36pub struct Ui {
37 /// Dear ImGui context that owns this per-frame UI entry point.
38 pub(crate) ctx: *mut sys::ImGuiContext,
39 pub(crate) ctx_alive: ContextAliveToken,
40 /// Internal buffer for string operations
41 buffer: UnsafeCell<UiBuffer>,
42}