Building Game Engines
Menu Class Reference

This class display the menu page of this game. More...

#include <Menu.h>

Inheritance diagram for Menu:
Inheritance graph
Collaboration diagram for Menu:
Collaboration graph

Public Member Functions

 Menu ()=default
 Default constructor. More...
 
void Render (SDL_Renderer *ren) override
 Render the menu page to the active viewport. More...
 
void processInput (SDL_Event e) override
 Process user input. More...
 
void Update (int x, int y, int *params) override
 Update the position of arrows in the menu page. More...
 
void setMenuOption (MENU_OPTION newOp)
 set the menu option More...
 
MENU_OPTION getMenuOption ()
 get the menu option More...
 
- Public Member Functions inherited from GameObject
 GameObject ()
 Constructor. More...
 
 ~GameObject ()
 Destructor. More...
 
void removeComponent (std::string key)
 Remove a component in this gameobject. More...
 
void addComponent (std::string key, Component *component)
 Add a component in this gameobject. More...
 
ComponentgetComponent (std::string key)
 Get an reference of a component. More...
 
void setActive (bool newState)
 activate / deactivate game object. inactive object won't be updated and rendered More...
 
bool isActive ()
 Get the state of the game. More...
 
int getID ()
 Get the unique id of the gameobject. More...
 

Additional Inherited Members

- Static Public Attributes inherited from GameObject
static int idCounter = 0
 
- Protected Attributes inherited from GameObject
std::map< std::string, Component * > m_components
 Store all the game components in a map. More...
 
bool objState
 deactivated objects won't get updated/rendered More...
 
int id
 the unique id More...
 

Detailed Description

This class display the menu page of this game.

Constructor & Destructor Documentation

◆ Menu()

Menu::Menu ( )
default

Default constructor.

Member Function Documentation

◆ getMenuOption()

MENU_OPTION Menu::getMenuOption ( )
inline

get the menu option

◆ processInput()

void Menu::processInput ( SDL_Event  e)
overridevirtual

Process user input.

Parameters
eA SDL_Event that contains structures for the different event types.

Reimplemented from GameObject.

◆ Render()

void Menu::Render ( SDL_Renderer *  ren)
overridevirtual

Render the menu page to the active viewport.

Parameters
renReference to SDL renderer.

Reimplemented from GameObject.

◆ setMenuOption()

void Menu::setMenuOption ( MENU_OPTION  newOp)
inline

set the menu option

◆ Update()

void Menu::Update ( int  x,
int  y,
int *  params 
)
overridevirtual

Update the position of arrows in the menu page.

Parameters
xThe x location of something.
yThe x location of something.
paramsAn int array stores additional data.

Reimplemented from GameObject.