License | BSD-3-Clause |
---|---|
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
World coordinates.
Synopsis
- newtype Coords = Coords {}
- locToCoords :: Location -> Coords
- coordsToLoc :: Coords -> Location
- type BoundsRectangle = (Coords, Coords)
Documentation
World coordinates use (row,column)
format, with the row
increasing as we move down the screen. We use this format for
indexing worlds internally, since it plays nicely with things
like drawing the screen, and reading maps from configuration
files. The locToCoords
and coordsToLoc
functions convert back
and forth between this type and Location
, which is used when
presenting coordinates externally to the player.
Instances
Generic Coords Source # | |
Ix Coords Source # | |
Show Coords Source # | |
Eq Coords Source # | |
Ord Coords Source # | |
Wrapped Coords Source # | |
Rewrapped Coords t Source # | |
Defined in Swarm.Game.World.Coords | |
type Rep Coords Source # | |
Defined in Swarm.Game.World.Coords | |
type Unwrapped Coords Source # | |
Defined in Swarm.Game.World.Coords |
locToCoords :: Location -> Coords Source #
Convert an external (x,y)
location to an internal Coords
value.
coordsToLoc :: Coords -> Location Source #
Convert an internal Coords
value to an external (x,y)
location.
type BoundsRectangle = (Coords, Coords) Source #
Represents the top-left and bottom-right coordinates of a bounding rectangle of cells in the world map