| 277 | } |
| 278 | |
| 279 | void SettingsScreen::drawTop(void) const |
| 280 | { |
| 281 | C2D_TargetClear(g_top, COLOR_BASE); |
| 282 | C2D_TargetClear(g_bottom, COLOR_BASE); |
| 283 | C2D_SceneBegin(g_top); |
| 284 | |
| 285 | // Header bar. |
| 286 | C2D_DrawRectSolid(0, 0, 0.5f, 400, 24, COLOR_SURFACE); |
| 287 | C2D_DrawRectSolid(0, 24, 0.5f, 400, 1, COLOR_LINE); |
| 288 | C2D_ImageTint brandTint; |
| 289 | C2D_PlainImageTint(&brandTint, COLOR_ACCENT, 1.0f); |
| 290 | C2D_DrawImageAt(flag, 6, 3, 0.5f, &brandTint, 1.0f, 1.0f); |
| 291 | float nameX = 6 + ceilf(flag.subtex->width * 1.0f) + 6; |
| 292 | TextPool::get().draw(i18n::t("settings.title"), nameX, 4, 0.5f, COLOR_TEXT); |
| 293 | { |
| 294 | std::string right = "config.json"; |
| 295 | float w = TextPool::get().width(right, 0.42f); |
| 296 | TextPool::get().draw(right, 400 - 6 - w, 6, 0.42f, COLOR_FAINT); |
| 297 | } |
| 298 | |
| 299 | // Section rail (left) + section blurb card (right). |
| 300 | const size_t sel = navHid.index(); |
| 301 | const float lineFeed = fontGetInfo(NULL)->lineFeed; |
| 302 | for (size_t i = 0; i < SECTION_COUNT; i++) { |
| 303 | const int rowY = 34 + (int)i * 32; |
| 304 | const bool isSel = i == sel; |
| 305 | if (isSel) { |
| 306 | C2D_DrawRectSolid(8, rowY, 0.5f, 150, 28, C2D_Color32(122, 66, 196, 40)); |
| 307 | Gui::drawOutline(8, rowY, 150, 28, 1, contentFocus ? COLOR_LINE : COLOR_ACCENT); |
| 308 | } |
| 309 | const int chipY = rowY + 4, chipSz = 20; |
| 310 | C2D_DrawRectSolid(14, chipY, 0.5f, chipSz, chipSz, isSel ? COLOR_ACCENT : COLOR_RAISED); |
| 311 | { |
| 312 | const float cw = TextPool::get().width(SECTIONS[i].letter, 0.5f); |
| 313 | const float cy = chipY + (chipSz - 0.5f * lineFeed) / 2; |
| 314 | TextPool::get().draw(SECTIONS[i].letter, 14 + (chipSz - cw) / 2, cy, 0.5f, isSel ? COLOR_WHITE : COLOR_MUTED); |
| 315 | } |
| 316 | // Name is vertically centered against the chip square rather than top-aligned. |
| 317 | const float ny = chipY + (chipSz - 0.44f * lineFeed) / 2; |
| 318 | TextPool::get().draw(i18n::t(SECTIONS[i].nameKey), 42, ny, 0.44f, isSel ? COLOR_TEXT : COLOR_MUTED); |
| 319 | } |
| 320 | |
| 321 | // Blurb card. |
| 322 | C2D_DrawRectSolid(166, 34, 0.5f, 226, 160, COLOR_CARD); |
| 323 | Gui::drawOutline(166, 34, 226, 160, 1, COLOR_LINE); |
| 324 | TextPool::get().draw(i18n::t(SECTIONS[sel].nameKey), 178, 44, 0.5f, COLOR_TEXT); |
| 325 | TextPool::get().drawWrapped(i18n::t(SECTIONS[sel].blurbKey), 178, 66, 0.44f, COLOR_MUTED, 202); |
| 326 | |
| 327 | // Footer. |
| 328 | C2D_DrawRectSolid(0, 220, 0.5f, 400, 20, COLOR_SURFACE); |
| 329 | C2D_DrawRectSolid(0, 219, 0.5f, 400, 1, COLOR_LINE); |
| 330 | if (contentFocus) { |
| 331 | drawHints(400, 223, std::string(GLYPH_B) + " " + i18n::t("settings.hint.back_sections")); |
| 332 | } |
| 333 | else { |
| 334 | std::string hints = std::string(GLYPH_DPAD) + " " + i18n::t("settings.hint.section") + " "; |
| 335 | if (sectionInteractive(sel)) { |
| 336 | hints += std::string(GLYPH_A) + " " + i18n::t("hint.edit") + " "; |
nothing calls this directly
no test coverage detected