nsnake
Classic snake game for the terminal
Loading...
Searching...
No Matches
GameStateMainMenu Class Reference

The Main Menu. More...

#include <GameStateMainMenu.hpp>

Inheritance diagram for GameStateMainMenu:
Collaboration diagram for GameStateMainMenu:

Public Member Functions

void load (int stack=0)
 Where every state initializes it's resources.
 
int unload ()
 Gets called when we're leaving this menu.
 
GameState::StateCode update ()
 Called every frame, where states calculate everything that can change.
 
void draw ()
 Called every frame, where states draw stuff on screen.
 
- Public Member Functions inherited from GameState

Friends

class LayoutMainMenu
 

Additional Inherited Members

- Public Types inherited from GameState
enum  StateCode {
  QUIT , CONTINUE , MAIN_MENU , GAME_START ,
  GAME_OVER
}
 All possible transitions between states. More...
 

Detailed Description

The Main Menu.

Definition at line 12 of file GameStateMainMenu.hpp.

Constructor & Destructor Documentation

◆ GameStateMainMenu()

GameStateMainMenu::GameStateMainMenu ( )

Definition at line 57 of file GameStateMainMenu.cpp.

◆ ~GameStateMainMenu()

virtual GameStateMainMenu::~GameStateMainMenu ( )
inlinevirtual

Definition at line 18 of file GameStateMainMenu.hpp.

Member Function Documentation

◆ draw()

void GameStateMainMenu::draw ( )
virtual

Called every frame, where states draw stuff on screen.

Implements GameState.

Definition at line 320 of file GameStateMainMenu.cpp.

◆ load()

void GameStateMainMenu::load ( int stack = 0)
virtual

Where every state initializes it's resources.

The stack is the previous state's returned value from unload(), allowing a state to communicate with the next one.

Implements GameState.

Definition at line 71 of file GameStateMainMenu.cpp.

◆ unload()

int GameStateMainMenu::unload ( )
virtual

Gets called when we're leaving this menu.

It saves all the menu settings (for example, game speed, board size, and such)

Implements GameState.

Definition at line 86 of file GameStateMainMenu.cpp.

◆ update()

GameState::StateCode GameStateMainMenu::update ( )
virtual

Called every frame, where states calculate everything that can change.

The returned value will be checked by the StateManager to see if we must change the current state - if so, which one should we go next.

Implements GameState.

Definition at line 101 of file GameStateMainMenu.cpp.

Friends And Related Symbol Documentation

◆ LayoutMainMenu

friend class LayoutMainMenu
friend

Definition at line 14 of file GameStateMainMenu.hpp.


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