Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions src/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,20 +299,6 @@ private void Tick(bool processEvents)
// Wait for the swapchain before event processing to minimize input latency.
GraphicsDevice.WaitForSwapchain(MainWindow);

if (processEvents)
{
// Now that we are going to perform an update, let's handle SDL events.
// We'll process the system events immediately, and the input events before updating.
GatherSDLEvents();
ProcessSystemEvents();
}

// Quit event came in, bail immediately.
if (QuitRequested)
{
return;
}

// Do not let the accumulator go crazy.
var maxUpdateTime = FramePacingSettings.MaxUpdatesPerTick * FramePacingSettings.Timestep;
if (AccumulatedUpdateTime > maxUpdateTime)
Expand All @@ -337,6 +323,19 @@ private void Tick(bool processEvents)
// Step once on the timestep interval.
if (firstIteration)
{
if (processEvents)
{
// Process system events once per timestep interval.
// SDL events were already gathered above.
ProcessSystemEvents();
}

// Quit event came in, bail immediately.
if (QuitRequested)
{
return;
}

Step();
firstIteration = false;
}
Expand Down