Skip to main content

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::ContextBinding;
26use crate::context::SharedTextureRegistry;
27use crate::draw::DrawListMut;
28use crate::input::MouseCursor;
29use crate::internal::RawWrapper;
30use crate::string::UiBuffer;
31use crate::sys;
32use crate::texture::TextureRef;
33use std::cell::UnsafeCell;
34
35/// Represents the Dear ImGui user interface for one frame
36#[derive(Debug)]
37pub struct Ui {
38    /// Dear ImGui context that owns this per-frame UI entry point.
39    pub(crate) ctx: *mut sys::ImGuiContext,
40    pub(crate) ctx_binding: ContextBinding,
41    pub(crate) texture_registry: SharedTextureRegistry,
42    /// Internal buffer for string operations
43    buffer: UnsafeCell<UiBuffer>,
44}