nsnake
Classic snake game for the terminal
Public Member Functions | Friends | List of all members
GameStateMainMenu Class Reference

The Main Menu. More...

#include <GameStateMainMenu.hpp>

Inheritance diagram for GameStateMainMenu:
Inheritance graph
[legend]
Collaboration diagram for GameStateMainMenu:
Collaboration graph
[legend]

Public Member Functions

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

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.

Member Function Documentation

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.

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.

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.


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