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 void render(Element* parent);
12 bool process(InputEvents* event);
13
14 void updateBounds();
15 void updateText(const char* inc_text);
16 const std::string getText();
17
18 std::string myLastSeenGamepad = "";
19
20 TextElement text;
21 static std::string getControllerButtonImageForPlatform(int button, bool isGray, bool isOutline);
22
23private:
24 static CST_Color colors[2];
26 int physical = -1;
27
28 // a width we set the button to regardless of inner text
29 int fixedWidth = 0;
30
31 // whether the button is dark or light themed
32 bool dark = false;
33
34 ImageElement icon;
35
36 bool shouldRenderGlossy();
37};
Definition: Button.hpp:7
bool process(InputEvents *event)
process any input that is received for this element
Definition: Button.cpp:149
void render(Element *parent)
display the current state of the display
Definition: Button.cpp:102
int width
width and height of this element (must be manually set, isn't usually calculated (but is in some case...
Definition: Element.hpp:120
Element * parent
the parent element (can sometimes be null if it isn't set)
Definition: Element.hpp:104