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>where
Image<T, C>: ToTexture<T, C>,
impl<T: Type, C: Color> WindowSet<T, C>where Image<T, C>: ToTexture<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>where
Image<T, C>: ToTexture<T, C>,
pub fn create( &mut self, title: impl AsRef<str>, image: Image<T, C> ) -> Result<WindowId, Error>where Image<T, C>: ToTexture<T, C>,
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