Skip to content

Commit

Permalink
Merge pull request #119 from RuanLucasGD/Remove-ExitEditorKey
Browse files Browse the repository at this point in the history
Remove "Escape"  key from editor to don't close application accidentally
  • Loading branch information
jmorton06 authored Dec 3, 2023
2 parents 4f1c477 + 1893700 commit fb70d57
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions Editor/Source/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1860,28 +1860,20 @@ namespace Lumos
if(m_EditorState == EditorState::Play)
autoSaveTimer = 0.0f;

if(Input::Get().GetKeyPressed(Lumos::InputCode::Key::Escape))
if(Input::Get().GetKeyPressed(Lumos::InputCode::Key::Escape) && GetEditorState() != EditorState::Preview)
{
if(GetEditorState() == EditorState::Preview)
{
m_CurrentState = AppState::Closing;
return;
}
else
{
Application::Get().GetSystem<LumosPhysicsEngine>()->SetPaused(true);
Application::Get().GetSystem<B2PhysicsEngine>()->SetPaused(true);
Application::Get().GetSystem<LumosPhysicsEngine>()->SetPaused(true);
Application::Get().GetSystem<B2PhysicsEngine>()->SetPaused(true);

Application::Get().GetSystem<AudioManager>()->UpdateListener(Application::Get().GetCurrentScene());
Application::Get().GetSystem<AudioManager>()->SetPaused(true);
Application::Get().SetEditorState(EditorState::Preview);
Application::Get().GetSystem<AudioManager>()->UpdateListener(Application::Get().GetCurrentScene());
Application::Get().GetSystem<AudioManager>()->SetPaused(true);
Application::Get().SetEditorState(EditorState::Preview);

// m_SelectedEntity = entt::null;
m_SelectedEntities.clear();
ImGui::SetWindowFocus("###scene");
LoadCachedScene();
SetEditorState(EditorState::Preview);
}
// m_SelectedEntity = entt::null;
m_SelectedEntities.clear();
ImGui::SetWindowFocus("###scene");
LoadCachedScene();
SetEditorState(EditorState::Preview);
}

if(m_SceneViewActive)
Expand Down

0 comments on commit fb70d57

Please sign in to comment.