Fixed game mode menu

This commit is contained in:
2026-04-20 22:10:17 +03:00
parent 6d7fcb1157
commit ef708fa14a
2 changed files with 21 additions and 5 deletions

View File

@@ -208,6 +208,8 @@ void EditorApp::setup()
// Setup UI system
m_uiSystem = std::make_unique<EditorUISystem>(
m_world, m_sceneMgr, getRenderWindow());
if (m_uiSystem)
m_uiSystem->setEditorUIEnabled(m_gameMode == GameMode::Editor);
// Setup physics system
m_physicsSystem = std::make_unique<EditorPhysicsSystem>(
@@ -286,8 +288,13 @@ void EditorApp::setup()
if (m_gameMode == GameMode::Game) {
// Load startup menu scene configured in editor
SceneSerializer serializer(m_world, m_sceneMgr);
if (!serializer.loadFromFile("startup_menu.json",
m_uiSystem.get())) {
Ogre::LogManager::getSingleton().logMessage(
"Game mode: Loading startup_menu.json...");
if (serializer.loadFromFile("startup_menu.json",
m_uiSystem.get())) {
Ogre::LogManager::getSingleton().logMessage(
"Game mode: startup_menu.json loaded");
} else {
Ogre::LogManager::getSingleton().logMessage(
"Game mode: Failed to load startup_menu.json: " +
serializer.getLastError());
@@ -383,7 +390,7 @@ void EditorApp::startNewGame(const Ogre::String &scenePath)
clearScene();
SceneSerializer serializer(m_world, m_sceneMgr);
if (serializer.loadFromFile(scenePath, m_uiSystem.get())) {
m_gamePlayState = GamePlayState::Playing;
setGamePlayState(GamePlayState::Playing);
Ogre::LogManager::getSingleton().logMessage(
"Game started: loaded scene " + scenePath);
} else {

View File

@@ -76,7 +76,13 @@ void StartupMenuSystem::prepareFont()
if (menuEntity.is_alive()) {
auto &sm = menuEntity.get_mut<StartupMenuComponent>();
Ogre::LogManager::getSingleton().logMessage(
"StartupMenuSystem: Found menu entity, font=" +
sm.fontName + ", scene=" + sm.newGameScene);
ensureFontLoaded(sm.fontName, sm.fontSize);
} else {
Ogre::LogManager::getSingleton().logMessage(
"StartupMenuSystem: No StartupMenuComponent entity found");
}
}
@@ -98,11 +104,15 @@ void StartupMenuSystem::update(float deltaTime)
if (!menuEntity.is_alive()) {
// No startup menu entity configured
Ogre::LogManager::getSingleton().logMessage(
"StartupMenuSystem: Rendering missing menu error");
renderMissingMenuError();
return;
}
auto &sm = menuEntity.get_mut<StartupMenuComponent>();
Ogre::LogManager::getSingleton().logMessage(
"StartupMenuSystem: Rendering menu, scene=" + sm.newGameScene);
renderMenu(sm);
}
@@ -121,8 +131,7 @@ void StartupMenuSystem::renderMenu(StartupMenuComponent &sm)
ImGuiWindowFlags_NoResize |
ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_NoCollapse |
ImGuiWindowFlags_NoFocusOnAppearing |
ImGuiWindowFlags_NoInputs);
ImGuiWindowFlags_NoFocusOnAppearing);
if (m_menuFont)
ImGui::PushFont(m_menuFont);