Skip to main content

ShotPainter

Trait ShotPainter 

Source
pub trait ShotPainter {
    type Game: GameData;
    type Shared;
    type Frame;

    // Required methods
    fn frame(
        &self,
        ctx: &Ctx<Self::Game>,
        shared: &Self::Shared,
        moment: Moment,
        screen: Rect,
    ) -> Self::Frame;
    fn paint(
        &self,
        ctx: &Ctx<Self::Game>,
        shared: &Self::Shared,
        moment: Moment,
        frame: Self::Frame,
        buf: &mut GlyphBuffer,
    );
}
Expand description

A game’s shot, built once to be drawn at any moment: one of its shot kinds with whatever it needs ready (a picture painted, a text laid out). Never changed by drawing.

Required Associated Types§

Source

type Game: GameData

The game it is a shot of.

Source

type Shared

What every shot of a player is drawn with, from whoever plays it (() for nothing): the backdrop a title picked, say.

Source

type Frame

What a frame of the shot shows, as plain data: for tests of what plays, and for paint.

Required Methods§

Source

fn frame( &self, ctx: &Ctx<Self::Game>, shared: &Self::Shared, moment: Moment, screen: Rect, ) -> Self::Frame

What the shot shows at moment, on a screen of screen cells.

Source

fn paint( &self, ctx: &Ctx<Self::Game>, shared: &Self::Shared, moment: Moment, frame: Self::Frame, buf: &mut GlyphBuffer, )

Paints frame (the shot’s frame at moment) over the whole of buf, which is cleared to the background.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§