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

Method drawToggleRow

3ds/source/SettingsScreen.cpp:220–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void SettingsScreen::drawToggleRow(int y, const std::string& name, const std::string& sub, bool on, bool focused) const
221{
222 const int rowH = 32;
223 if (focused) {
224 C2D_DrawRectSolid(6, y, 0.5f, 308, rowH, C2D_Color32(122, 66, 196, 40));
225 Gui::drawOutline(6, y, 308, rowH, 1, COLOR_ACCENT);
226 }
227 TextPool::get().draw(name, 14, y + 4, 0.44f, COLOR_TEXT);
228 TextPool::get().draw(sub, 14, y + 18, 0.36f, COLOR_FAINT);
229
230 // Rectangular toggle, right-aligned: a track with a sliding square knob.
231 const int tw = 34, th = 18, tx = 320 - 14 - tw, ty = y + (rowH - th) / 2;
232 C2D_DrawRectSolid(tx, ty, 0.5f, tw, th, on ? COLOR_ACCENT : COLOR_RAISED);
233 const int knob = 14, kpad = 2;
234 const int knobX = on ? tx + tw - kpad - knob : tx + kpad;
235 // Knob contrasts with its track in both themes: white on the accent fill when
236 // on, a muted grey on the raised track when off (white-on-light-grey is unreadable).
237 C2D_DrawRectSolid(knobX, ty + kpad, 0.6f, knob, th - 2 * kpad, on ? COLOR_WHITE : COLOR_MUTED);
238}
239
240void SettingsScreen::drawValueRow(int y, const std::string& name, const std::string& sub, const std::string& value, bool focused) const
241{

Callers

nothing calls this directly

Calls 3

drawOutlineFunction · 0.85
getFunction · 0.85
drawMethod · 0.45

Tested by

no test coverage detected