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.

class Object
trait Matchable
class Any

Value members

Abstract methods

The active tiles without any PaintElems.

The active tiles without any PaintElems.

@inline
def arrIndex(y: Int, c: Int): Int

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.

def bottom: Double
def cStep: Int
def cTileMax: Int

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.

def cTileMin: Int

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.

def isTileRoord(r: Roord): Boolean
def numOfTileRows: Int

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.

def numOfTiles: Int

The total number of Tiles in the tile Grid.

The total number of Tiles in the tile Grid.

def roordToPt2(roord: Roord): Pt2

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.

def rowForeachSide(y: Int)(f: Roord => Unit): Unit

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.

def rowForeachTile(y: Int)(f: Roord => Unit): Unit

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.

def rowForeachVert(y: Int)(f: Roord => Unit): Unit

foreach Vertice's Roord in the vertex row applies the effectful function.

foreach Vertice's Roord in the vertex row applies the effectful function.

def sideArrIndex(y: Int, c: Int): Int

The index from a Side Roord into an Arr of Side data.

The index from a Side Roord into an Arr of Side data.

def sideRoordsOfTile(tileRoord: Roord): Roords
def tileExists(y: Int, c: Int): Boolean

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.

def top: Double
def xCen: Double

The centre of the grid in terms of the x Axis.

The centre of the grid in terms of the x Axis.

def xLeft: Double
def xRight: Double
def yTileMax: Int

The top Tile Row of the The TileGrid. the y value.

The top Tile Row of the The TileGrid. the y value.

def yTileMin: Int

The bottom Tile Row of the TileGrid. the y value.

The bottom Tile Row of the TileGrid. the y value.

Concrete methods

@inline
final def arrIndex(r: Roord): Int

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.

def cenPt: Pt2

The centre point of the grid in Vec2 coordinates.

The centre point of the grid in Vec2 coordinates.

final def cenRoordIndexTexts(textSize: Int, colour: Colour): Arr[TextGraphic]
def cenRoordTexts(textSize: Int, colour: Colour): Arr[TextGraphic]

Quick method to give the Tile, Side and Vertex Roord Text Grahics.

Quick method to give the Tile, Side and Vertex Roord Text Grahics.

def cenVec: Vec2

The centre of the grid in Vec2 coordinates.

The centre of the grid in Vec2 coordinates.

final def flatMap[ArrT <: ArrImut[_]](f: Roord => ArrT)(implicit build: ArrTFlatBuilder[ArrT]): ArrT

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.

final def flatMapNoDupicates[A, ArrT <: ArrImut[A]](f: Roord => ArrT)(implicit build: ArrTBuilder[A, ArrT]): ArrT

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.

final def foreach(f: Roord => Unit): Unit

foreachs over each tile's centre Roord.

foreachs over each tile's centre Roord.

final def foreachRVec(f: (Roord, Pt2) => Unit): Unit

foreachs over each tile's Roord and its centre Vec2.

foreachs over each tile's Roord and its centre Vec2.

final def foreachRow(f: Int => Unit): Unit

Foreach grid Row y coordinate.

Foreach grid Row y coordinate.

def fullDisplayScale(dispWidth: Double, dispHeight: Double, padding: Double): Double
def height: Double
final def iMap[A, ArrT <: ArrImut[A]](f: (Roord, Int) => A)(implicit build: ArrTBuilder[A, ArrT]): ArrT

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.

final def map[A, ArrT <: ArrImut[A]](f: Roord => A)(implicit build: ArrTBuilder[A, ArrT]): ArrT

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.

final def mapRPolygons[A, ArrT <: ArrImut[A]](f: (Roord, PolygonImp) => A)(implicit build: ArrTBuilder[A, ArrT]): ArrT

maps over each tile's Roord and its Polygon.

maps over each tile's Roord and its Polygon.

New immutable Arr of Side Boolean data.

New immutable Arr of Side Boolean data.

final def newTileArr[A <: AnyRef](value: A)(implicit ct: ClassTag[A]): TilesArr[A]

New immutable Arr of Tile data.

New immutable Arr of Tile data.

final def newTileArrOpt[A <: AnyRef](implicit ct: ClassTag[A]): TilesArrOpt[A]

New Tile immutable Tile Arr of Opt data values.

New Tile immutable Tile Arr of Opt data values.

final def newTileArray[A <: AnyRef](value: A)(implicit ct: ClassTag[A]): Array[A]

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.

final def newTileArrayList[A](value: List[A]): Array[List[A]]

New mutable Array of Tile data Lists.

New mutable Array of Tile data Lists.

New immutable Arr of Side Boolean data.

New immutable Arr of Side Boolean data.

New immutable Arr of vertex Int data.

New immutable Arr of vertex Int data.

@inline
final def numOfSideRows: Int

The number of Rows of Sides.

The number of Rows of Sides.

@inline
final def numOfVertRows: Int

The number of Rows of vertices.

The number of Rows of vertices.

def roordToPt2(y: Int, c: Int): Pt2

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.

def roordToVec(roord: Roord): Vec2

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.

def roordToVec(y: Int, c: Int): Vec2

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.

def roordToVec2Rel(roord: Roord, scale: Double, gridPosn: Pt2): Pt2

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

def setTile[A](roord: Roord, value: A)(implicit arr: ArrImut[A]): Unit

Sets element in a flat Tiles Arr according to its Roord.

Sets element in a flat Tiles Arr according to its Roord.

def setTile[A <: AnyRef](roord: Roord, value: A)(implicit arr: Arr[A]): Unit

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.

def setTile[A <: AnyRef](xi: Int, yi: Int, value: A)(implicit arr: Arr[A]): Unit

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.

@inline
final def sideArrIndex(roord: Roord): Int

The index from a Side Roord into an Arr of Side data.

The index from a Side Roord into an Arr of Side data.

def sideInnerRowForeach(f: Int => Unit): Unit
final def sideLines: LineSegs
def sideRoordIndexTexts(textSize: Int, colour: Colour): Arr[TextGraphic]
def sideRoordTexts(textSize: Int, colour: Colour): Arr[TextGraphic]
final def sideRoordToLine2(sideRoord: Roord): LineSeg

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.

def sideRowForeach(f: Int => Unit): Unit

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.

final def sidesDraw(lineWidth: Double, colour: Colour): LinesDraw

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.

final def sidesForeach(f: Roord => Unit): Unit

foreach side's Roords, calls the effectful function.

foreach side's Roords, calls the effectful function.

def sidesIMap[A, ArrT <: ArrImut[A]](f: (Roord, Int) => A)(implicit build: ArrTBuilder[A, ArrT]): ArrT

Maps from each sides Roord to an ArrBase of A.

Maps from each sides Roord to an ArrBase of A.

def sidesMap[A, ArrT <: ArrImut[A]](f: Roord => A)(implicit build: ArrTBuilder[A, ArrT]): ArrT

Maps from each sides Roord to an ArrBase of A.

Maps from each sides Roord to an ArrBase of A.

final def tileExists(r: Roord): Boolean

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.

def vertRoordIndexTexts(textSize: Int, colour: Colour): Arr[TextGraphic]
def vertRoordTexts(fontSize: Int, colour: Colour): Arr[TextGraphic]
final def vertRowForeach(f: Int => Unit): Unit

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.

final def vertsForeach(f: Roord => Unit): Unit

foreach vertex's Roord, calls the effectful function.

foreach vertex's Roord, calls the effectful function.

def vertsIMap[A, ArrT <: ArrImut[A]](f: (Roord, Int) => A)(implicit build: ArrTBuilder[A, ArrT]): ArrT

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.

def vertsMap[A, ArrT <: ArrImut[A]](f: Roord => A)(implicit build: ArrTBuilder[A, ArrT]): ArrT

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.

def width: Double
def yCen: Double

The centre of the grid by the y coordinate.

The centre of the grid by the y coordinate.

@inline
final def ySideMax: Int

The top Side Row of this TileGrid. The y value.

The top Side Row of this TileGrid. The y value.

@inline
final def ySideMin: Int

The bottom Side Row of this TileGrid. The y value.

The bottom Side Row of this TileGrid. The y value.

@inline
final def yVertMax: Int

The top Row of Tile vertices.

The top Row of Tile vertices.

@inline
final def yVertMin: Int

The bottom row of Tile vertices.

The bottom row of Tile vertices.

Concrete fields

final val numOfSides: Int

The number of Sides in the TileGrid.

The number of Sides in the TileGrid.

final val numOfVerts: Int

The number of tile vertices in the TileGrid.

The number of tile vertices in the TileGrid.