Terminal Games
Simple games that run in the terminal.
Loading...
Searching...
No Matches
TerminalGames::MainMenu Class Reference

Orchestration class which runs the homepage and the main menu pages which allow for games to be ran. More...

#include "MainMenu.hpp"

Public Member Functions

 MainMenu (const bool &p_useAnsiEscapeCodes)
 Constructs a new MainMenu object (for API use).
 MainMenu (const std::vector< std::string > &p_commandLineArguments)
 Constructs a new MainMenu object (for CLI use). Below is the help message:
 ~MainMenu ()
 Destructs a MainMenu object.
void Run ()
 Orchestration function which contains the main program loop.
 MainMenu ()=delete
 Disable constructing a new Main Menu object with no arguments.
 MainMenu (const MainMenu &p_mainMenu)=delete
 Disable constructing a new MainMenu object using copy constructor.
 MainMenu (const MainMenu &&p_mainMenu)=delete
 Disable constructing a new MainMenu object using move constructor.
MainMenuoperator= (const MainMenu &p_mainMenu)=delete
 Disable constructing a new MainMenu object using copy assignment operator.
MainMenuoperator= (const MainMenu &&p_mainMenu)=delete
 Disable constructing a new MainMenu object using move assignment operator.

Private Member Functions

void SetupHomepages ()
 Create the option selection home pages.
void SetupMainMenuPagesAndGames ()
 Create the main menu game selection pages and the game array.

Private Attributes

std::vector< std::unique_ptr< Game > > m_games
 Games that can be selected and played.
std::vector< std::string > m_homepages
 Contains the different options available on the homepage.
std::vector< std::string > m_mainMenus
 Contains the different options available on the main menu page.
bool m_useAnsiEscapeCodes
 Whether to use use ANSI escapes codes (true) or only extended ASCII characters (false).

Detailed Description

Orchestration class which runs the homepage and the main menu pages which allow for games to be ran.

Definition at line 19 of file MainMenu.hpp.

Constructor & Destructor Documentation

◆ MainMenu() [1/4]

TerminalGames::MainMenu::MainMenu ( const bool & p_useAnsiEscapeCodes)
explicit

Constructs a new MainMenu object (for API use).

Parameters
p_useAnsiEscapeCodesWhether to use use ANSI escapes codes (true) or only extended ASCII characters (false).

Definition at line 19 of file MainMenu.cpp.

◆ MainMenu() [2/4]

TerminalGames::MainMenu::MainMenu ( const std::vector< std::string > & p_commandLineArguments)
explicit

Constructs a new MainMenu object (for CLI use). Below is the help message:

Usage: terminal-games [options]

OPTIONS:

Generic Options:

-h –help Display available options.

Optional Options:

–a –ascii-only Only use extended ASCII characters (this removes all colour).

Parameters
p_commandLineArgumentsList of all command line arguments.

Definition at line 25 of file MainMenu.cpp.

◆ ~MainMenu()

TerminalGames::MainMenu::~MainMenu ( )

Destructs a MainMenu object.

Definition at line 46 of file MainMenu.cpp.

◆ MainMenu() [3/4]

TerminalGames::MainMenu::MainMenu ( const MainMenu & p_mainMenu)
delete

Disable constructing a new MainMenu object using copy constructor.

Parameters
p_mainMenuThe MainMenu to copy.

◆ MainMenu() [4/4]

TerminalGames::MainMenu::MainMenu ( const MainMenu && p_mainMenu)
delete

Disable constructing a new MainMenu object using move constructor.

Parameters
p_mainMenuThe MainMenu to copy.

Member Function Documentation

◆ Run()

void TerminalGames::MainMenu::Run ( )

Orchestration function which contains the main program loop.

Definition at line 51 of file MainMenu.cpp.

◆ operator=() [1/2]

MainMenu & TerminalGames::MainMenu::operator= ( const MainMenu & p_mainMenu)
delete

Disable constructing a new MainMenu object using copy assignment operator.

Parameters
p_mainMenuThe MainMenu to copy.

◆ operator=() [2/2]

MainMenu & TerminalGames::MainMenu::operator= ( const MainMenu && p_mainMenu)
delete

Disable constructing a new MainMenu object using move assignment operator.

Parameters
p_mainMenuThe MainMenu to copy.

◆ SetupHomepages()

void TerminalGames::MainMenu::SetupHomepages ( )
private

Create the option selection home pages.

Definition at line 91 of file MainMenu.cpp.

◆ SetupMainMenuPagesAndGames()

void TerminalGames::MainMenu::SetupMainMenuPagesAndGames ( )
private

Create the main menu game selection pages and the game array.

Definition at line 97 of file MainMenu.cpp.

Member Data Documentation

◆ m_games

std::vector<std::unique_ptr<Game> > TerminalGames::MainMenu::m_games
private

Games that can be selected and played.

Definition at line 105 of file MainMenu.hpp.

◆ m_homepages

std::vector<std::string> TerminalGames::MainMenu::m_homepages
private

Contains the different options available on the homepage.

Definition at line 110 of file MainMenu.hpp.

◆ m_mainMenus

std::vector<std::string> TerminalGames::MainMenu::m_mainMenus
private

Contains the different options available on the main menu page.

Definition at line 115 of file MainMenu.hpp.

◆ m_useAnsiEscapeCodes

bool TerminalGames::MainMenu::m_useAnsiEscapeCodes
private

Whether to use use ANSI escapes codes (true) or only extended ASCII characters (false).

Definition at line 120 of file MainMenu.hpp.


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