Skip to content

Commit

Permalink
Ability to fetch current frame. Ability to set global context.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nhlest committed Nov 23, 2023
1 parent 8b2722d commit 50703bf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions imgui/src/context.rs
Expand Up @@ -114,6 +114,12 @@ impl Context {
clear_current_context();
SuspendedContext(self)
}
/// Sets current global imgui context, i.e. in a dynamically linked library.
pub fn set_current_context(&self) {
unsafe {
sys::igSetCurrentContext(self.raw);
}
}
/// Returns the path to the ini file, or None if not set
pub fn ini_filename(&self) -> Option<PathBuf> {
let io = self.io();
Expand Down Expand Up @@ -538,6 +544,10 @@ impl Context {
self.new_frame()
}

pub fn current_frame(&mut self) -> &mut Ui {
&mut self.ui
}

/// Starts a new frame and returns an `Ui` instance for constructing a user interface.
#[doc(alias = "NewFame")]
pub fn new_frame(&mut self) -> &mut Ui {
Expand Down

0 comments on commit 50703bf

Please sign in to comment.