Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
GameMenu Class Reference

#include <GameMenu.h>

Public Types

enum  MenuOption { Resume = 0 , Restart = 1 , Quit = 2 , Count = 3 }
 

Public Member Functions

 GameMenu ()
 
virtual ~GameMenu ()
 
void Activate ()
 
void Deactivate ()
 
bool IsActive () const
 
void AddEntry (const std::string &e)
 
void SelectPrevious ()
 
void SelectNext ()
 
void ValidateSelection ()
 
int GetSelectedOption () const
 
virtual void Render ()
 
void RenderF2Menu ()
 
void Update ()
 
bool IsF2MenuOpen () const
 
void ToggleF2Menu ()
 
void SetF2MenuOpen (bool open)
 

Static Public Member Functions

static GameMenuGetInstance ()
 
static GameMenuGet ()
 

Private Member Functions

void ScanForTiledMaps (const std::string &directory)
 
void RefreshTiledMapList ()
 

Private Attributes

std::string name
 
bool m_active = false
 
std::vector< std::string > m_entries
 
int m_selected = MenuOption::Resume
 
bool m_f2MenuOpen = false
 
std::vector< std::string > m_tiledMapPaths
 
int m_selectedMapIndex = -1
 
bool m_hasScannedTiledMaps = false
 

Detailed Description

Definition at line 11 of file GameMenu.h.

Member Enumeration Documentation

◆ MenuOption

Enumerator
Resume 
Restart 
Quit 
Count 

Definition at line 14 of file GameMenu.h.

Constructor & Destructor Documentation

◆ GameMenu()

GameMenu::GameMenu ( )
inline

Definition at line 22 of file GameMenu.h.

References name, and SYSTEM_LOG.

◆ ~GameMenu()

virtual GameMenu::~GameMenu ( )
inlinevirtual

Definition at line 27 of file GameMenu.h.

References Deactivate(), and SYSTEM_LOG.

+ Here is the call graph for this function:

Member Function Documentation

◆ Activate()

void GameMenu::Activate ( )

Definition at line 22 of file GameMenu.cpp.

References VideoGame::Get(), m_active, VideoGame::Pause(), and SYSTEM_LOG.

+ Here is the call graph for this function:

◆ AddEntry()

void GameMenu::AddEntry ( const std::string &  e)
inline

Definition at line 44 of file GameMenu.h.

References GetComponentTypeID_Static(), and m_entries.

+ Here is the call graph for this function:

◆ Deactivate()

void GameMenu::Deactivate ( )

Definition at line 33 of file GameMenu.cpp.

References VideoGame::Get(), m_active, VideoGame::Resume(), and SYSTEM_LOG.

Referenced by ValidateSelection(), and ~GameMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Get()

static GameMenu & GameMenu::Get ( )
inlinestatic

Definition at line 38 of file GameMenu.h.

References GetInstance().

Referenced by UIEventConsumeSystem::Process(), UIRenderingSystem::RenderInGameMenu(), SDL_AppEvent(), and SDL_AppIterate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetInstance()

static GameMenu & GameMenu::GetInstance ( )
inlinestatic

Definition at line 33 of file GameMenu.h.

References GetComponentTypeID_Static().

Referenced by Get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSelectedOption()

int GameMenu::GetSelectedOption ( ) const
inline

Definition at line 51 of file GameMenu.h.

References m_selected.

Referenced by UIRenderingSystem::RenderInGameMenu().

+ Here is the caller graph for this function:

◆ IsActive()

bool GameMenu::IsActive ( ) const
inline

Definition at line 42 of file GameMenu.h.

References m_active.

◆ IsF2MenuOpen()

bool GameMenu::IsF2MenuOpen ( ) const
inline

Definition at line 62 of file GameMenu.h.

References m_f2MenuOpen.

Referenced by SDL_AppEvent().

+ Here is the caller graph for this function:

◆ RefreshTiledMapList()

void GameMenu::RefreshTiledMapList ( )
private

Definition at line 180 of file GameMenu.cpp.

References m_hasScannedTiledMaps, m_selectedMapIndex, m_tiledMapPaths, ScanForTiledMaps(), and SYSTEM_LOG.

Referenced by RenderF2Menu(), and SetF2MenuOpen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Render()

void GameMenu::Render ( )
virtual

Definition at line 76 of file GameMenu.cpp.

References GetComponentTypeID_Static(), m_active, m_entries, m_selected, and SYSTEM_LOG.

+ Here is the call graph for this function:

◆ RenderF2Menu()

void GameMenu::RenderF2Menu ( )

Definition at line 200 of file GameMenu.cpp.

References World::Get(), GetComponentTypeID_Static(), World::LoadLevelFromTiled(), m_f2MenuOpen, m_selectedMapIndex, m_tiledMapPaths, RefreshTiledMapList(), and SYSTEM_LOG.

Referenced by SDL_AppIterate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ScanForTiledMaps()

void GameMenu::ScanForTiledMaps ( const std::string &  directory)
private

Definition at line 109 of file GameMenu.cpp.

References GetComponentTypeID_Static(), m_tiledMapPaths, and ScanForTiledMaps().

Referenced by RefreshTiledMapList(), and ScanForTiledMaps().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SelectNext()

void GameMenu::SelectNext ( )

Definition at line 49 of file GameMenu.cpp.

References Count, and m_selected.

Referenced by UIEventConsumeSystem::Process().

+ Here is the caller graph for this function:

◆ SelectPrevious()

void GameMenu::SelectPrevious ( )

Definition at line 44 of file GameMenu.cpp.

References Count, and m_selected.

Referenced by UIEventConsumeSystem::Process().

+ Here is the caller graph for this function:

◆ SetF2MenuOpen()

void GameMenu::SetF2MenuOpen ( bool  open)

Definition at line 99 of file GameMenu.cpp.

References GetComponentTypeID_Static(), m_f2MenuOpen, m_hasScannedTiledMaps, and RefreshTiledMapList().

Referenced by SDL_AppEvent(), and ToggleF2Menu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToggleF2Menu()

void GameMenu::ToggleF2Menu ( )

Definition at line 94 of file GameMenu.cpp.

References m_f2MenuOpen, and SetF2MenuOpen().

Referenced by SDL_AppEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Update()

void GameMenu::Update ( )

Definition at line 87 of file GameMenu.cpp.

◆ ValidateSelection()

void GameMenu::ValidateSelection ( )

Definition at line 54 of file GameMenu.cpp.

References Deactivate(), VideoGame::Get(), m_selected, Quit, VideoGame::RequestQuit(), Restart, Resume, and SYSTEM_LOG.

Referenced by UIEventConsumeSystem::Process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_active

bool GameMenu::m_active = false
private

Definition at line 68 of file GameMenu.h.

Referenced by Activate(), Deactivate(), IsActive(), and Render().

◆ m_entries

std::vector<std::string> GameMenu::m_entries
private

Definition at line 69 of file GameMenu.h.

Referenced by AddEntry(), and Render().

◆ m_f2MenuOpen

bool GameMenu::m_f2MenuOpen = false
private

Definition at line 73 of file GameMenu.h.

Referenced by IsF2MenuOpen(), RenderF2Menu(), SetF2MenuOpen(), and ToggleF2Menu().

◆ m_hasScannedTiledMaps

bool GameMenu::m_hasScannedTiledMaps = false
private

Definition at line 76 of file GameMenu.h.

Referenced by RefreshTiledMapList(), and SetF2MenuOpen().

◆ m_selected

int GameMenu::m_selected = MenuOption::Resume
private

Definition at line 70 of file GameMenu.h.

Referenced by GetSelectedOption(), Render(), SelectNext(), SelectPrevious(), and ValidateSelection().

◆ m_selectedMapIndex

int GameMenu::m_selectedMapIndex = -1
private

Definition at line 75 of file GameMenu.h.

Referenced by RefreshTiledMapList(), and RenderF2Menu().

◆ m_tiledMapPaths

std::vector<std::string> GameMenu::m_tiledMapPaths
private

Definition at line 74 of file GameMenu.h.

Referenced by RefreshTiledMapList(), RenderF2Menu(), and ScanForTiledMaps().

◆ name

std::string GameMenu::name
private

Definition at line 67 of file GameMenu.h.

Referenced by GameMenu().


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