1#include "ProgressBar.hpp"
2#include "RootDisplay.hpp"
4ProgressBar::ProgressBar()
9 this->color = 0x56c1dfff;
17 if (this->percent < 0)
20 auto renderer = getRenderer();
25 CST_Rect dim = { 0, 0, RootDisplay::screenWidth, RootDisplay::screenHeight };
27 CST_SetDrawBlend(renderer,
true);
28 CST_SetDrawColorRGBA(renderer, 0x00, 0x00, 0x00, 0xbb);
29 CST_FillRect(renderer, &dim);
32 this->recalcPosition(
parent);
34 int blue = this->color;
39 gray_rect.x = this->xAbs;
40 gray_rect.y = this->yAbs - 4;
41 gray_rect.w = this->width;
44 CST_SetDrawColorRGBA(renderer, 0x98, 0x98, 0x98, 0xff);
45 CST_FillRect(renderer, &gray_rect);
48 CST_filledCircleRGBA(renderer, this->xAbs + this->width, this->yAbs, 4, 0x98, 0x98, 0x98, 0xff);
51 CST_filledCircleRGBA(renderer, this->xAbs, this->yAbs, 4, 0x56, 0xc1, 0xdf, 0xff);
55 blue_rect.x = this->xAbs;
56 blue_rect.y = this->yAbs - 4;
57 blue_rect.w = this->width * this->percent;
60 CST_SetDrawColorRGBA(renderer, 0x56, 0xc1, 0xdf, 0xff);
61 CST_FillRect(renderer, &blue_rect);
64 CST_filledCircleRGBA(renderer, this->xAbs + width * this->percent, this->yAbs, 4, 0x56, 0xc1, 0xdf, 0xff);
bool hidden
whether this element should skip rendering or not
Element * parent
the parent element (can sometimes be null if it isn't set)
void render(Element *parent)
display the current state of the display