Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype TCODMap = TCODMap {}
- mapNew :: Int -> Int -> IO TCODMap
- mapClear :: TCODMap -> Bool -> Bool -> IO ()
- mapCopy :: TCODMap -> TCODMap -> IO ()
- mapSetProperties :: TCODMap -> Int -> Int -> Bool -> Bool -> IO ()
- mapDelete :: TCODMap -> IO ()
- mapComputeFov :: TCODMap -> Int -> Int -> Int -> Bool -> TCODFovAlgorithm -> IO ()
- mapIsInFov :: TCODMap -> Int -> Int -> IO Bool
- mapSetInFov :: TCODMap -> Int -> Int -> Bool -> IO ()
- mapIsTransparent :: TCODMap -> Int -> Int -> IO Bool
- mapIsWalkable :: TCODMap -> Int -> Int -> IO Bool
- mapGetWidth :: TCODMap -> IO Int
- mapGetHeight :: TCODMap -> IO Int
- mapGetNumberCells :: TCODMap -> IO Int
Documentation
Map reference for FOV algorithm
:: Int | width The size of the map (in map cells). |
-> Int | height The size of the map (in map cells). |
-> IO TCODMap |
Creating the map object
First, you have to allocate a map of the same size as your dungeon.
:: TCODMap | |
-> Bool | transparent Whether the cells should be transparent. |
-> Bool | walkable Whether the cells should be walkable. |
-> IO () |
Clearing the map
You can clear an existing map (setting all cells to the chosen walkable/transparent values)
Copy a map to another, reallocating it when needed
:: TCODMap | map |
-> Int | x Coordinate of the cell that we want to update. |
-> Int | y Coordinate of the cell that we want to update. |
-> Bool | is transparent If true, this cell will let the light pass else it will block the light. |
-> Bool | is walkable If true, creatures can walk true this cell (it is not a wall). |
-> IO () |
Defining the cell properties
Then, build your dungeon by defining which cells let the light pass (by default, all cells block the light) and which cells are walkable (by default, all cells are not-walkable).
:: TCODMap | map |
-> Int | player x. Position of the player in the map. |
-> Int | player y. Position of the player in the map. |
-> Int | max radius. If > 0, the fov is only computed up to maxRadius cells away from the player. Else, the range is unlimited. |
-> Bool | light walls. Whether the wall cells near ground cells in fov must be in fov too. |
-> TCODFovAlgorithm | FOV algorithm to use. |
-> IO () |
Computing the field of view
Once your map is allocated and empty cells have been defined, you can calculate the field of view
Check if a cell is in the last computed field of view