nsnake
Classic snake game for the terminal
MenuItemNumberbox.hpp
1 #ifndef MENUITEMNUMBERBOX_H_DEFINED
2 #define MENUITEMNUMBERBOX_H_DEFINED
3 
4 #include <Interface/Menu/MenuItem.hpp>
5 
18 {
28  MenuItemNumberbox(std::string label, int id, int min, int max, int initial, int jump=1);
29  virtual ~MenuItemNumberbox() { };
30 
31  void draw(Window* window, int x, int y, int width, bool hilite=false);
32 
33  void handleInput();
34 
35  void increase();
36  void decrease();
37  void set(int value);
38  void reset();
39 
40  int min;
41  int max;
42  int initial;
43  int current;
44  int jump;
45 
46 private:
48  void cap();
49 };
50 
51 #endif //MENUITEMNUMBERBOX_H_DEFINED
52 
void handleInput()
Makes the menu item react to input, as seen on the global InputManager.
MenuItemNumberbox(std::string label, int id, int min, int max, int initial, int jump=1)
Create a new number box.
A segment of the terminal screen (2D char matrix).
Definition: Window.hpp:16
void draw(Window *window, int x, int y, int width, bool hilite=false)
Shows this item at #x, #y with #width.
Simplest type of item possible, with a label and user-defined id.
Definition: MenuItem.hpp:11
std::string label
Text that will be shown on the screen.
Definition: MenuItem.hpp:54
Allows to select a number, kinda like a slider.