Skip to main content

CinematicPlayer

Struct CinematicPlayer 

Source
pub struct CinematicPlayer<S> { /* private fields */ }
Expand description

Draws a cinematic of shots S at any time.

Implementations§

Source§

impl<S> CinematicPlayer<S>

Source

pub fn new(timeline: Timeline, shots: Vec<S>) -> Self

A player of shots (one for each start of timeline).

Source

pub fn of<'d, D>( def: &'d CinematicDef<D>, build: impl FnMut(&'d D) -> S, ) -> Self

A player of the cinematic def, each shot built once by build, in order.

Source

pub fn timeline(&self) -> &Timeline

When its shots start and how long it is.

Source

pub fn shot(&self, index: usize) -> Option<&S>

Shot index, counted from 0.

Source

pub fn moment(&self, t: f32) -> Moment

The moment t seconds after the start (wrapped at the length).

Source

pub fn at(&self, t: f32) -> Option<(&S, Moment)>

The shot shown t seconds after the start (wrapped at the length), and the moment of it; None with no shots.

Source§

impl<S: ShotPainter> CinematicPlayer<S>

Source

pub fn frame( &self, ctx: &Ctx<S::Game>, shared: &S::Shared, t: f32, screen: Rect, ) -> Option<S::Frame>

What is shown t seconds after the start (wrapped at the length), on a screen of screen cells; None with no shots.

Source

pub fn draw( &self, ctx: &Ctx<S::Game>, shared: &S::Shared, t: f32, brightness: f32, buf: &mut GlyphBuffer, )

Draws the cinematic as it is t seconds after its start (wrapped at the length) over the whole of buf, at brightness (1 = as it is, 0 = black: GlyphBuffer::fade). The same t always draws the same frame.

Trait Implementations§

Source§

impl<S: Clone> Clone for CinematicPlayer<S>

Source§

fn clone(&self) -> CinematicPlayer<S>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Debug> Debug for CinematicPlayer<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: PartialEq> PartialEq for CinematicPlayer<S>

Source§

fn eq(&self, other: &CinematicPlayer<S>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<S: PartialEq> StructuralPartialEq for CinematicPlayer<S>

Auto Trait Implementations§

§

impl<S> Freeze for CinematicPlayer<S>

§

impl<S> RefUnwindSafe for CinematicPlayer<S>
where S: RefUnwindSafe,

§

impl<S> Send for CinematicPlayer<S>
where S: Send,

§

impl<S> Sync for CinematicPlayer<S>
where S: Sync,

§

impl<S> Unpin for CinematicPlayer<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for CinematicPlayer<S>

§

impl<S> UnwindSafe for CinematicPlayer<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.