pub struct Offscreen { /* private fields */ }Expand description
A game drawn offscreen, a frame at a time, with no window. Made by
App::offscreen.
Implementations§
Source§impl Offscreen
impl Offscreen
Sourcepub fn frame(
&mut self,
elapsed: Duration,
events: &[Event],
) -> Result<Vec<u8>, Error>
pub fn frame( &mut self, elapsed: Duration, events: &[Event], ) -> Result<Vec<u8>, Error>
Runs one frame that comes elapsed after the last, with the events
that came before it, as App::update does. Then draws it as
App::run does, waits for every asset loaded so far and makes it,
and returns the frame’s pixels: RGBA8, sRGB-encoded, from the top
row, 4 bytes a pixel.
Unlike App::run, it waits for the asset server’s workers, so that
each frame shows every asset loaded before it, and a recording is the
same each time. The assets loaded before the first frame are made
after it is drawn, so it shows none of them. A first frame of
Duration::ZERO makes them without a tick.
§Errors
Error::Render if the frame cannot be drawn or read back.
Auto Trait Implementations§
impl !Freeze for Offscreen
impl !RefUnwindSafe for Offscreen
impl !Send for Offscreen
impl !Sync for Offscreen
impl !UnwindSafe for Offscreen
impl Forget for Offscreen
impl Move for Offscreen
impl Unpin for Offscreen
impl UnsafeUnpin for Offscreen
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