pub struct GraphicsContext<'a> {
pub width: f32,
pub height: f32,
pub dpi_factor: f32,
/* private fields */
}Expand description
Draw stuff on the screen with this.
Create this struct with
Context::start_frame().
Then, pass it to:
Spritesheet::drawto draw sprites,Font::drawto draw text.
And after doing all the drawing, call
GraphicsContext::finish_frame()
to flush all the rendering operations.
Fields§
§width: f32The width of the window in logical coordinates. Multiply with
dpi_factor to get the width in physical pixels.
height: f32The height of the window in logical coordinates. Multiply with
dpi_factor to get the height in physical pixels.
dpi_factor: f32The dpi multiplier of the window.
Implementations§
Source§impl GraphicsContext<'_>
impl GraphicsContext<'_>
Sourcepub fn finish_frame(self)
pub fn finish_frame(self)
Consume this GraphicsContext to render everything that has
been queued with draw calls so far. Call
Context::render()
and swap buffers after this.
Auto Trait Implementations§
impl<'a> Freeze for GraphicsContext<'a>
impl<'a> !RefUnwindSafe for GraphicsContext<'a>
impl<'a> !Send for GraphicsContext<'a>
impl<'a> !Sync for GraphicsContext<'a>
impl<'a> Unpin for GraphicsContext<'a>
impl<'a> UnsafeUnpin for GraphicsContext<'a>
impl<'a> !UnwindSafe for GraphicsContext<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more