From abbeb0acb54fc2a3a0ceeace74d6161776a7a5f4 Mon Sep 17 00:00:00 2001 From: Allen Ray Date: Wed, 16 Sep 2020 14:57:26 -0400 Subject: [PATCH] Fixed window resizing issues --- ui.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui.go b/ui.go index 48dc30f..0c120b0 100644 --- a/ui.go +++ b/ui.go @@ -82,8 +82,6 @@ func NewUI(win *pixelgl.Window, flags uint8) *UI { ui.packer = packer.NewAliasPacker(0, 0, packer.AllowGrowth) - ui.matrix = pixel.IM.ScaledXY(win.Bounds().Center(), pixel.V(1, -1)) - ui.io = imgui.CurrentIO() ui.io.SetDisplaySize(IVec(win.Bounds().Size())) ui.io.SetClipboard(Clipboard{win: win}) @@ -128,8 +126,13 @@ func (ui *UI) NewFrame() { func (ui *UI) update() { } +func (ui *UI) updateMatrix() { + ui.matrix = pixel.IM.ScaledXY(ui.win.Bounds().Center(), pixel.V(1, -1)) +} + // Draw Draws the imgui UI to the Pixel Window func (ui *UI) Draw(win *pixelgl.Window) { + ui.updateMatrix() win.SetComposeMethod(pixel.ComposeOver) win.SetMatrix(ui.matrix)