Chesto 0.9
A declarative and element-based library for creating GUIs on homebrew'd consoles
Button.hpp
1#pragma once
2
3#include "ImageElement.hpp"
4#include "TextElement.hpp"
5
6class Button : public Element
7{
8public:
9 Button(std::string text, int button, bool dark = false, int size = 20, int width = 0);
10
11 bool process(InputEvents* event);
12
13 void updateBounds();
14 void updateText(const char* inc_text);
15 const std::string getText();
16
17 std::string myLastSeenGamepad = "";
18
19 TextElement text;
20 static std::string getControllerButtonImageForPlatform(int button, bool isGray, bool isOutline);
21
22private:
23 static CST_Color colors[2];
25 int physical = -1;
26
27 // a width we set the button to regardless of inner text
28 int fixedWidth = 0;
29
30 // whether the button is dark or light themed
31 bool dark = false;
32
33 ImageElement icon;
34};
Definition: Button.hpp:7
bool process(InputEvents *event)
process any input that is received for this element
Definition: Button.cpp:89
int width
width and height of this element (must be manually set, isn't usually calculated (but is in some case...
Definition: Element.hpp:118