Struct imgui::Context[][src]

pub struct Context { /* fields omitted */ }
Expand description

An imgui-rs context.

A context needs to be created to access most library functions. Due to current Dear ImGui design choices, at most one active Context can exist at any time. This limitation will likely be removed in a future Dear ImGui version.

If you need more than one context, you can use suspended contexts. As long as only one context is active at a time, it’s possible to have multiple independent contexts.

Examples

Creating a new active context:

let ctx = imgui::Context::create();
// ctx is dropped naturally when it goes out of scope, which deactivates and destroys the
// context

Never try to create an active context when another one is active:

let ctx1 = imgui::Context::create();

let ctx2 = imgui::Context::create(); // PANIC

Suspending an active context allows you to create another active context:

let ctx1 = imgui::Context::create();
let suspended1 = ctx1.suspend();
let ctx2 = imgui::Context::create(); // this is now OK

Implementations

Creates a new active imgui-rs context.

Panics

Panics if an active context already exists

Creates a new active imgui-rs context with a shared font atlas.

Panics

Panics if an active context already exists

Suspends this context so another context can be the active context.

Returns the path to the ini file, or None if not set

Sets the path to the ini file (default is “imgui.ini”)

Pass None to disable automatic .Ini saving.

Returns the path to the log file, or None if not set

Sets the log filename (default is “imgui_log.txt”).

Returns the backend platform name, or None if not set

Sets the backend platform name

Returns the backend renderer name, or None if not set

Sets the backend renderer name

Loads settings from a string slice containing settings in .Ini file format

Saves settings to a mutable string buffer in .Ini file format

Sets the clipboard backend used for clipboard operations

Returns an immutable reference to the inputs/outputs object

Returns a mutable reference to the inputs/outputs object

Returns an immutable reference to the user interface style

Returns a mutable reference to the user interface style

Returns a mutable reference to the font atlas.

Panics

Panics if the context uses a shared font atlas that is already borrowed

Starts a new frame and returns an Ui instance for constructing a user interface.

Panics

Panics if the context uses a shared font atlas that is already borrowed

Returns the global imgui-rs time.

Incremented by Io::delta_time every frame.

Returns the global imgui-rs frame count.

Incremented by 1 every frame.

Trait Implementations

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.