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

Method drawToggleRow

3ds/source/SettingsScreen.cpp:215–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

drawOutlineFunction · 0.85
getFunction · 0.85
drawMethod · 0.45

Tested by

no test coverage detected