Struct conrod::backend::piston::window::Window
[−]
[src]
pub struct Window<W: BasicWindow = GlutinWindow> { pub window: W, pub context: GfxContext, }
Contains everything required for controlling window, graphics, event loop.
Fields
window: W
The window.
context: GfxContext
Stores state associated with Gfx.
Methods
impl<W> Window<W> where
W: BasicWindow,
W::Event: GenericEvent,
[src]
W: BasicWindow,
W::Event: GenericEvent,
pub fn new(window: W, context: GfxContext) -> Self where
W: OpenGLWindow,
[src]
W: OpenGLWindow,
Creates a new piston window.
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) -> U,
[src]
W: OpenGLWindow,
E: GenericEvent,
F: FnOnce(Context, &mut G2d) -> U,
Renders 2D graphics.
pub fn next_event<E>(&mut self, events: &mut E) -> Option<Event> where
Self: EventWindow<E>,
[src]
Self: EventWindow<E>,
A wrapper around the EventWindow::next
trait method. This avoids the need for users to
import the EventWindow
trait in most cases.
pub fn handle_event(&mut self, event: &Event<W::Event>)
[src]
Let window handle new event.
Trait Implementations
impl<W> BuildFromWindowSettings for Window<W> where
W: BasicWindow + OpenGLWindow + BuildFromWindowSettings,
W::Event: GenericEvent,
[src]
W: BasicWindow + OpenGLWindow + BuildFromWindowSettings,
W::Event: GenericEvent,
fn build_from_window_settings(
settings: &WindowSettings
) -> Result<Window<W>, String>
[src]
settings: &WindowSettings
) -> Result<Window<W>, String>
Builds the window from a WindowSettings
object. Read more
impl<W> BasicWindow for Window<W> where
W: BasicWindow,
[src]
W: BasicWindow,
type Event = <W as BasicWindow>::Event
The event type the window uses for incoming input. Read more
fn should_close(&self) -> bool
[src]
Returns true if the window should close.
fn set_should_close(&mut self, value: bool)
[src]
Tells the window to close or stay open.
fn size(&self) -> Size
[src]
Gets the size of the window.
fn draw_size(&self) -> Size
[src]
Gets the draw size of the window. Read more
fn swap_buffers(&mut self)
[src]
Swaps render buffers. Read more
fn wait_event(&mut self) -> Self::Event
[src]
Wait indefinitely for an event to be available from the window. Read more
fn wait_event_timeout(&mut self, timeout: Duration) -> Option<Self::Event>
[src]
Wait for an event to be available from the window or for the specified timeout to be reached. Read more
fn poll_event(&mut self) -> Option<Self::Event>
[src]
Polls an event from the window. Read more
impl<W> AdvancedWindow for Window<W> where
W: AdvancedWindow,
[src]
W: AdvancedWindow,
fn get_title(&self) -> String
[src]
Gets a copy of the title of the window.
fn set_title(&mut self, title: String)
[src]
Sets the title of the window.
fn get_exit_on_esc(&self) -> bool
[src]
Gets whether to exit when pressing esc. Read more
fn set_exit_on_esc(&mut self, value: bool)
[src]
Sets whether to exit when pressing esc. Read more
fn set_capture_cursor(&mut self, value: bool)
[src]
Sets whether to capture/grab the cursor. Read more
fn show(&mut self)
[src]
Shows the window. Read more
fn hide(&mut self)
[src]
Hides the window. Read more
fn get_position(&self) -> Option<Position>
[src]
Gets the position of window.
fn set_position<P: Into<Position>>(&mut self, pos: P)
[src]
Sets the position of window. Read more
fn title(self, value: String) -> Self
[src]
Sets title on window. Read more
fn exit_on_esc(self, value: bool) -> Self
[src]
Sets whether to exit when pressing the Esc button. Read more
fn capture_cursor(self, value: bool) -> Self
[src]
Sets whether to capture/grab the cursor. Read more
fn position<P>(self, val: P) -> Self where
P: Into<Position>,
[src]
P: Into<Position>,
Sets the position of window. Read more
impl EventWindow<WindowEvents> for Window
[src]
fn next(&mut self, events: &mut WindowEvents) -> Option<Event>
[src]
receive next event from event loop and handle it