nsnake
Classic snake game for the terminal
|
Allows to select a number, kinda like a slider. More...
#include <MenuItemNumberbox.hpp>
Public Member Functions | |
MenuItemNumberbox (std::string label, int id, int min, int max, int initial, int jump=1) | |
Create a new number box. More... | |
void | draw (Window *window, int x, int y, int width, bool hilite=false) |
Shows this item at #x, #y with #width. More... | |
void | handleInput () |
Makes the menu item react to input, as seen on the global InputManager. More... | |
void | increase () |
void | decrease () |
void | set (int value) |
void | reset () |
![]() | |
MenuItem (std::string label, int id) | |
Create a MenuItem, with user-defined id. More... | |
Public Attributes | |
int | min |
int | max |
int | initial |
int | current |
int | jump |
![]() | |
MenuItemType | type |
Specific type of this widget. More... | |
std::string | label |
Text that will be shown on the screen. | |
int | id |
User-defined id to identify this item. | |
Additional Inherited Members | |
![]() | |
enum | MenuItemType { ITEM, LABEL, CHECKBOX, NUMBERBOX, TEXTBOX, TEXTLIST } |
All possible item types. More... | |
Allows to select a number, kinda like a slider.
There's a number and by pressing left and right you add or remove units of it.
Definition at line 17 of file MenuItemNumberbox.hpp.
MenuItemNumberbox::MenuItemNumberbox | ( | std::string | label, |
int | id, | ||
int | min, | ||
int | max, | ||
int | initial, | ||
int | jump = 1 |
||
) |
Create a new number box.
label | Textual label on the left of the item |
id | Unique identifier so the menu can know which item this is |
min | Minimal allowed value for the number |
max | Maximum allowed value for the number |
initial | Initial value for the number |
jump | How many units will the number jump when user press left or right |
Definition at line 7 of file MenuItemNumberbox.cpp.
|
virtual |
Shows this item at #x, #y with #width.
If this is the current item, send #hilite as true.
Reimplemented from MenuItem.
Definition at line 17 of file MenuItemNumberbox.cpp.
|
virtual |
Makes the menu item react to input, as seen on the global InputManager.
Each type of MenuItem might react to input differently. A text box might want to show printable characters, a check box might want to check if space bar was pressed, whatever.
When inheriting this, make sure to implement it.
Reimplemented from MenuItem.
Definition at line 57 of file MenuItemNumberbox.cpp.