| License | BSD-3-Clause |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Swarm.Game.Scenario.Topography.Area
Description
Synopsis
- data AreaDimensions = AreaDimensions {
- rectWidth :: Int32
- rectHeight :: Int32
- renderRectDimensions :: AreaDimensions -> String
- invertY :: V2 Int32 -> V2 Int32
- upperLeftToBottomRight :: AreaDimensions -> Location -> Location
- cornersToArea :: Location -> Location -> AreaDimensions
- isEmpty :: AreaDimensions -> Bool
- getAreaDimensions :: [[a]] -> AreaDimensions
Documentation
data AreaDimensions Source #
Height and width of a 2D map region
Constructors
| AreaDimensions | |
Fields
| |
upperLeftToBottomRight :: AreaDimensions -> Location -> Location Source #
Incorporates an offset by -1, since the area is
"inclusive" of the lower-right coordinate.
Inverse of cornersToArea.
cornersToArea :: Location -> Location -> AreaDimensions Source #
Converts the displacement vector between the two
diagonal corners of the rectangle into an AreaDimensions record.
Adds one to both dimensions since the corner coordinates are "inclusive".
Inverse of upperLeftToBottomRight.
isEmpty :: AreaDimensions -> Bool Source #
Has zero width or height.
getAreaDimensions :: [[a]] -> AreaDimensions Source #
Extracts the dimensions of a map grid.