pub struct Display { /* private fields */ }
Expand description
A target to render to, e.g. a window or full screen.
Implementations§
Source§impl Display
impl Display
Sourcepub fn builder() -> DisplayBuilder
pub fn builder() -> DisplayBuilder
Returns a display builder for display construction.
§Examples
let display = Display::builder().dimensions((640, 480)).vsync().title("Window!").build().unwrap();
Sourcepub fn set_fullscreen(&self) -> Result<()>
pub fn set_fullscreen(&self) -> Result<()>
Switches to fullscreen mode on the primary monitor.
Sourcepub fn set_fullscreen_on(&self, monitor: Monitor) -> Result<()>
pub fn set_fullscreen_on(&self, monitor: Monitor) -> Result<()>
Switches to fullscreen mode on the given monitor.
Sourcepub fn set_windowed(&self)
pub fn set_windowed(&self)
Switches to windowed mode.
Sourcepub fn prepare_frame(&self)
pub fn prepare_frame(&self)
Prepares a frame for rendering.
Sourcepub fn clear_frame(&self, color: Color)
pub fn clear_frame(&self, color: Color)
Prepares a frame for rendering and clears it.
Sourcepub fn swap_frame(&self)
pub fn swap_frame(&self)
Swaps current drawing frame with visible frame.
Sourcepub fn grab_cursor(&self)
pub fn grab_cursor(&self)
Enables cursor grab mode. While in this mode, the mouse cursor will be hidden and constrained to the window.
Grab mode will be temporarily released when the window loses focus and automatically restored once it regains focus.
Sourcepub fn hide_cursor(&self)
pub fn hide_cursor(&self)
Hides the mouse cursor while it is inside the window.
Sourcepub fn free_cursor(&self)
pub fn free_cursor(&self)
Releases a previously grabbed or hidden cursor and makes it visible again.
Sourcepub fn set_cursor_position(&self, position: (i32, i32))
pub fn set_cursor_position(&self, position: (i32, i32))
Sets the mouse cursor position.
Sourcepub fn dimensions(&self) -> (u32, u32)
pub fn dimensions(&self) -> (u32, u32)
Returns the window dimensions.
Sourcepub fn poll_events(&self) -> &Self
pub fn poll_events(&self) -> &Self
Polls for events like keyboard or mouse input and changes to the window. See
Input
for basic keyboard and mouse support.
Sourcepub fn was_closed(&self) -> bool
pub fn was_closed(&self) -> bool
Returns true once after the attached window was closed
Trait Implementations§
Source§impl AsRenderTarget for Display
impl AsRenderTarget for Display
Source§fn as_render_target(&self) -> RenderTarget
fn as_render_target(&self) -> RenderTarget
Auto Trait Implementations§
impl Freeze for Display
impl !RefUnwindSafe for Display
impl !Send for Display
impl !Sync for Display
impl Unpin for Display
impl !UnwindSafe for Display
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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> 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