Struct 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 run( &mut self, rw: &mut RenderWindow, f: impl FnMut(&mut RenderWindow, &Context), ) -> Result<DrawInput, PassError>

Does a egui::Context::run to run your egui ui.

This supports egui uis that depend on multiple passes.

See egui::Context::request_discard.

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

Source

pub fn begin_pass(&mut self)

Begins a (single) egui pass.

This does not support egui uis that depend on multiple passes. Use Self::run for that.

If you call this, it should be paired with Self::end_pass.

Source

pub fn end_pass( &mut self, rw: &mut RenderWindow, ) -> Result<DrawInput, PassError>

Ends an egui pass. Call Self::begin_pass first.

Source

pub fn draw( &mut self, input: DrawInput, 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

Auto Trait Implementations§

§

impl Freeze for SfEgui

§

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 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<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, 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.