Snake.
More...
#include <snake.h>
|
struct | BodyPart |
| Instance of a part of the body of the snake. More...
|
|
struct | Food |
| Instance of the egg which will be eat by the snake. More...
|
|
|
void | on_button_Play_clicked () |
| Starts the game.
|
|
void | processGameLogic () |
| Processes the logic of the game.
|
|
|
void | keyPressEvent (QKeyEvent *event) override |
| Stores the valid key events in a queue. More...
|
|
void | processNextKeyEvent () |
| Processes the key events in the queue. More...
|
|
const bool | snakeInTile (const unsigned int &x, const unsigned int &y) |
| Checks whether is there a part of the snake in the given position.
|
|
void | increaseSnakeBody (const bool &initial=false) |
| Increases the length of the body of the snake of 1 part.
|
|
void | updateSnakePosition (const bool &dry=false) |
| Update the position and direction of the entire snake.
|
|
void | checkCollision () |
| Checks if the head will collide with another entity.
|
|
void | spawnFood () |
| Spawns the egg in a new position.
|
|
void | increaseGameScore () |
| Increases the player's score by one.
|
|
|
std::queue< unsigned short > | key_events |
| Stores the key events.
|
|
const unsigned int | MAX_SNAKE_LENGTH = 64 |
| The maximum length of the snake.
|
|
std::vector< BodyPart > | snake |
| The snake.
|
|
Snake.
A reproduction of the timeless classic game
◆ Direction
Enumerates the possible directions.
Enumerator |
---|
UP | Up.
|
DOWN | Down.
|
LEFT | Left.
|
RIGHT | Right.
|
◆ keyPressEvent()
void Snake::keyPressEvent |
( |
QKeyEvent * |
event | ) |
|
|
overrideprivate |
◆ processNextKeyEvent()
void Snake::processNextKeyEvent |
( |
| ) |
|
|
private |
The documentation for this class was generated from the following files:
- logdoctor/games/snake.h
- logdoctor/games/snake.cpp