Handle editor input events in OnUpdate instead of OnRender

To make input handling consistent with the gameclient. Also skip input events that are not valid, same as in the gameclient, as this otherwise causes input events to be handled multiple times.
This commit is contained in:
Robert Müller 2023-07-09 17:37:50 +02:00
parent da2da7b36f
commit 6cfdbd9986
2 changed files with 13 additions and 3 deletions

View file

@ -7090,6 +7090,17 @@ void CEditor::HandleCursorMovement()
}
}
void CEditor::DispatchInputEvents()
{
for(size_t i = 0; i < Input()->NumEvents(); i++)
{
const IInput::CEvent &Event = Input()->GetEvent(i);
if(!Input()->IsEventValid(Event))
continue;
UI()->OnInput(Event);
}
}
void CEditor::HandleAutosave()
{
const float Time = Client()->GlobalTime();
@ -7204,6 +7215,7 @@ void CEditor::OnUpdate()
}
HandleCursorMovement();
DispatchInputEvents();
HandleAutosave();
HandleWriterFinishJobs();
}
@ -7227,9 +7239,6 @@ void CEditor::OnRender()
ms_pUiGotContext = nullptr;
UI()->StartCheck();
for(size_t i = 0; i < Input()->NumEvents(); i++)
UI()->OnInput(Input()->GetEvent(i));
UI()->Update(m_MouseX, m_MouseY, m_MouseDeltaX, m_MouseDeltaY, m_MouseWorldX, m_MouseWorldY);
Render();

View file

@ -879,6 +879,7 @@ public:
void ResetIngameMoved() override { m_IngameMoved = false; }
void HandleCursorMovement();
void DispatchInputEvents();
void HandleAutosave();
bool PerformAutosave();
void HandleWriterFinishJobs();