pub struct Strip {
pub cell: i32,
pub rows: i32,
pub x0: i32,
pub row0: i32,
}Expand description
A window onto the sprite sheet, filling the band: rows sheet rows from
row0, drawn at cell pixels a side.
Blocks up to four cells tall are shown at full size, four rows to a page. A taller one would run off the bottom of the band, so the strip halves its cells to fit eight rows instead and follows the block rather than the page — the point of the strip being to show what is selected.
Fields§
§cell: i32Screen side of one cell.
rows: i32Sheet rows on show.
x0: i32Left edge: half-size cells are half as wide, so the strip sits centred.
row0: i32First sheet row on show.
Implementations§
Source§impl Strip
impl Strip
Sourcepub fn new(size: i32, row: i32, page: u32) -> Self
pub fn new(size: i32, row: i32, page: u32) -> Self
The strip for a size-cell block whose top-left is at sheet row row,
with page choosing the rows whenever the block leaves a choice.
Sourcepub fn follows_block(size: i32) -> bool
pub fn follows_block(size: i32) -> bool
Whether the strip follows the block instead of the page, which it does once the block no longer fits the band at full size.
Sourcepub fn cell_at(&self, top: i32, x: i32, y: i32) -> Option<(i32, i32)>
pub fn cell_at(&self, top: i32, x: i32, y: i32) -> Option<(i32, i32)>
The sheet cell (column, row) at screen point (x, y), for a strip with
its top edge at top.
Sourcepub fn draw(&self, fb: &mut Framebuffer, sprites: &SpriteSheet, top: i32)
pub fn draw(&self, fb: &mut Framebuffer, sprites: &SpriteSheet, top: i32)
Paint the band and the rows on show, sampling the sheet down when the cells are at half size.
Sourcepub fn draw_block(
&self,
fb: &mut Framebuffer,
top: i32,
col: i32,
row: i32,
size: i32,
)
pub fn draw_block( &self, fb: &mut Framebuffer, top: i32, col: i32, row: i32, size: i32, )
Box the size-cell block at sheet cell (col, row), clipped to the rows
on show — a block the strip does not follow can start on another page.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Strip
impl RefUnwindSafe for Strip
impl Send for Strip
impl Sync for Strip
impl Unpin for Strip
impl UnsafeUnpin for Strip
impl UnwindSafe for Strip
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.