nsnake
Classic snake game for the terminal
|
Menu on which its items are always sorted alphabetically. More...
#include <MenuAlphabetic.hpp>
Public Member Functions | |
MenuAlphabetic (int x, int y, int width, int height) | |
void | add (MenuItem *item) |
void | handleInput () |
void | goRandom () |
Selects a random item right AFTER the first blank one. More... | |
![]() | |
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. | |
void | removeByLabel (std::string label) |
Removes the menu item with #label. More... | |
void | draw (Window *window) |
Draws the whole Menu on #window. | |
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. | |
std::string | currentLabel () |
Returns the label of the currently selected item. | |
int | currentID () |
Returns the user-specified id of the selected item. | |
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... | |
Additional Inherited Members | |
![]() | |
std::vector< MenuItem * > | item |
Container of all the options inside the menu. | |
MenuItem * | current |
Current item selected. More... | |
![]() | |
unsigned int | currentIndex |
Index of the currently selected item. | |
int | x |
int | y |
int | width |
int | height |
bool | selected |
Tells if the user selected an item (pressed Enter). | |
MenuItem * | selectedItem |
Specifies which item the user pressed Enter on. | |
Menu on which its items are always sorted alphabetically.
It has special navigation keys: by pressing a letter it will jump straight to the first occurrence of it.
Definition at line 11 of file MenuAlphabetic.hpp.
void MenuAlphabetic::goRandom | ( | ) |
Selects a random item right AFTER the first blank one.
Definition at line 85 of file MenuAlphabetic.cpp.