1#include "ProgressBar.hpp"
2#include "RootDisplay.hpp"
6ProgressBar::ProgressBar()
11 this->color = 0x56c1dfff;
19 if (this->percent < 0)
22 auto renderer = getRenderer();
27 CST_Rect dim = { 0, 0, RootDisplay::screenWidth, RootDisplay::screenHeight };
29 CST_SetDrawBlend(renderer,
true);
30 CST_SetDrawColorRGBA(renderer, 0x00, 0x00, 0x00, 0xbb);
31 CST_FillRect(renderer, &dim);
34 this->recalcPosition(
parent);
41 gray_rect.x = this->xAbs;
42 gray_rect.y = this->yAbs - 4;
43 gray_rect.w = this->
width;
46 CST_SetDrawColorRGBA(renderer, 0x98, 0x98, 0x98, 0xff);
47 CST_FillRect(renderer, &gray_rect);
50 CST_filledCircleRGBA(renderer, this->xAbs + this->
width, this->yAbs, 4, 0x98, 0x98, 0x98, 0xff);
53 CST_filledCircleRGBA(renderer, this->xAbs, this->yAbs, 4, 0x56, 0xc1, 0xdf, 0xff);
57 blue_rect.x = this->xAbs;
58 blue_rect.y = this->yAbs - 4;
59 blue_rect.w = this->
width * this->percent;
62 if (this->percent > 1) {
64 blue_rect.w = this->
width;
67 CST_SetDrawColorRGBA(renderer, 0x56, 0xc1, 0xdf, 0xff);
68 CST_FillRect(renderer, &blue_rect);
71 CST_filledCircleRGBA(renderer, this->xAbs +
width * this->percent, this->yAbs, 4, 0x56, 0xc1, 0xdf, 0xff);
int width
width and height of this element (must be manually set, isn't usually calculated (but is in some case...
bool hidden
whether this element should skip rendering or not
Element * parent
the parent element (reference only, not owned)
void render(Element *parent)
display the current state of the display