|
header_utils
|
Container for, and operations on, a 2D grid. More...
Classes | |
| struct | ghassanpl::geometry::squares::grid< TILE_DATA, RESIZABLE > |
| A container for squares in a 2D square grid. More... | |
| template<typename TILE_DATA, bool RESIZABLE, typename FUNC> | |
| void | ghassanpl::geometry::squares::apply_cellular_automata (grid< TILE_DATA, RESIZABLE > ¤t_iteration, irec2 const &rect, FUNC &&func) |
| Applies a cellular automata generation function on (a region of) the grid. | |
| template<typename TILE_DATA, bool RESIZABLE, typename FUNC> | |
| void | ghassanpl::geometry::squares::apply_cellular_automata (grid< TILE_DATA, RESIZABLE > ¤t_iteration, FUNC &&func) |
| Applies a cellular automata generation function on (a region of) the grid. | |
| template<typename TILE_DATA, bool RESIZABLE, typename FUNC> | |
| void | ghassanpl::geometry::squares::apply_cellular_automata (grid< TILE_DATA, RESIZABLE > const ¤t_iteration, grid< TILE_DATA, RESIZABLE > &new_iteration, irec2 const &rect, FUNC &&func) |
| TODO: This. | |
| template<typename TILE_DATA, bool RESIZABLE, change_tile_callback< TILE_DATA > REPLACE_FUNC, query_tile_callback< TILE_DATA > SHOULD_FLOOD_FUNC> | |
| void | ghassanpl::geometry::squares::flood_at (grid< TILE_DATA, RESIZABLE > &grid, glm::ivec2 start, REPLACE_FUNC &&replace, SHOULD_FLOOD_FUNC &&should_flood) |
| Performs a flood-fill algorithm on grid. | |
| template<typename TILE_DATA, bool RESIZABLE, change_tile_callback< TILE_DATA > REPLACE_FUNC> | |
| void | ghassanpl::geometry::squares::flood_at (grid< TILE_DATA, RESIZABLE > &grid, glm::ivec2 start, REPLACE_FUNC &&replace) |
| Performs a flood-fill algorithm on grid. | |
| template<typename TILE_DATA, bool RESIZABLE, query_tile_callback< TILE_DATA > SHOULD_FLOOD_FUNC> | |
| void | ghassanpl::geometry::squares::flood_at (grid< TILE_DATA, RESIZABLE > &grid, glm::ivec2 start, TILE_DATA const &replace_with, SHOULD_FLOOD_FUNC &&should_flood) |
| Performs a flood-fill algorithm on grid. | |
| template<typename TILE_DATA, bool RESIZABLE> | |
| void | ghassanpl::geometry::squares::flood_at (grid< TILE_DATA, RESIZABLE > &grid, glm::ivec2 start, TILE_DATA const &replace_with) |
| Performs a flood-fill algorithm on grid. | |
Container for, and operations on, a 2D grid.
| void ghassanpl::geometry::squares::apply_cellular_automata | ( | grid< TILE_DATA, RESIZABLE > & | current_iteration, |
| FUNC && | func ) |
Applies a cellular automata generation function on (a region of) the grid.
Note that since cellular automata operations are done on an immutable grid, this function creates a copy of the entire grid as the next generation, modifies it, and then swaps it with the current generation grid. Any iterators to the current (old) grid will therefore be invalidated and its data destroyed.
Definition at line 55 of file square_grid_algorithms.h.
| void ghassanpl::geometry::squares::apply_cellular_automata | ( | grid< TILE_DATA, RESIZABLE > & | current_iteration, |
| irec2 const & | rect, | ||
| FUNC && | func ) |
Applies a cellular automata generation function on (a region of) the grid.
Note that since cellular automata operations are done on an immutable grid, this function creates a copy of the entire grid as the next generation, modifies it, and then swaps it with the current generation grid. Any iterators to the current (old) grid will therefore be invalidated and its data destroyed.
Definition at line 20 of file square_grid_algorithms.h.
| void ghassanpl::geometry::squares::flood_at | ( | grid< TILE_DATA, RESIZABLE > & | grid, |
| glm::ivec2 | start, | ||
| REPLACE_FUNC && | replace ) |
Performs a flood-fill algorithm on grid.
Whether a tile should be flooded will depend on if it compares equal to a copy of the tile at start
| start | where to start flooding |
| replace | will be called on each tile that needs to be flooded, to change it |
Definition at line 145 of file square_grid_algorithms.h.
| void ghassanpl::geometry::squares::flood_at | ( | grid< TILE_DATA, RESIZABLE > & | grid, |
| glm::ivec2 | start, | ||
| REPLACE_FUNC && | replace, | ||
| SHOULD_FLOOD_FUNC && | should_flood ) |
Performs a flood-fill algorithm on grid.
| start | where to start flooding; should_flood(start) should be true before replace(start), and false afterwards |
| replace | will be called on each tile that needs to be flooded, to change it; after replace(pos), should_flood(pos) should always be false |
| should_flood | queries whether the given tile should be flooded |
Definition at line 69 of file square_grid_algorithms.h.
| void ghassanpl::geometry::squares::flood_at | ( | grid< TILE_DATA, RESIZABLE > & | grid, |
| glm::ivec2 | start, | ||
| TILE_DATA const & | replace_with ) |
Performs a flood-fill algorithm on grid.
Whether a tile should be flooded will depend on if it compares equal to a copy of the tile at start
| start | where to start flooding |
| replace_with | the tile data to set on each square that should be flooded |
Definition at line 168 of file square_grid_algorithms.h.
| void ghassanpl::geometry::squares::flood_at | ( | grid< TILE_DATA, RESIZABLE > & | grid, |
| glm::ivec2 | start, | ||
| TILE_DATA const & | replace_with, | ||
| SHOULD_FLOOD_FUNC && | should_flood ) |
Performs a flood-fill algorithm on grid.
| start | where to start flooding; should_flood(start) should be true before *grid.at(start) = replace_with, and false afterwards |
| replace_with | the tile data to set on each square that should be flooded |
| should_flood | queries whether the given tile should be flooded |
Definition at line 157 of file square_grid_algorithms.h.