[−][src]Struct piston_window::PistonWindow
Contains everything required for controlling window, graphics, event loop.
Fields
window: W
The window.
encoder: GfxEncoder
GFX encoder.
device: Device
GFX device.
output_color: RenderTargetView<Resources, Srgba8>
Output frame buffer.
output_stencil: DepthStencilView<Resources, DepthStencil>
Output stencil buffer.
g2d: Gfx2d<Resources>
Gfx2d.
events: Events
Event loop state.
factory: Factory
The factory that was created along with the device.
Methods
impl<W> PistonWindow<W> where
W: Window,
[src]
W: Window,
pub fn new(opengl: OpenGL, samples: u8, window: W) -> Self where
W: OpenGLWindow,
[src]
W: OpenGLWindow,
Creates a new piston window.
pub fn create_texture_context(&mut self) -> G2dTextureContext
[src]
Creates context used to create and update textures.
pub fn load_font<P: AsRef<Path>>(&mut self, path: P) -> Result<Glyphs, Error>
[src]
Loads font from a path.
pub fn draw_2d<E, F, U>(&mut self, e: &E, f: F) -> Option<U> where
W: OpenGLWindow,
E: GenericEvent,
F: FnOnce(Context, &mut G2d, &mut Device) -> U,
[src]
W: OpenGLWindow,
E: GenericEvent,
F: FnOnce(Context, &mut G2d, &mut Device) -> U,
Renders 2D graphics.
Calls the closure on render events. There is no need to filter events manually, and there is no overhead.
pub fn draw_3d<E, F, U>(&mut self, e: &E, f: F) -> Option<U> where
W: OpenGLWindow,
E: GenericEvent,
F: FnOnce(&mut Self) -> U,
[src]
W: OpenGLWindow,
E: GenericEvent,
F: FnOnce(&mut Self) -> U,
Renders 3D graphics.
Calls the closure on render events. There is no need to filter events manually, and there is no overhead.
pub fn next(&mut self) -> Option<Event>
[src]
Returns next event. Cleans up after rendering and resizes frame buffers.
pub fn event<E: GenericEvent>(&mut self, event: &E)
[src]
Let window handle new event. Cleans up after rendering and resizes frame buffers.
Trait Implementations
impl<W> AdvancedWindow for PistonWindow<W> where
W: AdvancedWindow,
[src]
W: AdvancedWindow,
fn get_title(&self) -> String
[src]
fn set_title(&mut self, title: String)
[src]
fn get_automatic_close(&self) -> bool
[src]
fn set_automatic_close(&mut self, value: bool)
[src]
fn get_exit_on_esc(&self) -> bool
[src]
fn set_exit_on_esc(&mut self, value: bool)
[src]
fn set_capture_cursor(&mut self, value: bool)
[src]
fn show(&mut self)
[src]
fn hide(&mut self)
[src]
fn get_position(&self) -> Option<Position>
[src]
fn set_position<P: Into<Position>>(&mut self, pos: P)
[src]
fn set_size<S: Into<Size>>(&mut self, size: S)
[src]
fn title(self, value: String) -> Self
Sets title on window. Read more
fn exit_on_esc(self, value: bool) -> Self
Sets whether to exit when pressing the Esc button. Read more
fn automatic_close(self, value: bool) -> Self
Sets whether the window will automatically close when attempting to close it. If this is disabled, attempts to close the window can be detected via an Input::Close(..)
event, and Window::set_should_close()
can be called to actually close the window. Read more
fn capture_cursor(self, value: bool) -> Self
Sets whether to capture/grab the cursor. Read more
fn position<P>(self, val: P) -> Self where
P: Into<Position>,
P: Into<Position>,
Sets the position of window. Read more
impl<W> EventLoop for PistonWindow<W> where
W: Window,
[src]
W: Window,
fn get_event_settings(&self) -> EventSettings
[src]
fn set_event_settings(&mut self, settings: EventSettings)
[src]
fn set_ups(&mut self, frames: u64)
The number of updates per second Read more
fn ups(self, frames: u64) -> Self
The number of updates per second Read more
fn set_ups_reset(&mut self, frames: u64)
The number of delayed updates before skipping them to catch up. When set to 0
, it will always try to catch up. Read more
fn ups_reset(self, frames: u64) -> Self
The number of delayed updates before skipping them to catch up. When set to 0
, it will always try to catch up. Read more
fn set_max_fps(&mut self, frames: u64)
The maximum number of frames per second Read more
fn max_fps(self, frames: u64) -> Self
The maximum number of frames per second Read more
fn set_swap_buffers(&mut self, enable: bool)
Enable or disable automatic swapping of buffers.
fn swap_buffers(self, enable: bool) -> Self
Enable or disable automatic swapping of buffers.
fn set_bench_mode(&mut self, enable: bool)
Enable or disable benchmark mode. When enabled, it will render and update without sleep and ignore input. Used to test performance by playing through as fast as possible. Requires lazy
to be set to false
. Read more
fn bench_mode(self, enable: bool) -> Self
Enable or disable benchmark mode. When enabled, it will render and update without sleep and ignore input. Used to test performance by playing through as fast as possible. Requires lazy
to be set to false
. Read more
fn set_lazy(&mut self, enable: bool)
Enable or disable rendering only when receiving input. When enabled, update events are disabled. Idle events are emitted while receiving input. Read more
fn lazy(self, enable: bool) -> Self
Enable or disable rendering only when receiving input. When enabled, update events are disabled. Idle events are emitted while receiving input. Read more
impl<W> Window for PistonWindow<W> where
W: Window,
[src]
W: Window,
fn should_close(&self) -> bool
[src]
fn set_should_close(&mut self, value: bool)
[src]
fn size(&self) -> Size
[src]
fn draw_size(&self) -> Size
[src]
fn swap_buffers(&mut self)
[src]
fn wait_event(&mut self) -> (Input, Option<TimeStamp>)
[src]
fn wait_event_timeout(
&mut self,
timeout: Duration
) -> Option<(Input, Option<TimeStamp>)>
[src]
&mut self,
timeout: Duration
) -> Option<(Input, Option<TimeStamp>)>
fn poll_event(&mut self) -> Option<(Input, Option<TimeStamp>)>
[src]
impl<W> BuildFromWindowSettings for PistonWindow<W> where
W: Window + OpenGLWindow + BuildFromWindowSettings,
[src]
W: Window + OpenGLWindow + BuildFromWindowSettings,
fn build_from_window_settings(
settings: &WindowSettings
) -> Result<PistonWindow<W>, Box<dyn Error>>
[src]
settings: &WindowSettings
) -> Result<PistonWindow<W>, Box<dyn Error>>
Auto Trait Implementations
impl<W = GlutinWindow> !Send for PistonWindow<W>
impl<W = GlutinWindow> !Sync for PistonWindow<W>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.