pub struct MainWindowWithRenderer { /* private fields */ }
Expand description
This is a MainWindow
plus a Renderer
. It is the ultimate easy-imgui
object.
Instead of a literal MainWindow
you can use any type that implements MainWindowRef
.
Implementations§
Source§impl MainWindowWithRenderer
impl MainWindowWithRenderer
Sourcepub fn new(main_window: MainWindow) -> Self
pub fn new(main_window: MainWindow) -> Self
Creates a new Renderer
and attaches it to the given window.
Sourcepub fn with_builder(main_window: MainWindow, builder: &ContextBuilder) -> Self
pub fn with_builder(main_window: MainWindow, builder: &ContextBuilder) -> Self
Creates a new Renderer
and attaches it to the given window.
The builder
argument can be used to modify the inner ImGui context.
Sourcepub fn set_idle_time(&mut self, time: Duration)
pub fn set_idle_time(&mut self, time: Duration)
Sets the time after which the UI will stop rendering, if there is no user input.
Sourcepub fn set_idle_frame_count(&mut self, frame_count: u32)
pub fn set_idle_frame_count(&mut self, frame_count: u32)
Sets the frame count after which the UI will stop rendering, if there is no user input.
Note that by default V-Sync is enabled, and that will affect the frame rate.
Sourcepub fn ping_user_input(&mut self)
pub fn ping_user_input(&mut self)
Forces a rebuild of the UI.
By default the window will stop rendering the UI after a while without user input. Use this function to force a redraw because of some external factor.
Sourcepub fn imgui(&mut self) -> &mut Context
pub fn imgui(&mut self) -> &mut Context
Gets a reference to the ImGui context by the renderer.
Just like self.renderer().imgui()
Sourcepub fn main_window(&mut self) -> &mut MainWindow
pub fn main_window(&mut self) -> &mut MainWindow
Gets a reference to the inner window.
Sourcepub fn new_with_renderer(main_window: MainWindow, renderer: Renderer) -> Self
pub fn new_with_renderer(main_window: MainWindow, renderer: Renderer) -> Self
Attaches the given window and renderer together.
Sourcepub fn window_event(
&mut self,
app: &mut impl UiBuilder,
event: &WindowEvent,
flags: EventFlags,
) -> EventResult
pub fn window_event( &mut self, app: &mut impl UiBuilder, event: &WindowEvent, flags: EventFlags, ) -> EventResult
The main event function. Corresponds to winit’s ApplicationHandler::window_event
.
It returns EventResult
. You can use it to break the main loop, or ignore it, as you see fit.
It also informs of whether ImGui want the monopoly of the user input.
Sourcepub fn new_events(&mut self)
pub fn new_events(&mut self)
Corresponds to winit’s ApplicationHandler::new_events
.
Sourcepub fn about_to_wait(&mut self)
pub fn about_to_wait(&mut self)
Corresponds to winit’s ApplicationHandler::about_to_wait
.
Auto Trait Implementations§
impl Freeze for MainWindowWithRenderer
impl !RefUnwindSafe for MainWindowWithRenderer
impl !Send for MainWindowWithRenderer
impl !Sync for MainWindowWithRenderer
impl Unpin for MainWindowWithRenderer
impl !UnwindSafe for MainWindowWithRenderer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.