|
nsnake
Classic snake game for the terminal
|
List of selectable items. More...
#include <Menu.hpp>


Public Member Functions | |
| Menu (int x, int y, int width, int height) | |
| Creates a menu at #x and #y with #width and #height. More... | |
| void | add (MenuItem *item) |
| void | addBlank () |
| void | removeByID (int id) |
| Removes the menu item with #id. More... | |
| void | removeByLabel (std::string label) |
| Removes the menu item with #label. More... | |
| void | draw (Window *window) |
| Draws the whole Menu on #window. More... | |
| void | handleInput () |
| Makes the menu react to input, as seen on the global InputManager. More... | |
| void | goNext () |
| Makes the menu select the next item. More... | |
| void | goPrevious () |
| Makes the menu select the previous item. More... | |
| void | goFirst () |
| void | goLast () |
| void | goRandom () |
| bool | willQuit () |
| Tells if the user selected an item that quits the menu. More... | |
| std::string | currentLabel () |
| Returns the label of the currently selected item. More... | |
| int | currentID () |
| Returns the user-specified id of the selected item. More... | |
| bool | getBool (int id) |
| Returns the bool internal value of item that has #id. More... | |
| int | getInt (int id) |
| Returns the integer value of the item that has #id. More... | |
| std::string | getString (int id) |
| Returns the string value of the item that has #id. More... | |
| void | reset () |
| Makes the menu able to be selected again. More... | |
Public Attributes | |
| std::vector< MenuItem * > | item |
| Container of all the options inside the menu. More... | |
| MenuItem * | current |
| Current item selected. More... | |
Protected Attributes | |
| unsigned int | currentIndex |
| Index of the currently selected item. More... | |
| int | x |
| int | y |
| int | width |
| int | height |
| bool | selected |
| Tells if the user selected an item (pressed Enter). More... | |
| MenuItem * | selectedItem |
| Specifies which item the user pressed Enter on. More... | |
List of selectable items.
| Menu::Menu | ( | int | x, |
| int | y, | ||
| int | width, | ||
| int | height | ||
| ) |
Creates a menu at #x and #y with #width and #height.
It isn't attached to any specific Window, except when you call Menu::draw().
| int Menu::currentID | ( | ) |
| std::string Menu::currentLabel | ( | ) |
| void Menu::draw | ( | Window * | window | ) |
| bool Menu::getBool | ( | int | id | ) |
Returns the bool internal value of item that has #id.
| int Menu::getInt | ( | int | id | ) |
Returns the integer value of the item that has #id.
| std::string Menu::getString | ( | int | id | ) |
Returns the string value of the item that has #id.
| void Menu::goNext | ( | ) |
| void Menu::goPrevious | ( | ) |
| void Menu::handleInput | ( | ) |
| void Menu::removeByID | ( | int | id | ) |
| void Menu::removeByLabel | ( | std::string | label | ) |
| void Menu::reset | ( | ) |
Makes the menu able to be selected again.
When the user selects an item, willQuit() returns true. By calling this function, you make possible to select things again.
| bool Menu::willQuit | ( | ) |
| MenuItem* Menu::current |
|
protected |
| std::vector<MenuItem*> Menu::item |
|
protected |
|
protected |