MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / RenderTitleMenu

Method RenderTitleMenu

TombEngine/Renderer/RendererDrawMenu.cpp:527–611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525 }
526
527 void Renderer::RenderTitleMenu(Menu menu)
528 {
529 int titleOption = g_Gui.GetSelectedOption();
530 int selectedOption = 0;
531
532 auto plainColor = g_GameFlow->GetSettings()->UI.PlainTextColor;
533 auto menuPos = (Vector2i)(g_GameFlow->GetSettings()->UI.TitleMenuPosition * (DISPLAY_SPACE_RES / 100.0f));
534 auto alignment = g_GameFlow->GetSettings()->UI.TitleMenuAlignment.has_value() ? (1 << (int)g_GameFlow->GetSettings()->UI.TitleMenuAlignment.value()) : 0;
535 auto scale = g_GameFlow->GetSettings()->UI.TitleMenuScale;
536
537 // HACK: fix for Monty's color range slippage. Should be removed after merging color range fix PR.
538 auto plainRawColor = Vector4(plainColor.GetR(), plainColor.GetG(), plainColor.GetB(), UCHAR_MAX) / (float)UCHAR_MAX;
539
540 switch (menu)
541 {
542 case Menu::Title:
543
544 // New game
545 AddString(g_GameFlow->GetString(STRING_NEW_GAME), menuPos.ToVector2(), plainRawColor, scale, SF(titleOption == selectedOption) | alignment);
546 GetNextLinePosition(&menuPos.y, scale);
547 selectedOption++;
548
549 // Home Level
550 if (g_GameFlow->IsHomeLevelEnabled())
551 {
552 AddString(g_GameFlow->GetString(STRING_HOME_LEVEL), menuPos.ToVector2(), plainRawColor, scale, SF(titleOption == selectedOption) | alignment);
553 GetNextLinePosition(&menuPos.y, scale);
554 selectedOption++;
555 }
556
557 // Load game
558 if (g_GameFlow->IsLoadSaveEnabled())
559 {
560 AddString(g_GameFlow->GetString(STRING_LOAD_GAME), menuPos.ToVector2(), plainRawColor, scale, SF(titleOption == selectedOption) | alignment);
561 GetNextLinePosition(&menuPos.y, scale);
562 selectedOption++;
563 }
564
565 // Options
566 AddString(g_GameFlow->GetString(STRING_OPTIONS), menuPos.ToVector2(), plainRawColor, scale, SF(titleOption == selectedOption) | alignment);
567 GetNextLinePosition(&menuPos.y, scale);
568 selectedOption++;
569
570 // Exit game
571 AddString(g_GameFlow->GetString(STRING_EXIT_GAME), menuPos.ToVector2(), plainRawColor, scale, SF(titleOption == selectedOption) | alignment);
572 break;
573
574 case Menu::LoadGame:
575 RenderLoadSaveMenu();
576 break;
577
578 case Menu::SelectLevel:
579
580 // Setup needed parameters
581 menuPos.y = MenuVerticalLineSpacing;
582
583 // Title
584 AddString(MenuCenterEntry, 26, g_GameFlow->GetString(STRING_SELECT_LEVEL), g_GameFlow->GetSettings()->UI.HeaderTextColor, SF_Center());

Callers

nothing calls this directly

Calls 15

SFFunction · 0.85
GetNextLinePositionFunction · 0.85
SF_CenterFunction · 0.85
GetNextBlockPositionFunction · 0.85
GetSelectedOptionMethod · 0.80
GetSettingsMethod · 0.80
GetStringMethod · 0.80
IsHomeLevelEnabledMethod · 0.80
IsLoadSaveEnabledMethod · 0.80
GetNumLevelsMethod · 0.80
GetLevelMethod · 0.80

Tested by

no test coverage detected