pub struct WindowState { /* private fields */ }Expand description
Window state attached to a context.
Composes a GlfwPlatform (windowing + input) with an OpenGLBackend
(rendering). The platform backend owns the window handle and event loop;
the render backend is stored alongside it.
Implementations§
Source§impl WindowState
impl WindowState
Sourcepub fn new(platform: GlfwPlatform, backend: OpenGLBackend) -> Self
pub fn new(platform: GlfwPlatform, backend: OpenGLBackend) -> Self
Creates a new WindowState from the given platform and backend.
Sourcepub fn should_close(&self) -> bool
pub fn should_close(&self) -> bool
Returns true if the window should close.
Sourcepub fn set_should_close(&mut self, should_close: bool)
pub fn set_should_close(&mut self, should_close: bool)
Sets whether the window should close.
Sourcepub fn poll_events(&mut self, input: &mut InputManager) -> f32
pub fn poll_events(&mut self, input: &mut InputManager) -> f32
Polls events, updates input state, and syncs the viewport on resize.
Sourcepub fn swap_buffers(&mut self)
pub fn swap_buffers(&mut self)
Swaps the front and back buffers.
Sourcepub fn get_framebuffer_size(&self) -> (u32, u32)
pub fn get_framebuffer_size(&self) -> (u32, u32)
Gets framebuffer size (physical - may differ on HiDPI/Retina displays).
Sourcepub fn backend_mut(&mut self) -> &mut OpenGLBackend
pub fn backend_mut(&mut self) -> &mut OpenGLBackend
Gets a mutable reference to the backend.
Sourcepub fn delta_time(&self) -> f32
pub fn delta_time(&self) -> f32
Gets the delta time.
Auto Trait Implementations§
impl Freeze for WindowState
impl RefUnwindSafe for WindowState
impl !Send for WindowState
impl !Sync for WindowState
impl Unpin for WindowState
impl UnsafeUnpin for WindowState
impl UnwindSafe for WindowState
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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