WangTemplate enum
A standard arrangement of terrain tiles in a tileset image, and the Wang ids that arrangement means.
Assigning Wang ids by hand is slow — 16 tiles × 4 corners, or 47 × 8 slots. A tileset drawn in one of these layouts gets every id from one choice: where the block starts. Each template is a two-terrain set: colour 1 is the terrain the tiles are "of" (grass), colour 2 what it meets (dirt, or empty).
Values
- corner16 → const WangTemplate
-
Sixteen tiles in a 4 × 4 block, a corner set. Tile n has colour 1 at the corners whose bits are set in n: 1 top-left, 2 top-right, 4 bottom-right, 8 bottom-left. Tile 0 is all colour 2, tile 15 all colour 1.
const WangTemplate(WangType.corner, 16, 4) - blob47 → const WangTemplate
-
The 47 distinct "blob" tiles, a mixed set, in a 7-wide block (the last two places empty): every arrangement of the eight neighbours that looks different, in ascending order of its neighbour mask — bits 1 top, 2 top-right, 4 right, 8 bottom-right, 16 bottom, 32 bottom-left, 64 left, 128 top-left, a corner counted only when both edges beside it are set.
const WangTemplate(WangType.mixed, 47, 7)
Properties
- columns → int
-
How wide its block is, in tiles.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tileCount → int
-
How many tiles the layout has.
final
- type → WangType
-
The kind of Wang set the layout makes: a corner or a mixed set.
final
Methods
-
applyTo(
WangSetData set, {required int firstTile, required int tilesetColumns, int? tileCountLimit}) → int -
Fills
set's ids from a block of this layout whose first tile isfirstTilein a tilesettilesetColumnswide, and makes sure it has the two colours. Tiles that fall outsidetileCountLimitare skipped. Returns how many tiles were assigned. -
idOf(
int index) → List< int> -
The Wang id of the template's
indexth tile. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
WangTemplate> - A constant List of the values in this enum, in order of their declaration.