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

Method drawButton

switch/source/ScriptRequestOverlays.cpp:95–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95void ScriptTileOverlay::drawButton(int x, int w, const std::string& label, bool focused) const
96{
97 // Square fill, not fillRound: focusRing is a square pulsing outline (it
98 // ignores its radius), so a rounded body would leave the corners of the
99 // selected button sticking out of its own ring.
100 Gfx::DrawRect(x, buttonRowY(), w, BTN_H, focused ? COLOR_ACCENT : COLOR_FILL1);
101 u32 lw, lh;
102 Gfx::GetTextDimensions(ScriptTile::BODY_SIZE, label.c_str(), &lw, &lh);
103 Gfx::DrawText(
104 ScriptTile::BODY_SIZE, x + (w - (int)lw) / 2, buttonRowY() + (BTN_H - (int)lh) / 2, focused ? COLOR_WHITE : COLOR_TEXT2, label.c_str());
105 if (focused) {
106 Shapes::focusRing(x, buttonRowY(), w, BTN_H, 8, COLOR_ACCENT);
107 }
108}
109
110/* ---- gui_message -------------------------------------------------------- */
111

Callers

nothing calls this directly

Calls 1

buttonRowYFunction · 0.85

Tested by

no test coverage detected