![]() |
Chesto 0.9
A declarative and element-based library for creating GUIs on homebrew'd consoles
|


Public Types | |
| typedef Element | super |
Public Member Functions | |
| virtual bool | process (InputEvents *event) |
| process any input that is received for this element More... | |
| virtual void | render (Element *parent) |
| display the current state of the display More... | |
| bool | onTouchDown (InputEvents *event) |
| bool | onTouchDrag (InputEvents *event) |
| bool | onTouchUp (InputEvents *event) |
| void | hide () |
| void | unhide () |
| void | renderBackground (bool fill=true) |
| void | addNode (std::unique_ptr< Element > node) |
| void | remove (Element *element) |
| void | removeAll () |
| void | position (int x, int y) |
| position the element More... | |
| void | recalcPosition (Element *parent) |
| float | getEffectiveScale () const |
| CST_Rect | getBounds () |
| CST_Renderer * | getRenderer () |
| Element * | setPosition (int x, int y) |
| Element * | setAction (std::function< void()> func) |
| Element * | setAbsolute (bool isAbs) |
| template<typename T , typename... Args> | |
| T * | createNode (Args &&... args) |
| Element * | constrain (int flags, int padding=0) |
| Element * | constrainToTarget (Element *target, int flags, int padding=0) |
| Element * | animate (int durationIn, std::function< void(float)> onStep, std::function< void()> onFinish) |
| Element * | moveToFront () |
| Element * | setTouchable (bool touchable) |
| void | screenshot (std::string path) |
| Take a screenshot of this element and its children, and save it to the given path. More... | |
Public Attributes | |
| std::function< void()> | action = NULL |
| the action to call (from binded callback) on touch or button selection https://stackoverflow.com/questions/14189440/c-class-member-callback-simple-examples More... | |
| std::function< void(InputEvents *event)> | actionWithEvents = NULL |
| std::vector< std::unique_ptr< Element, std::function< void(Element *)> > > | elements |
| visible GUI child elements of this element More... | |
| float | scale = 1.0f |
| bool | touchable = false |
| whether or not this element can be touched (highlights bounds) More... | |
| bool | dragging = false |
| whether or not this element is currently being dragged More... | |
| bool | needsRedraw = false |
| whether or not this element needs the screen redrawn next time it's processed More... | |
| int | futureRedrawCounter = 0 |
| whether this element needs a redraw for the next X redraws (decreases each time) (0 is no redraws) More... | |
| int | lastMouseY = 0 |
| the last Y, X coordinate of the mouse (from a drag probably) More... | |
| int | lastMouseX = 0 |
| bool | hasBackground = false |
| rgb | backgroundColor = {0, 0, 0} |
| int | backgroundOpacity = 0xff |
| bool | isAbsolute = false |
| Element * | parent = nullptr |
| the parent element (reference only, not owned) More... | |
| bool | hidden = false |
| whether this element should skip rendering or not More... | |
| bool | isProtected = false |
| int | elasticCounter = 0 |
| how much time is left in an elastic-type flick/scroll set by the last distance traveled in a scroll, and counts down every frame More... | |
| int | width = 0 |
| width and height of this element (must be manually set, isn't usually calculated (but is in some cases, like text or images)) More... | |
| int | height = 0 |
| int | x = 0 |
| int | y = 0 |
| int | xAbs = 0 |
| int | yAbs = 0 |
| double | angle = 0 |
| rotation angle in degrees More... | |
| int | cornerRadius = 0 |
| int | tag = 0 |
| std::vector< std::unique_ptr< Constraint > > | constraints |
| std::vector< std::unique_ptr< Animation > > | animations |
| bool | useColorMask = false |
| whether or not to overlay a color mask on top of this element More... | |
| CST_Color | maskColor = {0,0,0,0} |
| The color to overlay on top. More... | |
Protected Member Functions | |
| void | addStackMember (Element *element) |
Definition at line 28 of file Element.hpp.
| typedef Element Chesto::Element::super |
Definition at line 134 of file Element.hpp.
| Chesto::Element::Element | ( | ) |
Definition at line 24 of file Element.cpp.
|
virtual |
Definition at line 16 of file Element.cpp.
| void Chesto::Element::addNode | ( | std::unique_ptr< Element > | node | ) |
Definition at line 399 of file Element.cpp.
|
protected |
Definition at line 430 of file Element.cpp.
| Element * Chesto::Element::animate | ( | int | durationIn, |
| std::function< void(float)> | onStep, | ||
| std::function< void()> | onFinish | ||
| ) |
Definition at line 507 of file Element.cpp.
| Element * Chesto::Element::constrain | ( | int | flags, |
| int | padding = 0 |
||
| ) |
Definition at line 494 of file Element.cpp.
Definition at line 500 of file Element.cpp.
|
inline |
Definition at line 163 of file Element.hpp.
| CST_Rect Chesto::Element::getBounds | ( | ) |
Definition at line 228 of file Element.cpp.
| float Chesto::Element::getEffectiveScale | ( | ) | const |
Definition at line 223 of file Element.cpp.
| CST_Renderer * Chesto::Element::getRenderer | ( | ) |
Definition at line 490 of file Element.cpp.
|
inline |
Definition at line 46 of file Element.hpp.
| Element * Chesto::Element::moveToFront | ( | ) |
Definition at line 520 of file Element.cpp.
| bool Chesto::Element::onTouchDown | ( | InputEvents * | event | ) |
Definition at line 263 of file Element.cpp.
| bool Chesto::Element::onTouchDrag | ( | InputEvents * | event | ) |
Definition at line 287 of file Element.cpp.
| bool Chesto::Element::onTouchUp | ( | InputEvents * | event | ) |
Definition at line 345 of file Element.cpp.
| void Chesto::Element::position | ( | int | x, |
| int | y | ||
| ) |
position the element
Definition at line 257 of file Element.cpp.
|
virtual |
process any input that is received for this element
Reimplemented in Chesto::Button, Chesto::DropDown, Chesto::EKeyboard, Chesto::ListElement, Chesto::RootDisplay, Chesto::AlertDialog, Chesto::DropDownChoices, Chesto::Grid, and Chesto::NetImageElement.
Definition at line 29 of file Element.cpp.
References elasticCounter, elements, futureRedrawCounter, hidden, needsRedraw, parent, touchable, and Chesto::InputEvents::touchIn().
Referenced by Chesto::ListElement::process(), Chesto::RootDisplay::process(), Chesto::AlertDialog::process(), Chesto::Grid::process(), and Chesto::NetImageElement::process().
| void Chesto::Element::recalcPosition | ( | Element * | parent | ) |
Definition at line 177 of file Element.cpp.
| void Chesto::Element::remove | ( | Element * | element | ) |
Definition at line 453 of file Element.cpp.
| void Chesto::Element::removeAll | ( | ) |
Definition at line 465 of file Element.cpp.
|
virtual |
display the current state of the display
Reimplemented in Chesto::Button, Chesto::EKeyboard, Chesto::ProgressBar, Chesto::RootDisplay, Chesto::Texture, Chesto::AlertDialog, Chesto::DropDownChoices, and Chesto::NetImageElement.
Definition at line 89 of file Element.cpp.
References elasticCounter, elements, hidden, parent, touchable, and width.
Referenced by Chesto::RootDisplay::render(), Chesto::Texture::render(), Chesto::AlertDialog::render(), Chesto::NetImageElement::render(), and screenshot().
| void Chesto::Element::renderBackground | ( | bool | fill = true | ) |
Definition at line 239 of file Element.cpp.
| void Chesto::Element::screenshot | ( | std::string | path | ) |
Take a screenshot of this element and its children, and save it to the given path.
Definition at line 544 of file Element.cpp.
| Element * Chesto::Element::setAbsolute | ( | bool | isAbs | ) |
Definition at line 484 of file Element.cpp.
| Element * Chesto::Element::setAction | ( | std::function< void()> | func | ) |
Definition at line 478 of file Element.cpp.
| Element * Chesto::Element::setPosition | ( | int | x, |
| int | y | ||
| ) |
Definition at line 472 of file Element.cpp.
| Element * Chesto::Element::setTouchable | ( | bool | touchable | ) |
Definition at line 538 of file Element.cpp.
|
inline |
Definition at line 48 of file Element.hpp.
| std::function<void()> Chesto::Element::action = NULL |
the action to call (from binded callback) on touch or button selection https://stackoverflow.com/questions/14189440/c-class-member-callback-simple-examples
Definition at line 55 of file Element.hpp.
| std::function<void(InputEvents* event)> Chesto::Element::actionWithEvents = NULL |
Definition at line 56 of file Element.hpp.
| double Chesto::Element::angle = 0 |
rotation angle in degrees
Definition at line 144 of file Element.hpp.
Referenced by Chesto::Texture::render().
| std::vector<std::unique_ptr<Animation> > Chesto::Element::animations |
Definition at line 176 of file Element.hpp.
| rgb Chesto::Element::backgroundColor = {0, 0, 0} |
Definition at line 107 of file Element.hpp.
| int Chesto::Element::backgroundOpacity = 0xff |
Definition at line 110 of file Element.hpp.
| std::vector<std::unique_ptr<Constraint> > Chesto::Element::constraints |
Definition at line 171 of file Element.hpp.
| int Chesto::Element::cornerRadius = 0 |
Definition at line 147 of file Element.hpp.
| bool Chesto::Element::dragging = false |
whether or not this element is currently being dragged
Definition at line 92 of file Element.hpp.
| int Chesto::Element::elasticCounter = 0 |
how much time is left in an elastic-type flick/scroll set by the last distance traveled in a scroll, and counts down every frame
Definition at line 129 of file Element.hpp.
visible GUI child elements of this element
Definition at line 59 of file Element.hpp.
Referenced by process(), Chesto::DropDownChoices::process(), Chesto::Grid::process(), Chesto::Grid::refresh(), and render().
| int Chesto::Element::futureRedrawCounter = 0 |
whether this element needs a redraw for the next X redraws (decreases each time) (0 is no redraws)
Definition at line 98 of file Element.hpp.
Referenced by process().
| bool Chesto::Element::hasBackground = false |
Definition at line 104 of file Element.hpp.
| int Chesto::Element::height = 0 |
Definition at line 132 of file Element.hpp.
| bool Chesto::Element::hidden = false |
whether this element should skip rendering or not
Definition at line 119 of file Element.hpp.
Referenced by Chesto::AlertDialog::AlertDialog(), process(), Chesto::ListElement::process(), render(), Chesto::ProgressBar::render(), Chesto::Texture::render(), and Chesto::NetImageElement::render().
| bool Chesto::Element::isAbsolute = false |
Definition at line 113 of file Element.hpp.
| bool Chesto::Element::isProtected = false |
Definition at line 125 of file Element.hpp.
| int Chesto::Element::lastMouseX = 0 |
Definition at line 101 of file Element.hpp.
| int Chesto::Element::lastMouseY = 0 |
the last Y, X coordinate of the mouse (from a drag probably)
Definition at line 101 of file Element.hpp.
| CST_Color Chesto::Element::maskColor = {0,0,0,0} |
The color to overlay on top.
Definition at line 193 of file Element.hpp.
Referenced by Chesto::Texture::render().
| bool Chesto::Element::needsRedraw = false |
whether or not this element needs the screen redrawn next time it's processed
Definition at line 95 of file Element.hpp.
Referenced by process().
| Element* Chesto::Element::parent = nullptr |
the parent element (reference only, not owned)
Definition at line 116 of file Element.hpp.
Referenced by process(), render(), Chesto::ProgressBar::render(), Chesto::RootDisplay::render(), Chesto::Texture::render(), Chesto::NetImageElement::render(), and screenshot().
| float Chesto::Element::scale = 1.0f |
Definition at line 86 of file Element.hpp.
| int Chesto::Element::tag = 0 |
Definition at line 150 of file Element.hpp.
| bool Chesto::Element::touchable = false |
whether or not this element can be touched (highlights bounds)
Definition at line 89 of file Element.hpp.
| bool Chesto::Element::useColorMask = false |
whether or not to overlay a color mask on top of this element
Definition at line 190 of file Element.hpp.
Referenced by Chesto::Texture::render().
| int Chesto::Element::width = 0 |
width and height of this element (must be manually set, isn't usually calculated (but is in some cases, like text or images))
Definition at line 132 of file Element.hpp.
Referenced by Chesto::AlertDialog::AlertDialog(), Chesto::Texture::loadPath(), Chesto::NetImageElement::NetImageElement(), Chesto::NetImageElement::process(), Chesto::Screen::rebuildUI(), render(), Chesto::ProgressBar::render(), Chesto::Texture::render(), Chesto::NetImageElement::render(), Chesto::Texture::resize(), screenshot(), and Chesto::TextElement::update().
| int Chesto::Element::x = 0 |
Definition at line 137 of file Element.hpp.
| int Chesto::Element::xAbs = 0 |
Definition at line 141 of file Element.hpp.
| int Chesto::Element::y = 0 |
Definition at line 137 of file Element.hpp.
| int Chesto::Element::yAbs = 0 |
Definition at line 141 of file Element.hpp.