Struct three_d::window::Window

source ·
pub struct Window { /* private fields */ }
Expand description

Default window, context and event handling which uses winit.

To get full control over the creation of the winit window, use Window::from_winit_window. To take control over everything, including the context creation and winit event loop, use WindowedContext::from_winit_window and FrameInputGenerator.

Implementations§

source§

impl Window

source

pub fn new(window_settings: WindowSettings) -> Result<Self, WindowError>

Constructs a new Window with the given settings.

source

pub fn from_event_loop( window_settings: WindowSettings, event_loop: EventLoop<()> ) -> Result<Self, WindowError>

Exactly the same as Window::new() except with the ability to supply an existing EventLoop.

source

pub fn from_winit_window( winit_window: Window, event_loop: EventLoop<()>, surface_settings: SurfaceSettings, maximized: bool ) -> Result<Self, WindowError>

Creates a new window from a winit window and event loop with the given surface settings, giving the user full control over the creation of the window. This method takes ownership of the winit window and event loop, if this is not desired, use a WindowedContext or HeadlessContext instead.

source

pub fn render_loop<F: 'static + FnMut(FrameInput) -> FrameOutput>( self, callback: F )

Start the main render loop which calls the callback closure each frame.

source

pub fn size(&self) -> (u32, u32)

Return the current logical size of the window.

source

pub fn viewport(&self) -> Viewport

Returns the current viewport of the window in physical pixels (the size of the screen returned from FrameInput::screen).

source

pub fn device_pixel_ratio(&self) -> f32

Returns the device pixel ratio for this window.

source

pub fn gl(&self) -> Context

Returns the graphics context for this window.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Window

§

impl !Send for Window

§

impl !Sync for Window

§

impl Unpin for Window

§

impl !UnwindSafe for Window

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> AutoreleaseSafe for Twhere T: ?Sized,