LambdaHack-0.2.1: A roguelike game engine in early and very active development

Safe HaskellSafe-Infered

Game.LambdaHack.Area

Description

Rectangular areas of levels and their basic operations.

Synopsis

Documentation

type Area = (X, Y, X, Y)Source

The type of areas. The bottom left and the top right points.

vicinityXYSource

Arguments

:: Area

limit the search to this area

-> PointXY

location to find neighbours of

-> [PointXY] 

All (8 at most) closest neighbours of a point within an area.

vicinityCardinalXYSource

Arguments

:: Area

limit the search to this area

-> PointXY

location to find neighbours of

-> [PointXY] 

All (4 at most) cardinal direction neighbours of a point within an area.

insideXY :: PointXY -> Area -> BoolSource

Checks that a point belongs to an area.

normalizeArea :: Area -> AreaSource

Sort the corners of an area so that the bottom left is the first point.

grid :: (X, Y) -> Area -> [(PointXY, Area)]Source

Divide uniformly a larger area into the given number of smaller areas.

validArea :: Area -> BoolSource

Checks if it's an area with at least one field.

trivialArea :: Area -> BoolSource

Checks if it's an area with exactly one field.

expand :: Area -> Int -> AreaSource

Enlarge (or shrink) the given area on all fours sides by the amount.