pub struct TileSetAutoTileContext(/* private fields */);Expand description
This is a specialization of AutoTileContext for use with a TileSet.
The pattern of each tile is taken from the values of a nine-slice property,
and TileDefinitionHandle is used to represent individual tiles.
See TileSetAutoTileContext::fill_pattern_map for details on how to fill a
TileSetAutoTileContext with data from a tile set in preparation for auto-tiling.
Implementations§
Source§impl TileSetAutoTileContext
impl TileSetAutoTileContext
Sourcepub fn fill_pattern_map(
&mut self,
tile_set: &TileSet,
pattern_property: TileSetPropertyNine,
frequency_property: Option<TileSetPropertyF32>,
) -> Result<(), FillPatternMapError>
pub fn fill_pattern_map( &mut self, tile_set: &TileSet, pattern_property: TileSetPropertyNine, frequency_property: Option<TileSetPropertyF32>, ) -> Result<(), FillPatternMapError>
Prepare for auto-tiling by extracting tile patterns from the given tile set.
Each tile has an associated pattern through the value of the property
with the UUID given by pattern_property. Each pattern contains nine i8 values
arranged in a 3x3 grid. The outer eight values are used to determine which tiles
are permitted to be adjacent to which other tiles, while the central i8 controls
which cells may have this tile. The central value of 0 is reserved for cells
that should be empty, and any tiles which have a central value of 0 are ignored
by the auto-tiler.
When more than one tile has the same pattern, the auto-tiler must choose between
the tiles randomly. The frequency_property is used to weigh the probabilities
of choosing each tile, so tiles with higher values are more likely to be chosen.
If no frequency property is given, then all tiles are equally likely.
Methods from Deref<Target = AutoTileContext<TileTerrainId, PatternBits, TileDefinitionHandle>>§
Sourcepub fn add(&mut self, key: Ter, pattern: Pat, frequency: f32, value: Tile)
pub fn add(&mut self, key: Ter, pattern: Pat, frequency: f32, value: Tile)
Add a particular tile to the context and specify that tile’s terrain, pattern, and frequency. The higher the frequency, the more likely this tile will be chosen if it shares the same pattern as another tile.
Trait Implementations§
Source§impl Clone for TileSetAutoTileContext
impl Clone for TileSetAutoTileContext
Source§fn clone(&self) -> TileSetAutoTileContext
fn clone(&self) -> TileSetAutoTileContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TileSetAutoTileContext
impl Debug for TileSetAutoTileContext
Source§impl Default for TileSetAutoTileContext
impl Default for TileSetAutoTileContext
Source§fn default() -> TileSetAutoTileContext
fn default() -> TileSetAutoTileContext
Source§impl Deref for TileSetAutoTileContext
impl Deref for TileSetAutoTileContext
Source§type Target = AutoTileContext<i8, PatternBits, TileDefinitionHandle>
type Target = AutoTileContext<i8, PatternBits, TileDefinitionHandle>
Auto Trait Implementations§
impl Freeze for TileSetAutoTileContext
impl RefUnwindSafe for TileSetAutoTileContext
impl Send for TileSetAutoTileContext
impl Sync for TileSetAutoTileContext
impl Unpin for TileSetAutoTileContext
impl UnwindSafe for TileSetAutoTileContext
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 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>, which can then be
downcast into Box<dyn 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>, which 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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T, U> ObjectOrVariant<T> for Uwhere
PhantomData<U>: ObjectOrVariantHelper<T, U>,
impl<T, U> ObjectOrVariant<T> for Uwhere
PhantomData<U>: ObjectOrVariantHelper<T, U>,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§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.