pub struct Frame { /* private fields */ }
Expand description
Represents the surroundings of your app.
It provides methods to inspect the surroundings (are we on the web?), allocate textures, and change settings (e.g. window size).
Implementations
sourceimpl Frame
impl Frame
sourcepub fn is_web(&self) -> bool
pub fn is_web(&self) -> bool
True if you are in a web environment.
Equivalent to cfg!(target_arch = "wasm32")
sourcepub fn info(&self) -> IntegrationInfo
pub fn info(&self) -> IntegrationInfo
Information about the integration.
sourcepub fn storage(&self) -> Option<&dyn Storage>
pub fn storage(&self) -> Option<&dyn Storage>
A place where you can store custom data in a way that persists when you restart the app.
sourcepub fn storage_mut(&mut self) -> Option<&mut (dyn Storage + 'static)>
pub fn storage_mut(&mut self) -> Option<&mut (dyn Storage + 'static)>
A place where you can store custom data in a way that persists when you restart the app.
sourcepub fn gl(&self) -> Option<&Arc<Context>>
pub fn gl(&self) -> Option<&Arc<Context>>
A reference to the underlying glow
(OpenGL) context.
This can be used, for instance, to:
- Render things to offscreen buffers.
- Read the pixel buffer from the previous frame (
glow::Context::read_pixels
). - Render things behind the egui windows.
Note that all egui painting is deferred to after the call to App::update
(egui
only collects [egui::Shape
]s and then eframe paints them all in one go later on).
To get a glow
context you need to compile with the glow
feature flag,
and run eframe using Renderer::Glow
.
sourcepub fn wgpu_render_state(&self) -> Option<&RenderState>
pub fn wgpu_render_state(&self) -> Option<&RenderState>
The underlying WGPU render state.
Only available when compiling with the wgpu
feature and using Renderer::Wgpu
.
Can be used to manage GPU resources for custom rendering with WGPU using [egui::PaintCallback
]s.
sourcepub fn close(&mut self)
pub fn close(&mut self)
Tell eframe
to close the desktop window.
The window will not close immediately, but at the end of the this frame.
Calling this will likely result in the app quitting, unless
you have more code after the call to crate::run_native
.
sourcepub fn set_window_size(&mut self, size: Vec2)
pub fn set_window_size(&mut self, size: Vec2)
Set the desired inner size of the window (in egui points).
sourcepub fn set_window_title(&mut self, title: &str)
pub fn set_window_title(&mut self, title: &str)
Set the desired title of the window.
sourcepub fn set_decorations(&mut self, decorated: bool)
pub fn set_decorations(&mut self, decorated: bool)
Set whether to show window decorations (i.e. a frame around you app).
If false it will be difficult to move and resize the app.
sourcepub fn set_fullscreen(&mut self, fullscreen: bool)
pub fn set_fullscreen(&mut self, fullscreen: bool)
Turn borderless fullscreen on/off (native only).
sourcepub fn set_window_pos(&mut self, pos: Pos2)
pub fn set_window_pos(&mut self, pos: Pos2)
set the position of the outer window.
sourcepub fn drag_window(&mut self)
pub fn drag_window(&mut self)
When called, the native window will follow the movement of the cursor while the primary mouse button is down.
Does not work on the web.
sourcepub fn set_visible(&mut self, visible: bool)
pub fn set_visible(&mut self, visible: bool)
Set the visibility of the window.
Auto Trait Implementations
impl !RefUnwindSafe for Frame
impl !Send for Frame
impl !Sync for Frame
impl Unpin for Frame
impl !UnwindSafe for Frame
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more