pub struct WindowSet<T: Type, C: Color> {
pub glfw: RefCell<Glfw>,
pub windows: BTreeMap<WindowId, Window<T, C>>,
}
Expand description
Multiple windows
Fields§
§glfw: RefCell<Glfw>
GLFW handle
windows: BTreeMap<WindowId, Window<T, C>>
Mapping from WindowId
to Window
Implementations§
Source§impl<T: Type, C: Color> WindowSet<T, C>
impl<T: Type, C: Color> WindowSet<T, C>
Sourcepub fn new_with_error_callback<E: 'static>(
f: Callback<fn(Error, String, &E), E>,
) -> Result<Self, Error>
pub fn new_with_error_callback<E: 'static>( f: Callback<fn(Error, String, &E), E>, ) -> Result<Self, Error>
Create a new context with error callback
Sourcepub fn glfw_context(&self) -> Ref<'_, Glfw>
pub fn glfw_context(&self) -> Ref<'_, Glfw>
Access Glfw
handle
Sourcepub fn glfw_context_mut(&self) -> RefMut<'_, Glfw>
pub fn glfw_context_mut(&self) -> RefMut<'_, Glfw>
Access mutable Glfw
handle
Sourcepub fn create(
&mut self,
title: impl AsRef<str>,
image: Image<T, C>,
) -> Result<WindowId, Error>
pub fn create( &mut self, title: impl AsRef<str>, image: Image<T, C>, ) -> Result<WindowId, Error>
Create a new window and add it
Sourcepub fn get_mut(&mut self, window_id: &WindowId) -> Option<&mut Window<T, C>>
pub fn get_mut(&mut self, window_id: &WindowId) -> Option<&mut Window<T, C>>
Get mutable window by ID
Sourcepub fn remove(&mut self, window_id: &WindowId) -> Option<Window<T, C>>
pub fn remove(&mut self, window_id: &WindowId) -> Option<Window<T, C>>
Remove a window and return it
Sourcepub fn iter(&self) -> impl Iterator<Item = (&WindowId, &Window<T, C>)>
pub fn iter(&self) -> impl Iterator<Item = (&WindowId, &Window<T, C>)>
Iterate over all windows
Sourcepub fn iter_mut(
&mut self,
) -> impl Iterator<Item = (&WindowId, &mut Window<T, C>)>
pub fn iter_mut( &mut self, ) -> impl Iterator<Item = (&WindowId, &mut Window<T, C>)>
Iterate over mutable windows
Sourcepub fn iter_windows(&self) -> impl Iterator<Item = &Window<T, C>>
pub fn iter_windows(&self) -> impl Iterator<Item = &Window<T, C>>
Convert into an interator over windows
Sourcepub fn iter_windows_mut(&mut self) -> impl Iterator<Item = &mut Window<T, C>>
pub fn iter_windows_mut(&mut self) -> impl Iterator<Item = &mut Window<T, C>>
Convert into an interator over mutable windows
Sourcepub fn into_images(self) -> impl Iterator<Item = Image<T, C>>
pub fn into_images(self) -> impl Iterator<Item = Image<T, C>>
Convert into an iterator over images
Sourcepub fn step<F: FnMut(&mut Window<T, C>, Option<Event>) -> Result<(), Error>>(
&mut self,
event_handler: F,
) -> Result<bool, Error>
pub fn step<F: FnMut(&mut Window<T, C>, Option<Event>) -> Result<(), Error>>( &mut self, event_handler: F, ) -> Result<bool, Error>
Returns false when there are no more open windows
Sourcepub fn wait_events(&self, timeout: f64)
pub fn wait_events(&self, timeout: f64)
Poll for new events with the given timeout
Trait Implementations§
impl<T: Type, C: Color> Send for WindowSet<T, C>
impl<T: Type, C: Color> Sync for WindowSet<T, C>
Auto Trait Implementations§
impl<T, C> !Freeze for WindowSet<T, C>
impl<T, C> !RefUnwindSafe for WindowSet<T, C>
impl<T, C> Unpin for WindowSet<T, C>
impl<T, C> !UnwindSafe for WindowSet<T, C>
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
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>
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 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>
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