|
< index < 12. Field of view toolkit < 12.1 Building the map |
===================================== | > 12.3 Reading fov information |
C++ : void TCODMap::computeFov(int player_x, int player_y, int maxRadius=0) C : void TCOD_map_compute_fov(TCOD_map_t map, int player_x, int player_y, int max_radius)
| Parameter | Description |
|---|---|
| map | In the C version, the map handler returned by the TCOD_map_new function. |
| player_x,player_y | Position of the player in the map. 0 <= player_x < map width. 0 <= player_y < map height. |
| maxRadius | If > 0, the fov is only computed up to maxRadius cells away from the player. Else, the range is unlimited. |
C++ : TCODMap *map = new TCODMap(50,50); // allocate the map
map->setProperties(10,10,true,true); // set a cell as 'empty'
map->computeFov(10,10); // calculate fov from the cell 10x10 (unlimited range)
C : TCOD_map_t map = TCOD_map_new(50,50);
TCOD_map_set_properties(map,10,10,true,true);
TCOD_map_compute_fov(map,10,10,0);