Struct rusty_sword_arena::gfx::Window [−][src]
pub struct Window { /* fields omitted */ }
An OpenGL window for displaying graphics. Also the object through which you'll receive input events (mouse, keyboard, etc.)
Methods
impl Window
[src]
impl Window
pub fn new(override_dimension: Option<u32>) -> Self
[src]
pub fn new(override_dimension: Option<u32>) -> Self
By default, this will be a square window with a dimension of 1024px
or
(monitor height - 100px)
, whichever is smaller. You can override the dimension by
providing a value for override_dimension, for example: Some(2048)
. Note that on hi-dpi
displays (like Apple Retina Displays) 1 "pixel" is often a square of 4 hi-dpi pixels
(depending on whether the monitor is set to be scaled or not).
pub fn drawstart(&mut self)
[src]
pub fn drawstart(&mut self)
Call drawstart()
when you are ready to draw a new frame. It will create the new frame and
clear it to black.
pub fn draw(&mut self, shape: &Shape)
[src]
pub fn draw(&mut self, shape: &Shape)
Pass draw()
every shape that you would like to draw. After the first time they are drawn,
shapes stay on the GPU and only send updated position/rotation, which is super efficient,
so keep your shape objects around! Don't recreate them every frame. Shapes are drawn in
order, so the last shape you draw will be on top.
pub fn drawfinish(&mut self)
[src]
pub fn drawfinish(&mut self)
Call drawfinish()
when you are ready to finalize the frame and show it. You will need to
call drawstart()
again before you can draw()
any shapes in a new frame. I think this
method blocks until the hardware is ready for a frame. 60fps on most displays.
pub fn events(&mut self) -> Vec<Event>
[src]
pub fn events(&mut self) -> Vec<Event>
Get events that the graphics system may have seen (window, keyboard, mouse) and translate them into our own, simpler events.