swarm-0.5.0.0: 2D resource gathering game with programmable robots
LicenseBSD-3-Clause
Safe HaskellSafe-Inferred
LanguageHaskell2010

Swarm.Game.World.Coords

Description

World coordinates.

Synopsis

Documentation

newtype Coords Source #

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.

Constructors

Coords 

Fields

Instances

Instances details
Generic Coords Source # 
Instance details

Defined in Swarm.Game.World.Coords

Associated Types

type Rep Coords :: Type -> Type #

Methods

from :: Coords -> Rep Coords x #

to :: Rep Coords x -> Coords #

Ix Coords Source # 
Instance details

Defined in Swarm.Game.World.Coords

Show Coords Source # 
Instance details

Defined in Swarm.Game.World.Coords

Eq Coords Source # 
Instance details

Defined in Swarm.Game.World.Coords

Methods

(==) :: Coords -> Coords -> Bool #

(/=) :: Coords -> Coords -> Bool #

Ord Coords Source # 
Instance details

Defined in Swarm.Game.World.Coords

Wrapped Coords Source # 
Instance details

Defined in Swarm.Game.World.Coords

Associated Types

type Unwrapped Coords #

Rewrapped Coords t Source # 
Instance details

Defined in Swarm.Game.World.Coords

type Rep Coords Source # 
Instance details

Defined in Swarm.Game.World.Coords

type Rep Coords = D1 ('MetaData "Coords" "Swarm.Game.World.Coords" "swarm-0.5.0.0-6qXEbhCmuXA4wRndqqhBu" 'True) (C1 ('MetaCons "Coords" 'PrefixI 'True) (S1 ('MetaSel ('Just "unCoords") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Int32, Int32))))
type Unwrapped Coords Source # 
Instance details

Defined in Swarm.Game.World.Coords

type Unwrapped Coords = GUnwrapped (Rep 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