open and focus game view when game mode is started

This commit is contained in:
Mikulas Florek 2021-04-03 18:00:40 +02:00
parent 605c6d62c7
commit e1520564cd
2 changed files with 8 additions and 0 deletions

View file

@ -271,6 +271,13 @@ void GameView::onWindowGUI()
WorldEditor& editor = m_app.getWorldEditor();
m_pipeline->setUniverse(editor.getUniverse());
const bool is_game_mode = m_app.getWorldEditor().isGameMode();
if (is_game_mode && !m_was_game_mode) {
ImGui::SetNextWindowFocus();
m_is_open = true;
}
m_was_game_mode = is_game_mode;
ImGuiIO& io = ImGui::GetIO();
if (m_is_mouse_captured && (io.KeysDown[ImGui::GetKeyIndex(ImGuiKey_Escape)] || !editor.isGameMode())) {
captureMouse(false);

View file

@ -65,6 +65,7 @@ private:
bool m_is_ingame_cursor;
bool m_is_fullscreen;
bool m_show_stats;
bool m_was_game_mode = false;
os::CursorType m_cursor_type = os::CursorType::DEFAULT;
struct
{