|
|
void | initWalls () |
| |
|
void | updateInternal (const Position &position, CellType cellType) |
| |
|
void | freeCellsByType (CellType cellType) |
| |
|
FORCEINLINE uint32 | posToIndex (uint32 x, uint32 y) const |
| |
|
FORCEINLINE uint32 | posToIndex (const Position &position) const |
| |
◆ center()
| static Position SnakeGame::Grid::center |
( |
uint32 |
width, |
|
|
uint32 |
height |
|
) |
| |
|
inlinestatic |
Returns center position in grid (walls included)
- Parameters
-
- Returns
- Position center of grid
◆ dim()
| Dim SnakeGame::Grid::dim |
( |
| ) |
const |
|
inline |
Returns grid dimensions including walls (width + 2; height + 2)
- Returns
- Dim grid dimensions
◆ hitTest()
| bool Grid::hitTest |
( |
const Position & |
position, |
|
|
CellType |
cellType |
|
) |
| const |
Checks cell type in the given position
- Parameters
-
| position | position on the grid |
| cellType | type of the cell |
- Returns
- bool if hit test was successfull
◆ randomEmptyPosition()
| bool Grid::randomEmptyPosition |
( |
Position & |
position | ) |
const |
Returns empty position by ref
- Parameters
-
- Returns
- bool true if empty position exists (if position doesn't exist then snake body fills whole grid)
◆ update() [1/2]
| void Grid::update |
( |
const Position & |
position, |
|
|
CellType |
cellType |
|
) |
| |
Update cell with a given cell type
- Parameters
-
| position | position on the grid to be updated |
| cellType | type of the cell |
◆ update() [2/2]
| void Grid::update |
( |
const TPositionPtr * |
links, |
|
|
CellType |
cellType |
|
) |
| |
Update cells with a given cell type
- Parameters
-
| links | pointer to the position link |
| cellType | type of the cell |
◆ m_indByType
| TMap<CellType, TArray<uint32> > SnakeGame::Grid::m_indByType |
|
private |
Initial value:= {
{CellType::Snake, {}},
{CellType::Wall, {}},
{CellType::Food, {}},
}
The documentation for this class was generated from the following files:
- Source/SnakeGame/Core/Grid.h
- Source/SnakeGame/Core/Grid.cpp