Menu Class Reference

This class provides a Menu that will List all Levels in the current directory. More...

#include <Menu.h>

Inherits GLInterface.

Inheritance diagram for Menu:

Inheritance graph
[legend]
Collaboration diagram for Menu:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Menu (Window *p_window)
 Standard constructor.
virtual ~Menu ()
 Standard destructor.
std::string getLevelName (std::string p_directory, std::string p_mask)
 Displays the Menu and will return as soon as a level has been choosen.
eGameMode getGameMode ()
 Displays the Menu and will return as soon as a game mode has been selected.
std::string getString (std::string p_display, std::string p_default=std::string(""))
 Displays the Menu and returns a free text from the user.

Protected Member Functions

std::vector< std::string > getLevelFiles (std::string p_filemask)
 Reads all files by a given wildcard mask.
std::string getSelectedItem (std::vector< std::string > &p_options, int p_maxOption=-1)
 Selects the Menuentry.
int renderSelectionList (std::vector< std::string > &p_options, unsigned int p_currentElement)
 Technically renders the Menu as selection list and highlight the selected Entry.
int renderInputText (std::string p_display, std::string p_input)
 Technically renders an Textinputfield.

Private Member Functions

int writeText (std::vector< std::string > p_text, int p_highlightedLine)
 Writes the given text on the screen.
int initGL ()
 Initializes OpenGL for menu output.

Detailed Description

This class provides a Menu that will List all Levels in the current directory.

Definition at line 44 of file Menu.h.


Constructor & Destructor Documentation

Menu::Menu ( Window p_window  ) 

Standard constructor.

Parameters:
p_window Instance of the window to display in

Definition at line 29 of file Menu.cpp.

Menu::~Menu (  )  [virtual]

Standard destructor.

Definition at line 33 of file Menu.cpp.


Member Function Documentation

std::string Menu::getLevelName ( std::string  p_directory,
std::string  p_mask 
)

Displays the Menu and will return as soon as a level has been choosen.

Returns:
The filename of the choosen level.

Definition at line 37 of file Menu.cpp.

References getLevelFiles(), and getSelectedItem().

Referenced by WinMain().

Here is the call graph for this function:

eGameMode Menu::getGameMode (  ) 

Displays the Menu and will return as soon as a game mode has been selected.

Returns:
The selected game mode.

Definition at line 55 of file Menu.cpp.

References getSelectedItem(), GM_Client, GM_Local, GM_None, and GM_Server.

Referenced by WinMain().

Here is the call graph for this function:

std::string Menu::getString ( std::string  p_display,
std::string  p_default = std::string("") 
)

Displays the Menu and returns a free text from the user.

Parameters:
p_display Text for the prompt.
p_default Text that will be entered per default.
Returns:
The input string.

Definition at line 86 of file Menu.cpp.

References Window::checkMessages(), Window::clearCurrent(), initGL(), GLInterface::inputMessages, renderInputText(), and GLInterface::window.

Referenced by WinMain().

Here is the call graph for this function:

std::vector< std::string > Menu::getLevelFiles ( std::string  p_filemask  )  [protected]

Reads all files by a given wildcard mask.

Parameters:
p_filemask The wildcard mask for the files to collect.
Returns:
The list of potential levelfiles.

Definition at line 203 of file Menu.cpp.

Referenced by getLevelName().

std::string Menu::getSelectedItem ( std::vector< std::string > &  p_options,
int  p_maxOption = -1 
) [protected]

Selects the Menuentry.

Parameters:
p_options The options to show.
p_maxOption The maximum number for selecting.
Returns:
The selected meu entry.

Definition at line 125 of file Menu.cpp.

References Window::checkMessages(), Window::clearCurrent(), initGL(), GLInterface::inputMessages, renderSelectionList(), sleep(), and GLInterface::window.

Referenced by getGameMode(), and getLevelName().

Here is the call graph for this function:

int Menu::renderSelectionList ( std::vector< std::string > &  p_options,
unsigned int  p_currentElement 
) [protected]

Technically renders the Menu as selection list and highlight the selected Entry.

Parameters:
p_options All options to display
p_currentElement Index of the highlighted element.
Returns:
Condition of Sucess. 0 for success. 1 for failure.

Definition at line 186 of file Menu.cpp.

References writeText().

Referenced by getSelectedItem().

Here is the call graph for this function:

int Menu::renderInputText ( std::string  p_display,
std::string  p_input 
) [protected]

Technically renders an Textinputfield.

Returns:
Condition of Sucess. 0 for success. 1 for failure.

Definition at line 193 of file Menu.cpp.

References writeText().

Referenced by getString().

Here is the call graph for this function:

int Menu::writeText ( std::vector< std::string >  p_text,
int  p_highlightedLine 
) [private]

Writes the given text on the screen.

It also highlights one entry.

Parameters:
p_text The lines to wirte on the screen.
p_highlightedLine The number of the line which should be highlighted.
Returns:
0 for success.

Definition at line 231 of file Menu.cpp.

References GLInterface::glPrint2d(), Window::height, Window::swapBuffers(), Window::width, and GLInterface::window.

Referenced by renderInputText(), and renderSelectionList().

Here is the call graph for this function:

int Menu::initGL (  )  [private, virtual]

Initializes OpenGL for menu output.

Here the characters will be generated.

Reimplemented from GLInterface.

Definition at line 224 of file Menu.cpp.

References GLInterface::initGL().

Referenced by getSelectedItem(), and getString().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Tue Jul 17 22:02:23 2007 for C0re by  doxygen 1.5.2