1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Removed GameEngine::curInt member

- event processing is now initiated by GameEngine instead of weird chain
engine -> player interface -> engine
- introduced GameEngineUser interface (implemented by GameInstance) to
remove mutual depedency between GameEngine and GameInstance (some
technically still remains for now, in form of some free functions)
This commit is contained in:
Ivan Savenko
2025-02-27 22:18:31 +00:00
parent f06e707108
commit d3de0d525f
16 changed files with 87 additions and 72 deletions

View File

@@ -331,11 +331,7 @@ CMainMenu::CMainMenu()
backgroundAroundMenu = std::make_shared<CFilledTexture>(ImagePath::builtin("DIBOXBCK"), pos);
}
CMainMenu::~CMainMenu()
{
if(ENGINE->curInt == this)
ENGINE->curInt = nullptr;
}
CMainMenu::~CMainMenu() = default;
void CMainMenu::playIntroVideos()
{
@@ -386,21 +382,11 @@ void CMainMenu::onScreenResize()
backgroundAroundMenu->pos = pos;
}
void CMainMenu::update()
void CMainMenu::makeActiveInterface()
{
if(CMM != this->shared_from_this()) //don't update if you are not a main interface
return;
if(ENGINE->windows().count() == 0)
{
ENGINE->windows().pushWindow(CMM);
ENGINE->windows().pushWindow(menu);
menu->switchToTab(menu->getActiveTab());
}
// Handles mouse and key input
ENGINE->handleEvents();
ENGINE->windows().simpleRedraw();
ENGINE->windows().pushWindow(CMM);
ENGINE->windows().pushWindow(menu);
menu->switchToTab(menu->getActiveTab());
}
void CMainMenu::openLobby(ESelectionScreen screenType, bool host, const std::vector<std::string> & names, ELoadMode loadMode)