Skip to main content

Player

Struct Player 

Source
pub struct Player { /* private fields */ }
Expand description

Plays one saved scene, one frame at a time.

Implementations§

Source§

impl Player

Source

pub fn new(pkg: Arc<ScenePackage>, theme: Theme, buddy: bool) -> Option<Player>

None if the scene has no such theme.

Source

pub fn new_view( pkg: Arc<ScenePackage>, theme: Theme, buddy: bool, view: PixelRect, ) -> Option<Player>

A player showing only view of the scene’s frame (span mode: each monitor shows its part of one scene). Every method then works in the view’s own coordinates. None if the scene has no such theme or the view isn’t inside the frame.

Source

pub fn set_smooth(&mut self, on: bool)

Particles at sub-cell positions (Clock::Smooth), for presenters on a GPU: a higher frame rate then moves them smoothly. Off by default, so the first frame is the still exactly; the CPU fallback keeps it off (PLAN.md section 4.4).

Source

pub fn with_view(&self, view: PixelRect) -> Option<Player>

Another player of the same scene at the same moment, showing view of it (one scene on several screens, each showing its part). None if the view isn’t inside the frame.

Source

pub fn is_journey(&self) -> bool

Whether the scene is a journey (its whole frame moves every tick).

Source

pub fn size(&self) -> (u32, u32)

The size of what this player shows.

Source

pub fn image(&self) -> &IndexedImage

The whole current frame as palette indices (not just the view).

Source

pub fn index_row(&self, x: u32, y: u32, w: u32) -> &[u8] ⓘ

Palette indices of w pixels of row y from column x, in the view’s coordinates.

Source

pub fn colors(&self) -> &[u32; 256]

The palette as 0RGB, by index.

Source

pub fn now_ms(&self) -> u64

Scene time now: the hero time plus the time since playback started. A pause only stops drawing; the next frame shows the time it is.

Source

pub fn advance(&mut self, t_ms: u64) -> Vec<PixelRect>

Moves to t_ms; returns the rectangles that changed, in the view’s coordinates (changes outside the view are left out).

Source

pub fn write(&self, buf: &mut [u32], rects: &[PixelRect])

Writes those rectangles (view coordinates) of the current frame into a 0RGB buffer of the view’s size.

Source

pub fn rect_pixels(&self, r: &PixelRect, out: &mut Vec<u32>)

One rectangle (view coordinates) of the current frame as 0RGB pixels, row by row.

Source

pub fn write_all(&self, buf: &mut [u32])

Writes the whole view.

Auto Trait Implementations§

§

impl Forget for Player

§

impl Freeze for Player

§

impl Move for Player

§

impl RefUnwindSafe for Player

§

impl Send for Player

§

impl Sync for Player

§

impl Unpin for Player

§

impl UnsafeUnpin for Player

§

impl UnwindSafe for Player

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more