tcod-haskell-0.1.0.0: Bindings to libtcod roguelike engine

Safe HaskellNone
LanguageHaskell2010

Game.TCOD.Fov

Synopsis

Documentation

newtype TCODMap Source #

Map reference for FOV algorithm

Constructors

TCODMap 

Fields

Instances

Eq TCODMap Source # 

Methods

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

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

Ord TCODMap Source # 
Show TCODMap Source # 
Generic TCODMap Source # 

Associated Types

type Rep TCODMap :: * -> * #

Methods

from :: TCODMap -> Rep TCODMap x #

to :: Rep TCODMap x -> TCODMap #

type Rep TCODMap Source # 
type Rep TCODMap = D1 (MetaData "TCODMap" "Game.TCOD.Fov" "tcod-haskell-0.1.0.0-9JdFGODCf32GFoGmrQ4wdi" True) (C1 (MetaCons "TCODMap" PrefixI True) (S1 (MetaSel (Just Symbol "unTCODMap") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Ptr ()))))

mapNew Source #

Arguments

:: 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.

mapClear Source #

Arguments

:: 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)

mapCopy Source #

Arguments

:: TCODMap

source

-> TCODMap

destination

-> IO () 

Copy a map to another, reallocating it when needed

mapSetProperties Source #

Arguments

:: 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).

mapDelete :: TCODMap -> IO () Source #

Destroy a map

mapComputeFov Source #

Arguments

:: 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

mapIsInFov Source #

Arguments

:: TCODMap 
-> Int

x

-> Int

y

-> IO Bool 

Check if a cell is in the last computed field of view

mapSetInFov Source #

Arguments

:: TCODMap 
-> Int

x

-> Int

y

-> Bool

fov

-> IO () 

Manually setting a cell in fov

mapIsTransparent Source #

Arguments

:: TCODMap 
-> Int

x

-> Int

y

-> IO Bool 

Getting transparency flag for cell

mapIsWalkable Source #

Arguments

:: TCODMap 
-> Int

x

-> Int

y

-> IO Bool 

Getting walkability flag for cell

mapGetWidth :: TCODMap -> IO Int Source #

Getting width of the map

mapGetHeight :: TCODMap -> IO Int Source #

Getting height of the map

mapGetNumberCells :: TCODMap -> IO Int Source #

Getting number of cells of the map