pub enum ResourceTilePosition {
Page(Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>),
Tile(Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>, Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>),
}Expand description
The position of a page or a tile within a tile resource.
Despite the difference between pages and tiles, they have enough similarities
that it is sometimes useful to view them abstractly as the same.
Both pages and tiles have a Vecto2<i32> position.
Both pages and tiles have a TileDefinitionHandle and are rendered using
TileRenderData. For pages this is due to having an icon to allow the user to select the page.
Both pages and tiles can be selected by the user, moved, and deleted.
Variants§
Page(Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>)
This position refers to some page, and so it lacks tile coordinates.
Tile(Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>, Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>)
This position refers to some tile, and so it has page coordinates and the coordinates of the tile within the page.
Implementations§
Source§impl ResourceTilePosition
impl ResourceTilePosition
Sourcepub fn new(
stage: TilePaletteStage,
page: Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>,
tile: Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>,
) -> ResourceTilePosition
pub fn new( stage: TilePaletteStage, page: Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>, tile: Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>, ) -> ResourceTilePosition
Construct a position from the given stage, page, and tile.
If the stage is TilePaletteStage::Pages then this position is refering to some page
as if it were a tile, and therefore the page argument is ignored and the tile argument
is taken as the page’s position.
Sourcepub fn stage(&self) -> TilePaletteStage
pub fn stage(&self) -> TilePaletteStage
The stage that contains this position.
Sourcepub fn stage_position(
&self,
) -> Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>
pub fn stage_position( &self, ) -> Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>
The position within the stage. For a page position, this is the page’s coordinates. For a tile position, this is the tile’s coordinates.
Sourcepub fn page(&self) -> Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>
pub fn page(&self) -> Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>
The page coordinates of the position. For a page position, this is
Sourcepub fn handle(&self) -> Option<TileDefinitionHandle>
pub fn handle(&self) -> Option<TileDefinitionHandle>
The handle associated with this position, if this is a tile position.
Trait Implementations§
Source§impl Clone for ResourceTilePosition
impl Clone for ResourceTilePosition
Source§fn clone(&self) -> ResourceTilePosition
fn clone(&self) -> ResourceTilePosition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResourceTilePosition
impl Debug for ResourceTilePosition
Source§impl From<TileDefinitionHandle> for ResourceTilePosition
impl From<TileDefinitionHandle> for ResourceTilePosition
Source§fn from(value: TileDefinitionHandle) -> ResourceTilePosition
fn from(value: TileDefinitionHandle) -> ResourceTilePosition
Source§impl PartialEq for ResourceTilePosition
impl PartialEq for ResourceTilePosition
impl Copy for ResourceTilePosition
impl StructuralPartialEq for ResourceTilePosition
Auto Trait Implementations§
impl Freeze for ResourceTilePosition
impl RefUnwindSafe for ResourceTilePosition
impl Send for ResourceTilePosition
impl Sync for ResourceTilePosition
impl Unpin for ResourceTilePosition
impl UnwindSafe for ResourceTilePosition
Blanket Implementations§
Source§impl<T> AsyncTaskResult for T
impl<T> AsyncTaskResult for T
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
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.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Any. Could be used to downcast a trait object
to a particular type.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Any. Could be used to downcast a trait object
to a particular type.fn into_any(self: Box<T>) -> Box<dyn Any>
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MessageData for T
impl<T> MessageData for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ScriptMessagePayload for T
impl<T> ScriptMessagePayload for T
Source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
self as &dyn AnySource§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
self as &dyn AnySource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.