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

Function drawRailItem

switch/source/MainScreen.cpp:142–154  ·  view source on GitHub ↗

A save-kind rail button: square (radius 0), filled accent when active, faint fill otherwise, with the single kind letter over the small kind label.

Source from the content-addressed store, hash-verified

140 // A save-kind rail button: square (radius 0), filled accent when active,
141 // faint fill otherwise, with the single kind letter over the small kind label.
142 void drawRailItem(int y, const SaveKind& kind, bool active)
143 {
144 Shapes::fillRound(RAIL_ITEM_X, y, RAIL_ITEM, RAIL_ITEM, 0, active ? COLOR_ACCENT : COLOR_FILL1);
145 Color fg = active ? COLOR_WHITE : COLOR_TEXT2;
146
147 u32 gw, gh, lw, lh;
148 Gfx::GetTextDimensions(16, kind.buttonLabel, &gw, &gh);
149 Gfx::GetTextDimensions(9, kind.railLabel, &lw, &lh);
150 const int stackH = (int)gh + 2 + (int)lh;
151 const int top = y + (RAIL_ITEM - stackH) / 2;
152 Gfx::DrawText(16, RAIL_ITEM_X + (RAIL_ITEM - (int)gw) / 2, top, fg, kind.buttonLabel);
153 Gfx::DrawText(9, RAIL_ITEM_X + (RAIL_ITEM - (int)lw) / 2, top + (int)gh + 2, fg, kind.railLabel);
154 }
155
156 // Size of the shoulder-key system glyph drawn inside an action button.
157 constexpr int ACTION_GLYPH_SIZE = 26;

Callers 1

drawMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected