Orasund/elm-game-essentials/2.1.0

NOTE: the latest version is 3.0.0

Position

add :
{ x : Int
, y : Int
}
-> ( Int, Int )
-> ( Int, Int )

Add coordinates to a position

(2,3)
|> add { x = 1, y = 0}
--> (3,3)
( Int, Int )
-> { x : Int
, y : Int
}
-> ( Int, Int )

Add coordinates to a position

{ x = 1, y = 0 }
|> addTo (2,3)
--> (3,3)
( Int, Int )
-> ( Int, Int )
-> { x : Int
, y : Int
}

Create the coordinates to the new location using the current position as the center.

(1,1)
|> coordTo (1,2)
--> { x = 0, y = 1 }
{ columns : Int
, rows : Int
}
-> Generator ( Int, Int )

Generate a position inside a grid.

{ columns : Int
, rows : Int
}
-> ( Int, Int )
-> ( Float, Float )

given the width and height in in Int, returns a point with values in (-1,1)