| LogDoctor 4.00 Parse Apache2/Nginx/IIS logs and view dinamically generated statistics

Loading...
Searching...
No Matches
Private Types | Private Slots | Private Member Functions | Private Attributes | List of all members
SnakeGame Class Referencefinal

Snake. More...

`#include <game.h>`

Inheritance diagram for SnakeGame:

## Private Types
enum class | GameMode { Classic , Hunt , Battle }
| Enumerates the available game modes. More...

## Private Slots
void | processGameLogic ()
| Processes the logic of the game.

## Private Member Functions
void | keyPressEvent (QKeyEvent *event) noexcept override
| Stores the valid key events in a queue.
void | processNextKeyEvent () noexcept
| Processes the key events in the queue.
void | checkCollision (Snake &snake, Snake &adv_snake, const bool is_adv)
| Checks if a snake will collide with another entity.
void | updateGameScore ()
| Increases/Decreases the player's score by one.

## Private Attributes
std::queue< Direction > | key_events
| Stores the key events.
const size_t | MAX_SNAKE_LENGTH { 64 }
| The maximum length of the snake.
Snake | snake
| The snake.
Food | food
| Instance of the egg/rat which will be eat by the snake.

## Detailed Description

Snake.

A reproduction of the timeless classic game

## Member Enumeration Documentation

## ◆ GameMode

enum class SnakeGame::GameMode
| strong private

Enumerates the available game modes.

Enumerator
Classic | Classic snake game.
Hunt | Game variant in which the food moves too.
Battle | Game variant in which you play against another snake.

## Member Function Documentation

## ◆ keyPressEvent()

void SnakeGame::keyPressEvent | ( | QKeyEvent * | event | ) |
| override private noexcept

Stores the valid key events in a queue.

Valid keys are UP/DOWN/LEFT/RIGHT arrows and W/S/A/D letters

See also
  key_events, processNextKeyEvent()

## ◆ processNextKeyEvent()

void SnakeGame::processNextKeyEvent | ( |  | ) |
| private noexcept

Processes the key events in the queue.

See also
  key_events, keyPressEvent()

The documentation for this class was generated from the following files:

- logdoctor/games/snake/game.h
- logdoctor/games/snake/game.cpp