Keep references to Images used by ImGui

This commit is contained in:
Simon Lübeß
2021-09-21 16:49:10 +02:00
parent 611782653c
commit eb2bbf4b82
4 changed files with 36 additions and 9 deletions
@@ -20,5 +20,8 @@ namespace ImGui
public static extern void Image(Texture2D texture, Vec2 size, Vec2 uv0 = Vec2.Zero, Vec2 uv1 = Vec2.Ones, Vec4 tint_col = Vec4.Ones, Vec4 border_col = Vec4.Zero);
// Wouldn't be necesseary if RenderTarget2D was Texture2D
public static extern void Image(RenderTarget2D texture, Vec2 size, Vec2 uv0 = Vec2.Zero, Vec2 uv1 = Vec2.Ones, Vec4 tint_col = Vec4.Ones, Vec4 border_col = Vec4.Zero);
/// Releases references that accumulated calls like ImGui::Image
protected internal static extern void CleanupFrame();
}
}
+4
View File
@@ -2,6 +2,8 @@ using System;
using ImGui;
using GlitchyEngine.Events;
using internal ImGui;
namespace GlitchyEngine.ImGui
{
public class ImGuiLayer : Layer
@@ -207,6 +209,8 @@ namespace GlitchyEngine.ImGui
ImGui.Render();
ImGuiImplDX11.RenderDrawData(ImGui.GetDrawData());
ImGui.CleanupFrame();
if(io.ConfigFlags.HasFlag(.ViewportsEnable))
{
ImGui.UpdatePlatformWindows();