| 479 | |
| 480 | |
| 481 | void redrawMenu() { |
| 482 | PrintConsole* oldConsole = getPrintConsole(); |
| 483 | setPrintConsole(menuConsole); |
| 484 | consoleClear(); |
| 485 | |
| 486 | // Top line: submenu |
| 487 | int pos=0; |
| 488 | int nameStart = (32-strlen(menuList[menu].name)-2)/2; |
| 489 | if (option == -1) { |
| 490 | nameStart-=2; |
| 491 | iprintfColored(CONSOLE_COLOR_LIGHT_GREEN, "<"); |
| 492 | } |
| 493 | else |
| 494 | iprintf("<"); |
| 495 | pos++; |
| 496 | for (; pos<nameStart; pos++) |
| 497 | iprintf(" "); |
| 498 | if (option == -1) { |
| 499 | iprintfColored(CONSOLE_COLOR_LIGHT_YELLOW, "* "); |
| 500 | pos += 2; |
| 501 | } |
| 502 | { |
| 503 | int color = (option == -1 ? CONSOLE_COLOR_LIGHT_YELLOW : CONSOLE_COLOR_WHITE); |
| 504 | iprintfColored(color, "[%s]", menuList[menu].name); |
| 505 | } |
| 506 | pos += 2 + strlen(menuList[menu].name); |
| 507 | if (option == -1) { |
| 508 | iprintfColored(CONSOLE_COLOR_LIGHT_YELLOW, " *"); |
| 509 | pos += 2; |
| 510 | } |
| 511 | for (; pos < 31; pos++) |
| 512 | iprintf(" "); |
| 513 | if (option == -1) |
| 514 | iprintfColored(CONSOLE_COLOR_LIGHT_GREEN, ">"); |
| 515 | else |
| 516 | iprintf(">"); |
| 517 | iprintf("\n"); |
| 518 | |
| 519 | // Rest of the lines: options |
| 520 | for (int i=0; i<menuList[menu].numOptions; i++) { |
| 521 | int option_color; |
| 522 | if (!menuList[menu].options[i].enabled) |
| 523 | option_color = CONSOLE_COLOR_GREY; |
| 524 | else if (option == i) |
| 525 | option_color = CONSOLE_COLOR_LIGHT_YELLOW; |
| 526 | else |
| 527 | option_color = CONSOLE_COLOR_WHITE; |
| 528 | |
| 529 | if (menuList[menu].options[i].numValues == 0) { |
| 530 | for (unsigned int j=0; j<(32-strlen(menuList[menu].options[i].name))/2-2; j++) |
| 531 | iprintf(" "); |
| 532 | if (i == option) { |
| 533 | iprintfColored(option_color, "* %s *\n\n", menuList[menu].options[i].name); |
| 534 | } |
| 535 | else |
| 536 | iprintfColored(option_color, " %s \n\n", menuList[menu].options[i].name); |
| 537 | } |
| 538 | else { |
nothing calls this directly
no test coverage detected