OpenMortal Apocalypse mirror
Sourceforge mirror
SourceForge.net Logo
      News | Info | Characters | Arenas | Screenshots | Forums | Download  
Developer: Making of | Character-HOWTO | AI Design | Submit a Character
Documentation: Main Page | Modules | Class Hierarchy | Class List | File List

CMenu Class Reference
[Game logic (frontend + backend connection)]

Base class for menu systems in OpenMortal. More...

#include <menu.h>

Inheritance diagram for CMenu:

CChallengeMenu CChatMenu CNetworkMenu List of all members.

Public Member Functions

 CMenu (const char *a_pcTitle)
virtual ~CMenu ()
virtual CMenuItemAddMenuItem (const char *a_pcUtf8Text, SDLKey a_tShortcut=SDLK_UNKNOWN, int a_iCode=0)
virtual CEnumMenuItemAddEnumMenuItem (const char *a_pcUtf8Text, int a_iInitialValue, const char **a_ppcNames, const int *a_piValues, int a_iCode=0)
virtual CTextMenuItemAddTextMenuItem (const char *a_pcTitle, const char *a_pcValue, int a_iCode=0)
virtual CMenuItemAddMenuItem (CMenuItem *a_poItem)
virtual void AddOkCancel (int a_iOkCode=0)
virtual CMenuItemGetMenuItem (int a_iCode) const
virtual void ItemActivated (int a_iItemCode, CMenuItem *a_poMenuItem)
virtual void ItemChanged (int a_iItemCode, int a_iValue, CMenuItem *a_poMenuItem)
virtual int Run ()
 Run executes the menus, maybe invoking submenus as well.
virtual void Draw ()
virtual void Clear ()
virtual void EnterName (const char *a_pcTitle, std::string &a_rsTarget, CTextMenuItem *a_poMenuItem, int a_iMaxlen)

Protected Types

typedef std::vector< CMenuItem * > CItemList
typedef CItemList::iterator CItemIterator

Protected Member Functions

virtual void FocusNext ()
virtual void FocusPrev ()
virtual void InvokeSubmenu (CMenu *a_poSubmenu)

Protected Attributes

std::string m_sTitle
CItemList m_oItems
int m_iCurrentItem
int m_iReturnCode
bool m_bDone

Detailed Description

Base class for menu systems in OpenMortal.

Menus are displayed over the current screen and allow for the editing of the game's state, SState. If you think in terms of model, view and controller, then SState is the model and CMenu is both the view and the controller.

Menus have menu items. The items in turn can edit various state variables or invoke submenus. The menu ends then the user exits the toplevel menu or invokes a command which unrolls the entire menu stack.


Member Typedef Documentation

typedef CItemList::iterator CMenu::CItemIterator [protected]
 

typedef std::vector<CMenuItem*> CMenu::CItemList [protected]
 


Constructor & Destructor Documentation

CMenu::CMenu const char *  a_pcTitle  ) 
 

CMenu::~CMenu  )  [virtual]
 


Member Function Documentation

CEnumMenuItem * CMenu::AddEnumMenuItem const char *  a_pcUtf8Text,
int  a_iInitialValue,
const char **  a_ppcNames,
const int *  a_piValues,
int  a_iCode = 0
[virtual]
 

CMenuItem * CMenu::AddMenuItem CMenuItem a_poItem  )  [virtual]
 

CMenuItem * CMenu::AddMenuItem const char *  a_pcUtf8Text,
SDLKey  a_tShortcut = SDLK_UNKNOWN,
int  a_iCode = 0
[virtual]
 

void CMenu::AddOkCancel int  a_iOkCode = 0  )  [virtual]
 

CTextMenuItem * CMenu::AddTextMenuItem const char *  a_pcTitle,
const char *  a_pcValue,
int  a_iCode = 0
[virtual]
 

void CMenu::Clear  )  [virtual]
 

void CMenu::Draw  )  [virtual]
 

void CMenu::EnterName const char *  a_pcTitle,
std::string &  a_rsTarget,
CTextMenuItem a_poMenuItem,
int  a_iMaxlen
[virtual]
 

void CMenu::FocusNext  )  [protected, virtual]
 

void CMenu::FocusPrev  )  [protected, virtual]
 

CMenuItem * CMenu::GetMenuItem int  a_iCode  )  const [virtual]
 

void CMenu::InvokeSubmenu CMenu a_poSubmenu  )  [protected, virtual]
 

void CMenu::ItemActivated int  a_iItemCode,
CMenuItem a_poMenuItem
[virtual]
 

Reimplemented in CNetworkMenu, CChallengeMenu, and CChatMenu.

void CMenu::ItemChanged int  a_iItemCode,
int  a_iValue,
CMenuItem a_poMenuItem
[virtual]
 

Reimplemented in CNetworkMenu.

int CMenu::Run  )  [virtual]
 

Run executes the menus, maybe invoking submenus as well.

The menus modify the global game state.

Returns 0, or the number of parent menus that should be cleared.


Member Data Documentation

bool CMenu::m_bDone [protected]
 

int CMenu::m_iCurrentItem [protected]
 

int CMenu::m_iReturnCode [protected]
 

CItemList CMenu::m_oItems [protected]
 

std::string CMenu::m_sTitle [protected]
 


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