Table of Contents

Class CairoGrid<TCell>

Namespace
Gamelogic.Grids
Assembly
Assembly-CSharp.dll

A CiaroGrid is a grid where all the cells are pentagons (so each cell has five neighbors). See http://en.wikipedia.org/wiki/Cairo_pentagonal_tiling.

[Version(1, 2, 0)]
public class CairoGrid<TCell> : AbstractSplicedGrid<TCell, CairoPoint, PointyHexPoint>, IGrid<TCell, CairoPoint>, IGrid<CairoPoint>, IGridSpace<CairoPoint>, IEnumerable<CairoPoint>, IEnumerable

Type Parameters

TCell
Inheritance
CairoGrid<TCell>
Implements
Inherited Members
Extension Methods

Constructors

CairoGrid(int, int)

Construct a new grid in the default shape with the given width and height. No transformations are applied to the grid.

Normally, the static factory methods or shape building methods should be used to create grids. These constructors are provided for advanced usage.

public CairoGrid(int width, int height)

Parameters

width int
height int

CairoGrid(int, int, Func<CairoPoint, bool>)

Construct a new grid whose cells are determined by the given test function.

The test function should only return true for points within the bounds of the default shape.

No transformations are applied to the grid.

Normally, the static factory methods or shape building methods should be used to create grids. These constructors are provided for advanced usage.

public CairoGrid(int width, int height, Func<CairoPoint, bool> isInside)

Parameters

width int
height int
isInside Func<CairoPoint, bool>

CairoGrid(int, int, Func<CairoPoint, bool>, CairoPoint)

Construct a new grid whose cells are determined by the given test function.

The function should only return true for points within the bounds of the rectangle when the given transforms are applied to them.

Normally, the static factory methods or shape building methods should be used to create grids. These constructors are provided for advanced usage.

public CairoGrid(int width, int height, Func<CairoPoint, bool> isInside, CairoPoint offset)

Parameters

width int
height int
isInside Func<CairoPoint, bool>
offset CairoPoint

CairoGrid(int, int, Func<CairoPoint, bool>, PointyHexPoint)

public CairoGrid(int width, int height, Func<CairoPoint, bool> isInside, PointyHexPoint offset)

Parameters

width int
height int
isInside Func<CairoPoint, bool>
offset PointyHexPoint

CairoGrid(int, int, Func<CairoPoint, bool>, Func<CairoPoint, CairoPoint>, Func<CairoPoint, CairoPoint>)

public CairoGrid(int width, int height, Func<CairoPoint, bool> isInside, Func<CairoPoint, CairoPoint> gridPointTransform, Func<CairoPoint, CairoPoint> inverseGridPointTransform)

Parameters

width int
height int
isInside Func<CairoPoint, bool>
gridPointTransform Func<CairoPoint, CairoPoint>
inverseGridPointTransform Func<CairoPoint, CairoPoint>

CairoGrid(int, int, Func<CairoPoint, bool>, Func<CairoPoint, CairoPoint>, Func<CairoPoint, CairoPoint>, IEnumerable<CairoPoint>[])

public CairoGrid(int width, int height, Func<CairoPoint, bool> isInside, Func<CairoPoint, CairoPoint> gridPointTransform, Func<CairoPoint, CairoPoint> inverseGridPointTransform, IEnumerable<CairoPoint>[] neighborDirections)

Parameters

width int
height int
isInside Func<CairoPoint, bool>
gridPointTransform Func<CairoPoint, CairoPoint>
inverseGridPointTransform Func<CairoPoint, CairoPoint>
neighborDirections IEnumerable<CairoPoint>[]

Properties

GridOrigin

Gives the Zero point as transform by this grids transforms.

protected override CairoPoint GridOrigin { get; }

Property Value

CairoPoint

Methods

ArrayPointFromGridPoint(PointyHexPoint)

public static ArrayPoint ArrayPointFromGridPoint(PointyHexPoint point)

Parameters

point PointyHexPoint

Returns

ArrayPoint

BeginShape()

Use this method to begin a shape building sequence.

public static CairoOp<TCell> BeginShape()

Returns

CairoOp<TCell>

CalculateStorage(IEnumerable<CairoPoint>)

public static IntRect CalculateStorage(IEnumerable<CairoPoint> points)

Parameters

points IEnumerable<CairoPoint>

Returns

IntRect

CloneStructure<TNewCellType>()

Returns a grid in the same shape, but with contents in the new type.

public override IGrid<TNewCellType, CairoPoint> CloneStructure<TNewCellType>()

Returns

IGrid<TNewCellType, CairoPoint>

Type Parameters

TNewCellType

Default(int, int)

public static CairoGrid<TCell> Default(int width, int height)

Parameters

width int
height int

Returns

CairoGrid<TCell>

DefaultContains(CairoPoint, int, int)

public static bool DefaultContains(CairoPoint point, int width, int height)

Parameters

point CairoPoint
width int
height int

Returns

bool

FatRectangle(int, int)

public static CairoGrid<TCell> FatRectangle(int width, int height)

Parameters

width int
height int

Returns

CairoGrid<TCell>

GridPointFromArrayPoint(ArrayPoint)

public static PointyHexPoint GridPointFromArrayPoint(ArrayPoint point)

Parameters

point ArrayPoint

Returns

PointyHexPoint

Hexagon(int)

public static CairoGrid<TCell> Hexagon(int side)

Parameters

side int

Returns

CairoGrid<TCell>

MakePoint(PointyHexPoint, int)

protected override CairoPoint MakePoint(PointyHexPoint basePoint, int index)

Parameters

basePoint PointyHexPoint
index int

Returns

CairoPoint

MakeUnderlyingGrid(int, int)

protected override IGrid<TCell[], PointyHexPoint> MakeUnderlyingGrid(int width, int height)

Parameters

width int
height int

Returns

IGrid<TCell[], PointyHexPoint>

Parallelogram(int, int)

public static CairoGrid<TCell> Parallelogram(int width, int height)

Parameters

width int
height int

Returns

CairoGrid<TCell>

Rectangle(int, int)

public static CairoGrid<TCell> Rectangle(int width, int height)

Parameters

width int
height int

Returns

CairoGrid<TCell>

Single()

public static CairoGrid<TCell> Single()

Returns

CairoGrid<TCell>

SingleGroup()

public static CairoGrid<TCell> SingleGroup()

Returns

CairoGrid<TCell>

ThinRectangle(int, int)

public static CairoGrid<TCell> ThinRectangle(int width, int height)

Parameters

width int
height int

Returns

CairoGrid<TCell>

ToString()

public override string ToString()

Returns

string