Skip to main content

EguiWindow

Struct EguiWindow 

Source
pub struct EguiWindow { /* private fields */ }
Expand description

egui and the window it draws into, over whichever renderer was available. Vsync is on; every backend clears, paints and presents in Self::paint.

Implementations§

Source§

impl EguiWindow

Source

pub fn new( video: &VideoSubsystem, title: &str, size: (u32, u32), configure: impl Fn(&mut WindowBuilder), order: &[Renderer], ) -> Result<Self, String>

Try order in sequence, returning the first renderer that comes up. The error is the last attempt’s, since that is the one that decided it.

Source

pub fn renderer(&self) -> Renderer

Which one won, for the app’s own logging and about screens.

Source

pub fn set_rotation(&mut self, rotation: Rotation)

Present the UI at a quarter turn to the window, for a panel that is not mounted the way it is read.

egui lays out for the turned screen — a quarter turn trades the window’s width and height — and this window puts the frame back on the panel: Renderer::Gles3 and Renderer::Gl32 turn the geometry as they draw it, the SDL renderers paint offscreen and present that turned. Pointer and touch positions travel back the same way, so a tap lands where it looks. May be called at any time; nothing is rebuilt on a change of turn.

Source

pub fn rotation(&self) -> Rotation

Source

pub fn ctx(&self) -> &Context

Source

pub fn window(&self) -> &Window

Source

pub fn window_mut(&mut self) -> &mut Window

For the things SDL only does through the window itself, like Window::set_icon.

Source

pub fn on_event(&mut self, event: &Event) -> EventResponse

Feed an SDL event to egui; wgpu also resizes its surface here.

Source

pub fn run(&mut self, run_ui: impl FnMut(&Context))

Run the UI; Self::paint puts the result on screen.

Source

pub fn run_ui(&mut self, run_ui: impl FnMut(&mut Ui))

Like Self::run, but hands the closure egui’s root egui::Ui.

Source

pub fn repaint_delay(&self) -> Duration

How long until egui wants another frame, from the last Self::run.

Source

pub fn paint(&mut self, clear_color: [f32; 4])

Clear to clear_color, paint the last Self::run, present.

Source

pub fn destroy(&mut self)

Release the renderer’s graphics resources.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>