From 284c6550447ad4d998ffcc83a2e1acd98022d135 Mon Sep 17 00:00:00 2001
From: Angaros <rga.quentin@gmail.com>
Date: Tue, 19 Nov 2024 10:28:26 +0100
Subject: [PATCH] Bugfix imgui can now interact on resized window

---
 imgui_basic.lua         | 1 +
 imgui_basic.py          | 1 +
 imgui_edit.lua          | 1 +
 imgui_edit.py           | 1 +
 imgui_mouse_capture.lua | 1 +
 imgui_mouse_capture.py  | 1 +
 6 files changed, 6 insertions(+)

diff --git a/imgui_basic.lua b/imgui_basic.lua
index 77c6a48..7451cd5 100644
--- a/imgui_basic.lua
+++ b/imgui_basic.lua
@@ -18,6 +18,7 @@ hg.ImGuiInit(10, imgui_prg, imgui_img_prg)
 
 -- main loop
 while not hg.ReadKeyboard():Key(hg.K_Escape) and hg.IsWindowOpen(win) do
+	render_was_reset, res_x, res_y = hg.RenderResetToWindow(win, res_x, res_y, hg.RF_VSync)
 	hg.ImGuiBeginFrame(res_x, res_y, hg.TickClock(), hg.ReadMouse(), hg.ReadKeyboard())
 
 	if hg.ImGuiBegin('Window') then
diff --git a/imgui_basic.py b/imgui_basic.py
index 0037e6a..69cac17 100644
--- a/imgui_basic.py
+++ b/imgui_basic.py
@@ -18,6 +18,7 @@
 
 # main loop
 while not hg.ReadKeyboard().Key(hg.K_Escape) and hg.IsWindowOpen(win):
+	render_was_reset, res_x, res_y = hg.RenderResetToWindow(win, res_x, res_y, hg.RF_VSync)
 	hg.ImGuiBeginFrame(res_x, res_y, hg.TickClock(), hg.ReadMouse(), hg.ReadKeyboard())
 
 	if hg.ImGuiBegin('Window'):
diff --git a/imgui_edit.lua b/imgui_edit.lua
index e0c8bf8..950898a 100644
--- a/imgui_edit.lua
+++ b/imgui_edit.lua
@@ -22,6 +22,7 @@ imgui_clear_color_preset = 0
 
 -- main loop
 while not hg.ReadKeyboard():Key(hg.K_Escape) and hg.IsWindowOpen(win) do
+	render_was_reset, res_x, res_y = hg.RenderResetToWindow(win, res_x, res_y, hg.RF_VSync)
 	dt = hg.TickClock()
 
 	-- ImGui frame
diff --git a/imgui_edit.py b/imgui_edit.py
index 3d0ad63..c284053 100644
--- a/imgui_edit.py
+++ b/imgui_edit.py
@@ -22,6 +22,7 @@
 
 # main loop
 while not hg.ReadKeyboard().Key(hg.K_Escape) and hg.IsWindowOpen(win):
+	render_was_reset, res_x, res_y = hg.RenderResetToWindow(win, res_x, res_y, hg.RF_VSync)
 	dt = hg.TickClock()
 
 	# ImGui frame
diff --git a/imgui_mouse_capture.lua b/imgui_mouse_capture.lua
index d9b9659..97dfb3d 100644
--- a/imgui_mouse_capture.lua
+++ b/imgui_mouse_capture.lua
@@ -19,6 +19,7 @@ mouse = hg.Mouse()
 keyboard = hg.Keyboard()
 
 while not hg.ReadKeyboard():Key(hg.K_Escape) and hg.IsWindowOpen(win) do
+	render_was_reset, res_x, res_y = hg.RenderResetToWindow(win, res_x, res_y, hg.RF_VSync)
 	mouse:Update()
 	keyboard:Update()
 
diff --git a/imgui_mouse_capture.py b/imgui_mouse_capture.py
index cf5485f..acab877 100644
--- a/imgui_mouse_capture.py
+++ b/imgui_mouse_capture.py
@@ -19,6 +19,7 @@
 keyboard = hg.Keyboard()
 
 while not hg.ReadKeyboard().Key(hg.K_Escape) and hg.IsWindowOpen(win):
+	render_was_reset, res_x, res_y = hg.RenderResetToWindow(win, res_x, res_y, hg.RF_VSync)
 	mouse.Update()
 	keyboard.Update()