Chesto 0.9
A declarative and element-based library for creating GUIs on homebrew'd consoles
Public Types | Public Member Functions | Public Attributes | List of all members
Element Class Reference
Inheritance diagram for Element:
Inheritance graph
[legend]
Collaboration diagram for Element:
Collaboration graph
[legend]

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 append (Element *element)
 
void remove (Element *element)
 
void removeAll (bool moveToTrash=false)
 
void position (int x, int y)
 position the element More...
 
void recalcPosition (Element *parent)
 
CST_Rect getBounds ()
 
CST_Renderer * getRenderer ()
 
void wipeAll (bool delSelf=false)
 
Elementchild (Element *child)
 
ElementsetPosition (int x, int y)
 
ElementsetAction (std::function< void()> func)
 
ElementcenterHorizontallyIn (Element *parent)
 
ElementcenterVerticallyIn (Element *parent)
 
ElementcenterIn (Element *parent)
 
ElementsetAbsolute (bool isAbs)
 
Elementconstrain (int flags, int padding=0)
 
Elementanimate (int durationIn, std::function< void(float)> onStep, std::function< void()> onFinish)
 
ElementmoveToFront ()
 
ElementsetTouchable (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< 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}
 
bool isAbsolute = false
 
Elementparent = NULL
 the parent element (can sometimes be null if it isn't set) 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 xOff = 0
 
int yOff = 0
 
int cornerRadius = 0
 
std::vector< Constraint * > constraints
 
std::vector< 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...
 

Detailed Description

Definition at line 33 of file Element.hpp.

Member Typedef Documentation

◆ super

Definition at line 122 of file Element.hpp.

Constructor & Destructor Documentation

◆ Element()

Element::Element ( )

Definition at line 12 of file Element.cpp.

13{
14 needsRedraw = true;
15}
bool needsRedraw
whether or not this element needs the screen redrawn next time it's processed
Definition: Element.hpp:86

◆ ~Element()

Element::~Element ( )
virtual

Definition at line 7 of file Element.cpp.

8{
9 removeAll();
10}

Member Function Documentation

◆ animate()

Element * Element::animate ( int  durationIn,
std::function< void(float)>  onStep,
std::function< void()>  onFinish 
)

Definition at line 422 of file Element.cpp.

426 {
427 animations.push_back(new Animation(
428 CST_GetTicks(), duration, onStep, onFinish)
429 );
430
431 return this;
432}

◆ append()

void Element::append ( Element element)

Definition at line 328 of file Element.cpp.

329{
330 auto position = std::find(elements.begin(), elements.end(), element);
331 if (position == elements.end()) {
332 elements.push_back(element);
333 }
334}
void position(int x, int y)
position the element
Definition: Element.cpp:206
std::vector< Element * > elements
visible GUI child elements of this element
Definition: Element.hpp:64

◆ centerHorizontallyIn()

Element * Element::centerHorizontallyIn ( Element parent)

Definition at line 389 of file Element.cpp.

390{
391 this->x = parent->width / 2 - this->width / 2;
392 return this;
393}
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

◆ centerIn()

Element * Element::centerIn ( Element parent)

Definition at line 401 of file Element.cpp.

402{
403 return centerHorizontallyIn(parent)->centerVerticallyIn(parent);
404}

◆ centerVerticallyIn()

Element * Element::centerVerticallyIn ( Element parent)

Definition at line 395 of file Element.cpp.

396{
397 this->y = parent->height / 2 - this->height / 2;
398 return this;
399}

◆ child()

Element * Element::child ( Element child)

Definition at line 369 of file Element.cpp.

370{
371 this->elements.push_back(child);
372 child->parent = this;
373 child->recalcPosition(this);
374 return this;
375}

◆ constrain()

Element * Element::constrain ( int  flags,
int  padding = 0 
)

Definition at line 416 of file Element.cpp.

417{
418 constraints.push_back(new Constraint(flags, padding));
419 return this;
420}

◆ getBounds()

CST_Rect Element::getBounds ( )

Definition at line 178 of file Element.cpp.

179{
180 return {
181 .x = this->xAbs,
182 .y = this->yAbs,
183 .w = this->width,
184 .h = this->height,
185 };
186}

◆ getRenderer()

CST_Renderer * Element::getRenderer ( )

Definition at line 412 of file Element.cpp.

412 {
413 return RootDisplay::renderer;
414}

◆ hide()

void Element::hide ( )
inline

Definition at line 51 of file Element.hpp.

51{ this->hidden = true; }
bool hidden
whether this element should skip rendering or not
Definition: Element.hpp:107

◆ moveToFront()

Element * Element::moveToFront ( )

Definition at line 435 of file Element.cpp.

435 {
436 if (parent != NULL) {
437 parent->remove(this);
438 parent->child(this);
439 }
440 return this;
441}

◆ onTouchDown()

bool Element::onTouchDown ( InputEvents event)

Definition at line 212 of file Element.cpp.

213{
214 if (!event->isTouchDown())
215 return false;
216
217 if (!event->touchIn(this->xAbs, this->yAbs, this->width, this->height))
218 return false;
219
220 // mouse pushed down, set variable
221 this->dragging = true;
222 this->lastMouseY = event->yPos;
223 this->lastMouseX = event->xPos;
224
225 // turn on deep highlighting during a touch down
226 if (this->touchable)
227 this->elasticCounter = DEEP_HIGHLIGHT;
228
229 return true;
230}
bool dragging
whether or not this element is currently being dragged
Definition: Element.hpp:83
bool touchable
whether or not this element can be touched (highlights bounds)
Definition: Element.hpp:80
int elasticCounter
how much time is left in an elastic-type flick/scroll set by the last distance traveled in a scroll,...
Definition: Element.hpp:117
int lastMouseY
the last Y, X coordinate of the mouse (from a drag probably)
Definition: Element.hpp:92
bool touchIn(int x, int width, int y, int height)
whether or not a touch is detected within the specified rect in this cycle

◆ onTouchDrag()

bool Element::onTouchDrag ( InputEvents event)

Definition at line 232 of file Element.cpp.

233{
234 bool ret = false;
235
236 if (!event->isTouchDrag())
237 return false;
238
239 // if we're not in a deeplight (a touchdown event), draw our own drag highlight
240 if (this->elasticCounter != DEEP_HIGHLIGHT) {
241 if (event->touchIn(this->xAbs, this->yAbs, this->width, this->height)) {
242 // if there's currently _no_ highlight, and we're in a drag event on this element,
243 // so we should turn on the hover highlight
244 this->elasticCounter = THICK_HIGHLIGHT;
245 ret |= true;
246
247 // play a hover sound and vibrate
248 CST_LowRumble(event, 200);
249
250 // change the cursor to a hand
251 CST_SetCursor(CST_CURSOR_HAND);
252 } else {
253 auto initialElasticCounter = this->elasticCounter;
254
255 // we're in a drag event, but not for this element
256 this->elasticCounter = NO_HIGHLIGHT;
257
258 if (initialElasticCounter != NO_HIGHLIGHT) {
259 // change the cursor back to the arrow
260 CST_SetCursor(CST_CURSOR_ARROW);
261 ret |= true;
262 }
263
264 }
265 }
266
267 // minimum amount of wiggle allowed by finger before calling off a touch event
268 int TRESHOLD = 40 / SCALER / SCALER;
269
270 // we've dragged out of the icon, invalidate the click by invoking onTouchUp early
271 // check if we haven't drifted too far from the starting variable (treshold: 40)
272 if (this->dragging && (abs(event->yPos - this->lastMouseY) >= TRESHOLD || abs(event->xPos - this->lastMouseX) >= TRESHOLD))
273 {
274 ret |= (this->elasticCounter > 0);
275 auto prevElasticCounter = this->elasticCounter;
276 this->elasticCounter = NO_HIGHLIGHT;
277 if (prevElasticCounter != NO_HIGHLIGHT) {
278 // change the cursor back to the arrow
279 CST_SetCursor(CST_CURSOR_ARROW);
280 }
281 }
282
283 return ret;
284}

◆ onTouchUp()

bool Element::onTouchUp ( InputEvents event)

Definition at line 286 of file Element.cpp.

287{
288 if (!event->isTouchUp())
289 return false;
290
291 bool ret = false;
292
293 // ensure we were dragging first (originally checked the treshold above here, but now that actively invalidates it)
294 if (this->dragging)
295 {
296 // check that this click is in the right coordinates for this square
297 // and that a subscreen isn't already being shown
298 // TODO: allow buttons to activae this too?
299 if (event->touchIn(this->xAbs, this->yAbs, this->width, this->height))
300 {
301 // elasticCounter must be nonzero to allow a click through (highlight must be shown)
302 if (this->elasticCounter > 0)
303 {
304 // invoke this element's action
305 if (action != NULL) {
306 this->action();
307 ret |= true;
308 }
309 if (actionWithEvents != NULL) {
310 this->actionWithEvents(event);
311 ret |= true;
312 }
313 }
314 }
315 }
316
317 // release mouse
318 this->dragging = false;
319
320 // update if we were previously highlighted, cause we're about to remove it
321 ret |= (this->elasticCounter > 0);
322
323 this->elasticCounter = 0;
324
325 return ret;
326}
std::function< void()> action
the action to call (from binded callback) on touch or button selection https://stackoverflow....
Definition: Element.hpp:60

◆ position()

void Element::position ( int  x,
int  y 
)

position the element

Definition at line 206 of file Element.cpp.

207{
208 this->x = x;
209 this->y = y;
210}

◆ process()

bool Element::process ( InputEvents event)
virtual

process any input that is received for this element

Reimplemented in Button, EKeyboard, ListElement, and RootDisplay.

Definition at line 17 of file Element.cpp.

18{
19 // whether or not we need to update the screen
20 bool ret = false;
21
22 // if we're hidden, don't process input
23 if (hidden) return ret;
24
25 // if 3ds mock, ignore top screen inputs
26#ifdef _3DS_MOCK
27 if (event->touchIn(0, 0, 400, 240)) return ret;
28#endif
29
30 // do any touch down, drag, or up events
31 if (touchable)
32 {
33 ret |= onTouchDown(event);
34 ret |= onTouchDrag(event);
35 ret |= onTouchUp(event);
36 }
37
38 // call process on subelements
39 for (int x = 0; x < this->elements.size(); x++)
40 if (this->elements.size() > x && this->elements[x])
41 ret |= this->elements[x]->process(event);
42
43 ret |= this->needsRedraw;
44 this->needsRedraw = false;
45
46 // if this variable is positive, decrease it, and force a redraw (acts like needsRedraw but over X redraws)
47 if (futureRedrawCounter > 0) {
49 ret |= true;
50 }
51
52 if (RootDisplay::idleCursorPulsing) {
53 // if we are using idle cursor pulsing, and this element's elastic counter is 0, force a redraw
54 return ret | (this->elasticCounter > 0);
55 }
56
57 return ret;
58}
int futureRedrawCounter
whether this element needs a redraw for the next X redraws (decreases each time) (0 is no redraws)
Definition: Element.hpp:89

References elasticCounter, elements, futureRedrawCounter, hidden, needsRedraw, touchable, and InputEvents::touchIn().

Referenced by Button::process(), ListElement::process(), and RootDisplay::process().

◆ recalcPosition()

void Element::recalcPosition ( Element parent)

Definition at line 140 of file Element.cpp.

140 {
141 // calculate absolute x/y positions
142 if (parent && !isAbsolute)
143 {
144 this->xAbs = parent->xAbs + this->x;
145 this->yAbs = parent->yAbs + this->y;
146 } else {
147 this->xAbs = this->x;
148 this->yAbs = this->y;
149 }
150
151 // go through all constraints and apply them
152 for (Constraint* constraint : constraints)
153 {
154 constraint->apply(this);
155 }
156
157 // go through all animations and apply them
158 // TODO: animations can modify the actual positions, which can mess up constraints
159 if (animations.size() > 0) {
160 std::vector<Animation*> toRemove;
161 for (Animation* animation : animations)
162 {
163 // if there are any animations, we need to re-render
164 needsRedraw = true;
165
166 bool finished = animation->step();
167 if (finished) {
168 toRemove.push_back(animation);
169 }
170 }
171 for (Animation* animation : toRemove) {
172 animations.erase(std::remove(animations.begin(), animations.end(), animation), animations.end());
173 delete animation;
174 }
175 }
176}

◆ remove()

void Element::remove ( Element element)

Definition at line 336 of file Element.cpp.

337{
338 auto position = std::find(elements.begin(), elements.end(), element);
339 if (position != elements.end())
340 elements.erase(position);
341}

◆ removeAll()

void Element::removeAll ( bool  moveToTrash = false)

Definition at line 356 of file Element.cpp.

357{
358 if (moveToTrash) {
359 // store in a list for free-ing up memory later
360 for (auto e : elements) {
361 RootDisplay::mainDisplay->trash.push_back(e);
362 }
363 }
364 elements.clear();
365 constraints.clear(); // remove all constraints too
366 animations.clear();
367}

◆ render()

void Element::render ( Element parent)
virtual

display the current state of the display

Reimplemented in Button, EKeyboard, NetImageElement, ProgressBar, RootDisplay, and Texture.

Definition at line 60 of file Element.cpp.

61{
62 //if we're hidden, don't render
63 if (hidden) return;
64
65 // this needs to happen before any rendering
66 this->recalcPosition(parent);
67
68 // if we're in debug mode, draw an outline
69 if (this->hasBackground) {
70 // render the element background
71 this->renderBackground(true);
72 }
73 else if (RootDisplay::isDebug) {
74 backgroundColor = randomColor();
75 this->renderBackground(false);
76 }
77
78 // go through every subelement and run render
79 for (Element* subelement : elements)
80 {
81 subelement->render(this);
82 }
83
84 CST_Renderer* renderer = getRenderer();
85
86 // if we're touchable, and we have some animation counter left, draw a rectangle+overlay
87 if (this->touchable && this->elasticCounter > THICK_HIGHLIGHT)
88 {
89 auto marginSpacing = cornerRadius > 0 ? 0 : 5;
90 CST_Rect d = { this->xAbs - marginSpacing, this->yAbs - marginSpacing, this->width + marginSpacing*2, this->height + marginSpacing*2 };
91 if (cornerRadius > 0) {
92 // draw a rounded highlight instead
93 CST_roundedBoxRGBA(renderer, d.x, d.y, d.x + d.w, d.y + d.h,
94 cornerRadius, 0x10, 0xD9, 0xD9, 0x40);
95 } else {
96 CST_SetDrawBlend(renderer, true);
97 CST_SetDrawColorRGBA(renderer, 0x10, 0xD9, 0xD9, 0x40);
98 CST_FillRect(renderer, &d);
99 }
100 }
101
102 if (this->touchable && this->elasticCounter > NO_HIGHLIGHT)
103 {
104 auto marginSpacing = cornerRadius > 0 ? 0 : 5;
105 CST_Rect d = { this->xAbs - marginSpacing, this->yAbs - marginSpacing, this->width + marginSpacing*2, this->height + marginSpacing*2 };
106 if (this->elasticCounter == THICK_HIGHLIGHT)
107 {
108 int ticks = CST_GetTicks() / 100;
109 int pulseState = ticks % 20;
110 if (pulseState > 9) {
111 pulseState = 19 - pulseState;
112 }
113
114 if (!RootDisplay::idleCursorPulsing) {
115 // if we're not using idle cursor pulsing, just draw a simple rectangle
116 pulseState = 0;
117 }
118
119 // make it a little thicker by drawing more rectangles TODO: better way to do this?
120 auto decreaser = cornerRadius > 0 ? 0 : -2;
121 for (int x = decreaser; x <= 3; x++)
122 {
123 // draw a rectangle with varying brightness depending on the pulse state
124 int r = 0x10; //- 0x01 * pulseState;
125 int g = 0xD9 - 0x01 * pulseState;
126 int b = 0xD9 - 0x01 * pulseState;
127 int edgeMod = x==1 ? 0 : abs(x); // slight bias towards the inner
128 int a = fmax(0x0, 0xFF - 0x10 * pulseState * edgeMod);
129 CST_roundedRectangleRGBA(renderer, d.x + x, d.y + x, d.x + d.w - x, d.y + d.h - x, cornerRadius, r, g, b, a);
130 }
131 } else {
132 // simple rectangle, not pulsing
133 CST_roundedRectangleRGBA(renderer, d.x, d.y, d.x + d.w, d.y + d.h, cornerRadius, 0x10, 0xD9, 0xD9, 0xFF);
134 // and one inner rectangle too
135 CST_roundedRectangleRGBA(renderer, d.x + 1, d.y + 1, d.x + d.w - 1, d.y + d.h - 1, cornerRadius, 0x10, 0xD9, 0xD9, 0xFF);
136 }
137 }
138}

References elasticCounter, elements, hidden, parent, touchable, and width.

Referenced by Button::render(), EKeyboard::render(), RootDisplay::render(), Texture::render(), and screenshot().

◆ renderBackground()

void Element::renderBackground ( bool  fill = true)

Definition at line 188 of file Element.cpp.

188 {
189 CST_Renderer* renderer = getRenderer();
190 CST_Rect bounds = getBounds();
191 auto r = backgroundColor.r * 0xFF;
192 auto g = backgroundColor.g * 0xFF;
193 auto b = backgroundColor.b * 0xFF;
194
195 if (cornerRadius > 0) {
196 const auto renderRect = fill ? CST_roundedBoxRGBA : CST_roundedRectangleRGBA;
197 renderRect(renderer, bounds.x, bounds.y, bounds.x + bounds.w, bounds.y + bounds.h,
198 cornerRadius, backgroundColor.r * 0xFF, backgroundColor.g * 0xFF, backgroundColor.b * 0xFF, 0xFF);
199 } else {
200 CST_SetDrawColorRGBA(renderer, r, g, b, 0xFF);
201 const auto renderRect = fill ? CST_FillRect : CST_DrawRect;
202 renderRect(renderer, &bounds);
203 }
204}

◆ screenshot()

void Element::screenshot ( std::string  path)

Take a screenshot of this element and its children, and save it to the given path.

Definition at line 449 of file Element.cpp.

449 {
450 // render the webview to a target that can be saved (TARGET ACCESS)
451 CST_Texture* target = SDL_CreateTexture(getRenderer(), SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, width, height);
452
453 // set the target texture
454 SDL_SetRenderTarget(getRenderer(), target);
455
456 // draw a white background first
457 SDL_SetRenderDrawColor(getRenderer(), 255, 255, 255, 255);
458 SDL_RenderClear(getRenderer());
459
460 // render the texture
461 render(parent);
462
463 // reset the target texture
464 SDL_SetRenderTarget(getRenderer(), NULL);
465
466 // save the surface to the path
467 CST_SavePNG(target, path.c_str());
468}
virtual void render(Element *parent)
display the current state of the display
Definition: Element.cpp:60

References parent, render(), and width.

◆ setAbsolute()

Element * Element::setAbsolute ( bool  isAbs)

Definition at line 406 of file Element.cpp.

407{
408 isAbsolute = isAbs;
409 return this;
410}

◆ setAction()

Element * Element::setAction ( std::function< void()>  func)

Definition at line 383 of file Element.cpp.

384{
385 this->action = func;
386 return this;
387}

◆ setPosition()

Element * Element::setPosition ( int  x,
int  y 
)

Definition at line 377 of file Element.cpp.

378{
379 this->position(x, y);
380 return this;
381}

◆ setTouchable()

Element * Element::setTouchable ( bool  touchable)

Definition at line 443 of file Element.cpp.

444{
445 this->touchable = touchable;
446 return this;
447}

◆ unhide()

void Element::unhide ( )
inline

Definition at line 53 of file Element.hpp.

53{ this->hidden = false; }

◆ wipeAll()

void Element::wipeAll ( bool  delSelf = false)

Definition at line 343 of file Element.cpp.

344{
345 // delete's this element's children, then itself
346 for (auto child : elements) {
347 child->wipeAll(true);
348 }
349 elements.clear();
350
351 if (delSelf && !isProtected) {
352 delete this;
353 }
354}

Member Data Documentation

◆ action

std::function<void()> 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 60 of file Element.hpp.

Referenced by Button::process().

◆ actionWithEvents

std::function<void(InputEvents* event)> Element::actionWithEvents = NULL

Definition at line 61 of file Element.hpp.

◆ angle

double Element::angle = 0

rotation angle in degrees

Definition at line 130 of file Element.hpp.

Referenced by Texture::render().

◆ animations

std::vector<Animation*> Element::animations

Definition at line 163 of file Element.hpp.

◆ backgroundColor

rgb Element::backgroundColor = {0, 0, 0}

Definition at line 98 of file Element.hpp.

◆ constraints

std::vector<Constraint*> Element::constraints

Definition at line 159 of file Element.hpp.

◆ cornerRadius

int Element::cornerRadius = 0

Definition at line 136 of file Element.hpp.

◆ dragging

bool Element::dragging = false

whether or not this element is currently being dragged

Definition at line 83 of file Element.hpp.

◆ elasticCounter

int 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 117 of file Element.hpp.

Referenced by process(), and render().

◆ elements

std::vector<Element*> Element::elements

visible GUI child elements of this element

Definition at line 64 of file Element.hpp.

Referenced by process(), and render().

◆ futureRedrawCounter

int Element::futureRedrawCounter = 0

whether this element needs a redraw for the next X redraws (decreases each time) (0 is no redraws)

Definition at line 89 of file Element.hpp.

Referenced by process().

◆ hasBackground

bool Element::hasBackground = false

Definition at line 95 of file Element.hpp.

◆ height

int Element::height = 0

Definition at line 120 of file Element.hpp.

◆ hidden

bool Element::hidden = false

whether this element should skip rendering or not

Definition at line 107 of file Element.hpp.

Referenced by EKeyboard::process(), process(), ListElement::process(), Button::render(), EKeyboard::render(), render(), NetImageElement::render(), ProgressBar::render(), and Texture::render().

◆ isAbsolute

bool Element::isAbsolute = false

Definition at line 101 of file Element.hpp.

◆ isProtected

bool Element::isProtected = false

Definition at line 113 of file Element.hpp.

◆ lastMouseX

int Element::lastMouseX = 0

Definition at line 92 of file Element.hpp.

◆ lastMouseY

int Element::lastMouseY = 0

the last Y, X coordinate of the mouse (from a drag probably)

Definition at line 92 of file Element.hpp.

◆ maskColor

CST_Color Element::maskColor = {0,0,0,0}

The color to overlay on top.

Definition at line 180 of file Element.hpp.

Referenced by Texture::render().

◆ needsRedraw

bool Element::needsRedraw = false

whether or not this element needs the screen redrawn next time it's processed

Definition at line 86 of file Element.hpp.

Referenced by process(), and InputEvents::processSDLEvents().

◆ parent

Element* Element::parent = NULL

the parent element (can sometimes be null if it isn't set)

Definition at line 104 of file Element.hpp.

Referenced by Button::render(), render(), NetImageElement::render(), ProgressBar::render(), RootDisplay::render(), Texture::render(), and screenshot().

◆ scale

float Element::scale = 1.0f

Definition at line 77 of file Element.hpp.

◆ touchable

bool Element::touchable = false

whether or not this element can be touched (highlights bounds)

Definition at line 80 of file Element.hpp.

Referenced by process(), and render().

◆ useColorMask

bool Element::useColorMask = false

whether or not to overlay a color mask on top of this element

Definition at line 177 of file Element.hpp.

Referenced by Texture::render().

◆ width

int 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 120 of file Element.hpp.

Referenced by Texture::loadPath(), NetImageElement::NetImageElement(), EKeyboard::process(), Button::render(), EKeyboard::render(), render(), NetImageElement::render(), Texture::render(), Texture::resize(), screenshot(), and TextElement::update().

◆ x

int Element::x = 0

Definition at line 125 of file Element.hpp.

◆ xAbs

int Element::xAbs = 0

Definition at line 128 of file Element.hpp.

◆ xOff

int Element::xOff = 0

Definition at line 133 of file Element.hpp.

◆ y

int Element::y = 0

Definition at line 125 of file Element.hpp.

◆ yAbs

int Element::yAbs = 0

Definition at line 128 of file Element.hpp.

◆ yOff

int Element::yOff = 0

Definition at line 133 of file Element.hpp.


The documentation for this class was generated from the following files: