TGrid

trait TGrid

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
trait HGrid
trait HGridIrr
class HGridReg
class SqGrid

Document{}

@inline
final
def bottomSideRow: Int

The bottom, lowest or minimum Side Row of this TileGrid. The r value, the row number value.

The bottom, lowest or minimum Side Row of this TileGrid. The r value, the row number value.

@inline
final
def numOfSideRows: Int

The number of Rows of Sides.

The number of Rows of Sides.

The line segments LineSegs for the sides of the tiles.

The line segments LineSegs for the sides of the tiles.

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(colour: Colour, lineWidth: Double): 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.

@inline
final
def topSideRow: Int

The top, highest or maximum Side Row of this TileGrid. The r value, the row number.

The top, highest or maximum Side Row of this TileGrid. The r value, the row number.

Value members

Abstract methods

def bottomTileRow: Int

The bottom or lowest tile centre row, r coordinate.

The bottom or lowest tile centre row, r coordinate.

def foreachCenCoord(f: TCoord => Unit): Unit

Foreach tile centre coordinate. A less strongly typed method than the foreach's in the sub traits.

Foreach tile centre coordinate. A less strongly typed method than the foreach's in the sub traits.

def height: Double

Height of the tile grid from furthest tile edge or vertex to furthest tile edge or vertex.

Height of the tile grid from furthest tile edge or vertex to furthest tile edge or vertex.

def numTileRows: Int

Number of rows of tile centres. 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 tile centres. 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 numTiles: Int

The total number of tile centres in this tile Grid.

The total number of tile centres in this tile Grid.

def tileColMax: Int

the Maximum or highest tile centre column c coordinate in the whole tile grid. This is called c rather than x because in hex grids HGrids there is not a 1 to 1 ratio from column coordinate to the x value in a Pt2.

the Maximum or highest tile centre column c coordinate in the whole tile grid. This is called c rather than x because in hex grids HGrids there is not a 1 to 1 ratio from column coordinate to the x value in a Pt2.

def tileColMin: Int

The minimum or lowest tile centre column c coordinate in the whole tile grid. This is called c rather than x because in hex grids HGrids there is not a 1 to 1 ratio from column coordinate to the x value in a Pt2.

The minimum or lowest tile centre column c coordinate in the whole tile grid. This is called c rather than x because in hex grids HGrids there is not a 1 to 1 ratio from column coordinate to the x value in a Pt2.

def topTileRow: Int

The top of highest tile centre row, r coordinate.

The top of highest tile centre row, r coordinate.

def width: Double

Width of the tile Grid from furthest tile edge to furthest tile edge.

Width of the tile Grid from furthest tile edge to furthest tile edge.

def xCen: Double
def xRatio: Double

Concrete methods

final
def flatMapRows[ArrT <: ArrBase[_]](f: Int => ArrT)(implicit build: ArrFlatBuilder[ArrT]): ArrT

flatMaps over each row number.

flatMaps over each row number.

final
def foldRows[B](init: B)(f: (B, Int) => B): B

foldLefts over each row number.

foldLefts over each row number.

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 mapCenCoords[B, BB <: ArrBase[B]](f: TCoord => B)(implicit build: ArrBuilder[B, BB]): BB
final
def mapRows[B, BB <: ArrBase[B]](f: Int => B)(implicit build: ArrBuilder[B, BB]): BB

maps over each row number.

maps over each row number.

@inline
final
def numOfVertRows: Int

The number of Rows of vertices.

The number of Rows of vertices.

Gives the text graphics for the row and column of each tile centre.

Gives the text graphics for the row and column of each tile centre.

@inline
final
def sideRowBottom: Int

The bottom or lowest tile side row, r coordinate.

The bottom or lowest tile side row, r coordinate.

@inline
def sideRowTop: Int

The top of highest tile side row, r coordinate.

The top of highest tile side row, r coordinate.

def yCen: Double