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]

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).

Call drawstart() when you are ready to draw a new frame. It will create the new frame and clear it to black.

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.

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.

Get events that the graphics system may have seen (window, keyboard, mouse) and translate them into our own, simpler events.

Auto Trait Implementations

impl !Send for Window

impl !Sync for Window