LudoGeometry

class LudoGeometry(val center: Offset, side: Float)

Where everything sits on the board, in pixels, for a square of side side centred in the canvas. Shared by drawing and tap handling so they always agree.

Constructors

Link copied to clipboard
constructor(center: Offset, side: Float)

Properties

Link copied to clipboard
val cell: Float

Grid cell size: the 15-cell cross fits inside the frame's lobes.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun animated(color: LudoColor, progress: Float, pawn: Int): Pair<Offset, Float>

Position for a pawn at a fractional progress while it animates, with a hop between squares. Returns the point and how high it is (0..1) for the shadow.

Link copied to clipboard
fun baseSlot(color: LudoColor, i: Int): Offset

The four base holes: above, right, below and left of the rosette centre.

Link copied to clipboard
fun cellCenter(c: Int, r: Int): Offset
Link copied to clipboard
fun homeSlot(color: LudoColor, i: Int): Offset

Finished pawns gather just inside the centre, on their own colour's side.

Link copied to clipboard
fun rosette(color: LudoColor): Offset

Centre of each colour's rosette base, in the quadrant between its arms (blue TL, red TR, green BR, yellow BL).

Link copied to clipboard
fun spot(color: LudoColor, progress: Int, pawn: Int): Offset