pub struct SfEgui { /* private fields */ }
Expand description
Egui
integration for SFML.
Implementations§
Source§impl SfEgui
impl SfEgui
Sourcepub fn new(window: &RenderWindow) -> Self
pub fn new(window: &RenderWindow) -> Self
Create a new SfEgui
.
The size of the egui ui will be the same as window
’s size.
Sourcepub fn add_event(&mut self, event: &Event)
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.
Sourcepub fn run(
&mut self,
rw: &mut RenderWindow,
f: impl FnMut(&mut RenderWindow, &Context),
) -> Result<DrawInput, PassError>
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
Sourcepub fn begin_pass(&mut self)
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
.
Sourcepub fn end_pass(
&mut self,
rw: &mut RenderWindow,
) -> Result<DrawInput, PassError>
pub fn end_pass( &mut self, rw: &mut RenderWindow, ) -> Result<DrawInput, PassError>
Ends an egui pass. Call Self::begin_pass
first.
Sourcepub fn draw(
&mut self,
input: DrawInput,
window: &mut RenderWindow,
user_tex_src: Option<&mut dyn UserTexSource>,
)
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.
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> 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