Struct egui_sfml::SfEgui

source ·
pub struct SfEgui { /* private fields */ }
Expand description

Egui integration for SFML.

Implementations§

source§

impl SfEgui

source

pub fn new(window: &RenderWindow) -> Self

Create a new SfEgui.

The size of the egui ui will be the same as window’s size.

source

pub fn add_event(&mut self, event: &Event)

Convert an SFML event into an egui event and add it for later use by egui.

Call this in an event polling loop for each event.

source

pub fn do_frame(&mut self, f: impl FnOnce(&Context)) -> Result<(), DoFrameError>

Does an egui frame with a user supplied ui function.

The f parameter is a user supplied ui function that does the desired ui

source

pub fn draw( &mut self, window: &mut RenderWindow, user_tex_src: Option<&mut dyn UserTexSource> )

Draw the ui to a RenderWindow.

Takes an optional UserTexSource to act as a user texture source.

source

pub fn context(&self) -> &Context

Returns a handle to the egui context

CtxRef can be cloned, but beware that it will be outdated after a call to do_frame

Auto Trait Implementations§

§

impl !RefUnwindSafe for SfEgui

§

impl !Send for SfEgui

§

impl !Sync for SfEgui

§

impl Unpin for SfEgui

§

impl !UnwindSafe for SfEgui

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.