pub struct SoftwareBackend { /* private fields */ }Expand description
This struct contains statistics as well as possible interactions with the software renderer.
§Example
use egui_software_backend::{App, SoftwareBackend};
struct MyApp {
}
impl App for MyApp {
fn update(&mut self, ctx: &egui::Context, backend: &mut SoftwareBackend) {
backend.set_capture_frame_time(true);
egui::CentralPanel::default().show(ctx, |ui| {
ui.label(format!(
"Frame Time {}ms",
backend.last_frame_time().unwrap_or_default().as_millis()
));
});
}
}
Implementations§
Source§impl SoftwareBackend
impl SoftwareBackend
Sourcepub fn is_capture_frame_time(&self) -> bool
pub fn is_capture_frame_time(&self) -> bool
Returns true if the frame time for the next frame is captured.
Sourcepub fn set_capture_frame_time(&mut self, capture: bool)
pub fn set_capture_frame_time(&mut self, capture: bool)
Enables or disables capturing the frame time. Note that once this is called, the value persists until this function is called again. Calling this with true will not affect the current frame, so once this is called with true, you will need to wait for 2 more frames until you get a value.
Sourcepub fn last_frame_time(&self) -> Option<Duration>
pub fn last_frame_time(&self) -> Option<Duration>
Returns the rendering duration of the last frame if this information is available.
Returns none otherwise. Note that this information is only captured is set_capture_frame_time
is called with true.
Auto Trait Implementations§
impl Freeze for SoftwareBackend
impl RefUnwindSafe for SoftwareBackend
impl Send for SoftwareBackend
impl Sync for SoftwareBackend
impl Unpin for SoftwareBackend
impl UnsafeUnpin for SoftwareBackend
impl UnwindSafe for SoftwareBackend
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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.