ostrat.prid

package ostrat.prid

The tile grid package, replacing the old pGrid package. This package works with hexagonal and Square tile grids. There are separate class for the different types of Coordinates HCen, SqCen, HSide, etc. The tile objects themselves will not in the general case the contain grid coordinates, although it may be necessary to include this data for complex tile values interacting with their wider environment. Its fundamental components are the grid data itself. This is just a linear array of tile data. Compile-time typed grid data. So for example a chess board can be represented by a 64 element Arr, its context determines that it is to be interpreted as an 8 by 8 square grid. Grid descriptions that describe the grid representation in the Array and GridFunctions which implement Cood to T. The grid and grid-gui hierarchies currently contain a mix of new and old systems.

The package name prid, short for package grid, was chosen to allow you to use the name "grid" in your code.

Type members

Classlikes

implicit implicit class GridSlateScaleExtension[T](value: T)(implicit grid: TGrid, evSlate: Slate[T], evScale: Scale[T])

The state of a simultaneous turn tile grid scenario.

The state of a simultaneous turn tile grid scenario.

abstract class HexMapGui(title: String) extends TileMapGui
abstract class SquareMapGui(title: String) extends TileMapGui
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 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.

trait TileArrOpt[A <: AnyRef]
trait TileCen extends TileCenOrSide

A tile centre coordinate.

A tile centre coordinate.

trait TileCenArr[A <: AnyRef]

An Array of tile centre data of type A. An appropriate SqGrid or HGrid is required to utilise its functionality.

An Array of tile centre data of type A. An appropriate SqGrid or HGrid is required to utilise its functionality.

trait TileCenOrSide extends TileCoord

A tile centre or a tile side coordinate.

A tile centre or a tile side coordinate.

trait TileCoord extends ShowElemInt2

A coordinate in a tile grid TGrid. The row is the first field, the column is the second.

A coordinate in a tile grid TGrid. The row is the first field, the column is the second.

Companion:
object
object TileCoord

Companion object for TileCoord trait will contain a Show[TCoord] implicit instance in Scala 3, but this produces an error in 2.13.5.

Companion object for TileCoord trait will contain a Show[TCoord] implicit instance in Scala 3, but this produces an error in 2.13.5.

Companion:
class
abstract class TileMapGui(title: String) extends CmdBarGui
trait TileSide extends TileCenOrSide

A tile side coordinate.

A tile side coordinate.

trait TileStep

A tile step, move or addition, or no move.

A tile step, move or addition, or no move.

trait TileVert extends TileCoord

A tile vertex coordinate.

A tile vertex coordinate.

Implicits

Implicits

final implicit def GridSlateScaleExtension[T](value: T)(implicit grid: TGrid, evSlate: Slate[T], evScale: Scale[T]): GridSlateScaleExtension[T]