Skip to content

Commit

Permalink
Fixed window resizing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Ray committed Sep 16, 2020
1 parent a681dfe commit abbeb0a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit abbeb0a

Please sign in to comment.