pub struct Renderer { /* private fields */ }Implementations§
Source§impl Renderer
impl Renderer
Sourcepub fn new() -> RendererResult<Self>
pub fn new() -> RendererResult<Self>
Creates a new Renderer instance with no windows.
Sourcepub fn create_window(
&mut self,
title: impl ToString,
width: u32,
height: u32,
) -> WindowId
pub fn create_window( &mut self, title: impl ToString, width: u32, height: u32, ) -> WindowId
Creates a new window with the given title, dimensions, and resizability.
Returns a WindowId that can be used to interact with the window.
Initializes the GPU context if this is the first window created.
Sourcepub fn create_window_ext(&mut self, props: WindowProperties) -> WindowId
pub fn create_window_ext(&mut self, props: WindowProperties) -> WindowId
Creates a new window with the given properties.
Returns a WindowId that can be used to interact with the window.
Initializes the GPU context if this is the first window created.
Sourcepub fn create_canvas(
&mut self,
width: u32,
height: u32,
) -> RendererResult<Canvas>
pub fn create_canvas( &mut self, width: u32, height: u32, ) -> RendererResult<Canvas>
Create a new canvas with the given width and height.
Sourcepub fn poll(&mut self) -> Vec<(WindowId, WindowEvent)>
pub fn poll(&mut self) -> Vec<(WindowId, WindowEvent)>
Pumps the event loop and returns all window events since the last call. Resize, cursor movement, and focus events are also forwarded to their respective windows internally.
Only available on Windows, macOS, Linux, and Android.
Sourcepub fn close_window(&mut self, id: WindowId) -> bool
pub fn close_window(&mut self, id: WindowId) -> bool
Closes the window with the given WindowId, removing it from the renderer.
Returns true if a window with that ID existed.
Sourcepub fn get_window(&mut self, id: WindowId) -> Option<&mut Window>
pub fn get_window(&mut self, id: WindowId) -> Option<&mut Window>
Returns a mutable reference to the window with the given WindowId, if it exists.
Sourcepub fn flush(&mut self) -> RendererResult<()>
pub fn flush(&mut self) -> RendererResult<()>
Submits all queued draw calls for each open window to the GPU and presents their frames.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Returns true if any windows are still open.
Auto Trait Implementations§
impl !Freeze for Renderer
impl !RefUnwindSafe for Renderer
impl !Send for Renderer
impl !Sync for Renderer
impl !UnwindSafe for Renderer
impl Unpin for Renderer
impl UnsafeUnpin for Renderer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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