| 24 | namespace Jazz2::UI::Menu |
| 25 | { |
| 26 | MainMenu::MainMenu(IRootController* root, bool afterIntro) |
| 27 | : _root(root), _activeCanvas(ActiveCanvas::Background), _transitionWhite(afterIntro ? 1.0f : 0.0f), |
| 28 | _logoTransition(0.0f), _texturedBackgroundPass(this), _texturedBackgroundPhase(0.0f), |
| 29 | _pressedKeys(ValueInit, (std::size_t)Keys::Count), _pressedActions(0), _lastNavigationFlags(NavigationFlags::AllowAll), |
| 30 | _touchButtonsTimer(0.0f) |
| 31 | { |
| 32 | theApplication().GetGfxDevice().setWindowTitle("Jazz² Resurrection"_s); |
| 33 | |
| 34 | _texturedBackgroundLayer.Visible = false; |
| 35 | _canvasBackground = std::make_unique<MenuBackgroundCanvas>(this); |
| 36 | _canvasClipped = std::make_unique<MenuClippedCanvas>(this); |
| 37 | _canvasOverlay = std::make_unique<MenuOverlayCanvas>(this); |
| 38 | |
| 39 | auto& resolver = ContentResolver::Get(); |
| 40 | resolver.BeginLoading(); |
| 41 | |
| 42 | // It will also replace palette for subsequent `RequestMetadata()` |
| 43 | PrepareTexturedBackground(); |
| 44 | |
| 45 | _metadata = resolver.RequestMetadata("UI/MainMenu"_s); |
| 46 | DEATH_ASSERT(_metadata != nullptr, "Cannot load required metadata", ); |
| 47 | |
| 48 | _smallFont = resolver.GetFont(FontType::Small); |
| 49 | _mediumFont = resolver.GetFont(FontType::Medium); |
| 50 | |
| 51 | PlayMenuMusic(); |
| 52 | |
| 53 | resolver.EndLoading(); |
| 54 | |
| 55 | // Mark Fire and Menu button as already pressed to avoid some issues |
| 56 | _pressedActions = (1 << (int32_t)PlayerAction::Fire) | (1 << ((int32_t)PlayerAction::Fire + 16)) | |
| 57 | (1 << (int32_t)PlayerAction::Menu) | (1 << ((int32_t)PlayerAction::Menu + 16)); |
| 58 | |
| 59 | SwitchToSection<BeginSection>(); |
| 60 | |
| 61 | #if !defined(DEATH_TARGET_EMSCRIPTEN) |
| 62 | bool isPlayable = ((_root->GetFlags() & IRootController::Flags::IsPlayable) == IRootController::Flags::IsPlayable); |
| 63 | if (PreferencesCache::FirstRun && isPlayable) { |
| 64 | // Show intro section on the first run |
| 65 | SwitchToSection<FirstRunSection>(); |
| 66 | } |
| 67 | #endif |
| 68 | |
| 69 | UpdateRichPresence(); |
| 70 | } |
| 71 | |
| 72 | MainMenu::~MainMenu() |
| 73 | { |
nothing calls this directly
no test coverage detected