nsnake
Classic snake game for the terminal
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Interface
Menu
MenuItemLabel.cpp
1
#include <Interface/Menu/MenuItemLabel.hpp>
2
#include <Config/Globals.hpp>
3
4
MenuItemLabel::MenuItemLabel(std::string label,
int
id
, std::string rightLabel):
5
MenuItem
(label, id),
6
rightLabel(rightLabel)
7
{
8
this->type = MenuItem::LABEL;
9
}
10
11
void
MenuItemLabel::draw
(
Window
* window,
int
x,
int
y,
int
width,
bool
hilite)
12
{
13
unsigned
int
rightLabelSize = this->rightLabel.size();
14
15
MenuItem::draw
(window, x, y, width - rightLabelSize - 1, hilite);
16
17
window->
print
(this->rightLabel,
18
x + width - rightLabelSize,
19
y,
20
((hilite) ?
21
Globals::Theme::hilite_text:
22
Globals::Theme::text));
23
}
24
25
void
MenuItemLabel::handleInput
()
26
{ }
27
28
void
MenuItemLabel::set(std::string str)
29
{
30
this->rightLabel = str;
31
}
32
Window
A segment of the terminal screen (2D char matrix).
Definition
Window.hpp:17
Window::print
void print(std::string str, int x, int y, ColorPair pair=0)
Shows text str at x y on the window with color pair.
Definition
Window.cpp:94
MenuItemLabel::handleInput
void handleInput()
Makes the menu item react to input, as seen on the global InputManager.
Definition
MenuItemLabel.cpp:25
MenuItemLabel::draw
void draw(Window *window, int x, int y, int width, bool hilite=false)
Shows this item at x, y with width.
Definition
MenuItemLabel.cpp:11
MenuItem
Simplest type of item possible, with a label and user-defined id.
Definition
MenuItem.hpp:12
MenuItem::draw
virtual void draw(Window *window, int x, int y, int width, bool hilite=false)
Shows this item at x, y with width.
Definition
MenuItem.cpp:12
Generated on
for nsnake by
1.17.0