TileGridOld
A TileGrid is a description of an abstract TileGrid. It contains no data for the elements of any particular TileGrid. The Data for TileGrids is stored in flat arrays. The TileGrid gives the dimensions of a tileGrid. It has methods to interpret the data in flat Arrays created for that TileGrid specification. It has methods to map the elements of an Array to the the 2 dimensional geometry of the Tile Grid. On its own a TileGrid can produce the outlines of the grid, coordinates vector positions and other pure mathematical data. Combined with a simple function it can for example produce a Chess board. Combined with a 64 length array it can produce a Chess board position. For anything but the most simple games, you will probably want multiple arrays to describe the game state. The terrain for example may remain invariant, so the terrain data does not need to be reproduced with every move.
A TileGrid is for use cases where the proportions of the Grid predetermine the proportions of the visual representation, as opposed to a use case where the proportions of the enclosing space are a factor in determining the proportions of the grid. For example the various grid layouts of the Stars on the American flag.
Value members
Abstract methods
Gives the index into an Arr / Array of Tile data from its tile Roord. Use sideIndex and vertIndex methods to access Side and Vertex Arr / Array data.
Gives the index into an Arr / Array of Tile data from its tile Roord. Use sideIndex and vertIndex methods to access Side and Vertex Arr / Array data.
Maximum c or column value. This is not called x because in some grids there is not a 1 to 1 ratio from column coordinate to x.
Maximum c or column value. This is not called x because in some grids there is not a 1 to 1 ratio from column coordinate to x.
Minimum c or column value. This is not called x because in some grids there is not a 1 to 1 ratio from column coordinate to x.
Minimum c or column value. This is not called x because in some grids there is not a 1 to 1 ratio from column coordinate to x.
Number of rows of tiles. This will be different to the number of rows of sides and and will be different to the number of rows of vertices for HexGrids.
Number of rows of tiles. This will be different to the number of rows of sides and and will be different to the number of rows of vertices for HexGrids.
Converts Roord to a Vec2. For a square grid this will be a simple 1 to 1 map.
Converts Roord to a Vec2. For a square grid this will be a simple 1 to 1 map.
foreachs over each Side's Roord in the given Row. Users will not normally need to access this method directly.
foreachs over each Side's Roord in the given Row. Users will not normally need to access this method directly.
foreachs over each Tile's Roord in the given Row. The row is specified by its y value.
foreachs over each Tile's Roord in the given Row. The row is specified by its y value.
foreach Vertice's Roord in the vertex row applies the effectful function.
foreach Vertice's Roord in the vertex row applies the effectful function.
The index from a Side Roord into an Arr of Side data.
The index from a Side Roord into an Arr of Side data.
Tests whether the Tile exists within the TileGrid. Will throw on an invalid Tile Roord.
Tests whether the Tile exists within the TileGrid. Will throw on an invalid Tile Roord.
The Roords of the vertices of a tile, from its centre Roord.
The Roords of the vertices of a tile, from its centre Roord.
Concrete methods
Gives the index into an Arr / Array of Tile data from its tile Roord. Use sideIndex and vertIndex methods to access Side and Vertex Arr / Array data.
Gives the index into an Arr / Array of Tile data from its tile Roord. Use sideIndex and vertIndex methods to access Side and Vertex Arr / Array data.
Quick method to give the Tile, Side and Vertex Roord Text Grahics.
Quick method to give the Tile, Side and Vertex Roord Text Grahics.
flatMaps from all tile Roords to an Arr of type ArrT. The elements of this array can not be accessed from this gird class as the TileGrid structure is lost in the flatMap operation.
flatMaps from all tile Roords to an Arr of type ArrT. The elements of this array can not be accessed from this gird class as the TileGrid structure is lost in the flatMap operation.
flatmaps from all tile Roords to an Arr of type ArrT, removing all duplicate elements.
flatmaps from all tile Roords to an Arr of type ArrT, removing all duplicate elements.
foreachs over each tile's Roord and its centre Vec2.
foreachs over each tile's Roord and its centre Vec2.
Maps from all tile Roords with index to an Arr of A. The Arr produced can be accessed by its Roord from this grid Class.
Maps from all tile Roords with index to an Arr of A. The Arr produced can be accessed by its Roord from this grid Class.
Maps from all tile Roords to an Arr of A. The Arr produced can be accessed by its Roord from this grid Class.
Maps from all tile Roords to an Arr of A. The Arr produced can be accessed by its Roord from this grid Class.
maps over each tile's Roord and its Polygon.
maps over each tile's Roord and its Polygon.
New mutable Array of Tile data. All tiles set to an initial value.
New mutable Array of Tile data. All tiles set to an initial value.
Converts Roord, input as y and components, to a Vec2. For a square grid this will be a simple 1 to 1 map.
Converts Roord, input as y and components, to a Vec2. For a square grid this will be a simple 1 to 1 map.
Converts Roord to a Vec2. For a square grid this will be a simple 1 to 1 map.
Converts Roord to a Vec2. For a square grid this will be a simple 1 to 1 map.
Converts Roord, input as y and components, to a Vec2. For a square grid this will be a simple 1 to 1 map.
Converts Roord, input as y and components, to a Vec2. For a square grid this will be a simple 1 to 1 map.
This gives the Vec2 of the Roord relative to a position on the grid and then scaled. (roordToVec2Abs(roord) - gridPosn -cen) * scale
This gives the Vec2 of the Roord relative to a position on the grid and then scaled. (roordToVec2Abs(roord) - gridPosn -cen) * scale
Sets element in a flat Tiles Arr according to its Roord.
Sets element in a flat Tiles Arr according to its Roord.
Method may be removed, probably better to dispatch from the Arr, with the grid as parameter.
Method may be removed, probably better to dispatch from the Arr, with the grid as parameter.
Method may be removed, probably better to dispatch from the Arr, with the grid as parameter.
Method may be removed, probably better to dispatch from the Arr, with the grid as parameter.
The index from a Side Roord into an Arr of Side data.
The index from a Side Roord into an Arr of Side data.
Side Roord to Line2 relative to a position on the grid and then scaled.
Side Roord to Line2 relative to a position on the grid and then scaled.
Gives all the sideRoords of the grid with out duplicates.
Gives all the sideRoords of the grid with out duplicates.
Foreachs over each Row of Sides. Users will not normally need to use this method directly.
Foreachs over each Row of Sides. Users will not normally need to use this method directly.
This gives the all tile grid lines in a single colour and line width.
This gives the all tile grid lines in a single colour and line width.
foreach side's Roords, calls the effectful function.
foreach side's Roords, calls the effectful function.
Maps from each sides Roord to an ArrBase of A.
Maps from each sides Roord to an ArrBase of A.
Tests whether the Tile exists within the TileGrid. Will throw on an invalid Tile Roord.
Tests whether the Tile exists within the TileGrid. Will throw on an invalid Tile Roord.
Foreach row of vertices apply the effctful function taking the y dimension as parameter.
Foreach row of vertices apply the effctful function taking the y dimension as parameter.
foreach vertex's Roord, calls the effectful function.
foreach vertex's Roord, calls the effectful function.
Maps from each vertex's Roord with index, to a specialised Arr of type A.
Maps from each vertex's Roord with index, to a specialised Arr of type A.
maps from each Vertex's Roord to a value of type A. Returns a specialiased immutable Arr.
maps from each Vertex's Roord to a value of type A. Returns a specialiased immutable Arr.