Skip to content

Commit

Permalink
Change ImGui update method
Browse files Browse the repository at this point in the history
  • Loading branch information
erictuvesson authored and mellinoe committed Sep 16, 2019
1 parent b75a172 commit 0a46e19
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/Veldrid.ImGui/ImGuiRenderer.cs
Expand Up @@ -371,15 +371,32 @@ public unsafe void Render(GraphicsDevice gd, CommandList cl)
/// Updates ImGui input and IO configuration state.
/// </summary>
public void Update(float deltaSeconds, InputSnapshot snapshot)
{
BeginUpdate(deltaSeconds);
UpdateImGuiInput(snapshot);
EndUpdate();
}

/// <summary>
/// Called before we handle the input in <see cref="Update(float, InputSnapshot)"/>.
/// This render ImGui and update the state.
/// </summary>
protected void BeginUpdate(float deltaSeconds)
{
if (_frameBegun)
{
ImGui.Render();
}

SetPerFrameImGuiData(deltaSeconds);
UpdateImGuiInput(snapshot);
}

/// <summary>
/// Called at the end of <see cref="Update(float, InputSnapshot)"/>.
/// This tells ImGui that we are on the next frame.
/// </summary>
protected void EndUpdate()
{
_frameBegun = true;
ImGui.NewFrame();
}
Expand Down

0 comments on commit 0a46e19

Please sign in to comment.