MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / drawProgressBar

Method drawProgressBar

3ds/source/gui.cpp:86–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86void Gui::drawProgressBar(float x, float y, float w, float h, float frac, const std::string& leftLabel, const std::string& rightLabel)
87{
88 if (frac > 1.0f) {
89 frac = 1.0f;
90 }
91 if (frac < 0.0f) {
92 frac = 0.0f;
93 }
94 TextPool& text = TextPool::get();
95 C2D_DrawRectSolid(x, y, 0.5f, w, h, COLOR_BLACK_MEDIUM);
96 float fillW = w * frac;
97 if (fillW > 0) {
98 C2D_DrawRectSolid(x, y, 0.5f, fillW, h, COLOR_ACCENT);
99 }
100 text.draw(leftLabel, x, y + h + 3, 0.42f, COLOR_FAINT);
101 text.draw(rightLabel, x + w - ceilf(text.width(rightLabel, 0.42f)), y + h + 3, 0.42f, COLOR_TEXT);
102}

Callers

nothing calls this directly

Calls 3

getFunction · 0.85
drawMethod · 0.45
widthMethod · 0.45

Tested by

no test coverage detected