mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
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:
parent
da2da7b36f
commit
6cfdbd9986
|
@ -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();
|
||||
|
|
|
@ -879,6 +879,7 @@ public:
|
|||
void ResetIngameMoved() override { m_IngameMoved = false; }
|
||||
|
||||
void HandleCursorMovement();
|
||||
void DispatchInputEvents();
|
||||
void HandleAutosave();
|
||||
bool PerformAutosave();
|
||||
void HandleWriterFinishJobs();
|
||||
|
|
Loading…
Reference in a new issue