- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

# Menu Class Reference

`#include <Menu.h>`

Inheritance diagram for Menu:

List of all members.

## Public Member Functions
| Menu ()
| Menu (std::string filename)
| Menu (List *MenuInfo)
void | mainLoop ()
void | drawTitle (int x, int y, bool selected)
virtual void | draw ()
virtual bool | control (SDL_Event event)
virtual bool | select ()
| ~Menu ()
## Protected Attributes
Sprite * | _background
std::string | _title
std::vector< std::string > | _subtitles
size_t | _selected
size_t | _selectedMax
std::vector< Menu * > | _options
## Static Protected Attributes
static int | _textHeight = 50
static int | _leftMargin = 150
static int | _topMargin = 100
## Private Member Functions
void | load (List *MenuInfo)

## Detailed Description

Definition at line 12 of file Menu.h.

## Constructor & Destructor Documentation

Menu::Menu | ( |  | ) |

| Definition at line 13 of file Menu.cpp. Referenced by load().

Menu::Menu | ( | std::string | filename | ) |

| Definition at line 17 of file Menu.cpp. References load(), and Parser::parse().

Menu::Menu | ( | List * | MenuInfo | ) |

| Definition at line 25 of file Menu.cpp. References load().

Menu::~Menu | ( |  | ) |

| Definition at line 188 of file Menu.cpp. References _options.

## Member Function Documentation

bool Menu::control | ( | SDL_Event | event | ) | `[virtual]`

| Definition at line 88 of file Menu.cpp. References _selected, _selectedMax, Control::menuDownKey, Control::menuUpKey, select(), and Control::selectKey. Referenced by mainLoop().

void Menu::draw | ( |  | ) | `[virtual]`

| Reimplemented in SelectKeyMenu, NewGameMenu, and TitleScreenMenu. Definition at line 107 of file Menu.cpp. References _background, _leftMargin, _subtitles, _textHeight, _topMargin, Sprite::draw(), drawTitle(), glfuncs::glPrint(), glfuncs::instance(), and Sprite::SCREEN. Referenced by NewGameMenu::draw(), SelectKeyMenu::draw(), and mainLoop().

void Menu::drawTitle | ( | int | x,
|  | int | y,
|  | bool | selected
| ) |

| Definition at line 80 of file Menu.cpp. References _title, glfuncs::glPrint(), and glfuncs::instance(). Referenced by draw().

void Menu::load | ( | List * | MenuInfo | ) | `[private]`

| Definition at line 31 of file Menu.cpp. References _options, List::empty(), List::firstList(), Menu(), and List::rest(). Referenced by Menu().

void Menu::mainLoop | ( |  | ) |

| Definition at line 140 of file Menu.cpp. References control(), draw(), Screen::FRAMERATE, glfuncs::instance(), Screen::instance(), and Control::quitKey. Referenced by main().

bool Menu::select | ( |  | ) | `[virtual]`

| Reimplemented in SelectKeyMenu, NewGameMenu, and TitleScreenMenu. Definition at line 134 of file Menu.cpp. References _options, and _selected. Referenced by control().

## Member Data Documentation

Sprite* Menu::_background`[protected]`

| Definition at line 34 of file Menu.h. Referenced by TitleScreenMenu::draw(), and draw().

int Menu::_leftMargin = 150`[static, protected]`

| Definition at line 32 of file Menu.h. Referenced by NewGameMenu::draw(), SelectKeyMenu::draw(), and draw().

std::vector<Menu *> Menu::_options`[protected]`

| Definition at line 39 of file Menu.h. Referenced by load(), NewGameMenu::NewGameMenu(), TitleScreenMenu::select(), select(), SelectKeyMenu::SelectKeyMenu(), and ~Menu().

size_t Menu::_selected`[protected]`

| Definition at line 37 of file Menu.h. Referenced by control(), NewGameMenu::draw(), SelectKeyMenu::draw(), NewGameMenu::NewGameMenu(), NewGameMenu::select(), SelectKeyMenu::select(), and select().

size_t Menu::_selectedMax`[protected]`

| Definition at line 38 of file Menu.h. Referenced by control(), NewGameMenu::NewGameMenu(), and SelectKeyMenu::SelectKeyMenu().

std::vector<std::string> Menu::_subtitles`[protected]`

| Definition at line 36 of file Menu.h. Referenced by draw(), and SelectKeyMenu::SelectKeyMenu().

int Menu::_textHeight = 50`[static, protected]`

| Definition at line 31 of file Menu.h. Referenced by NewGameMenu::draw(), SelectKeyMenu::draw(), and draw().

std::string Menu::_title`[protected]`

| Definition at line 35 of file Menu.h. Referenced by drawTitle(), NewGameMenu::NewGameMenu(), and SelectKeyMenu::SelectKeyMenu().

int Menu::_topMargin = 100`[static, protected]`

| Definition at line 33 of file Menu.h. Referenced by draw().

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

- C:/Documents and Settings/jegan/Desktop/projectX/Menu.h
- C:/Documents and Settings/jegan/Desktop/projectX/Menu.cpp