mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-04 23:14:28 +01:00
Bug fix: SetFramebufferSizeCallback can be called immediately
This commit is contained in:
parent
48f639db02
commit
bf027fef33
8
ui.go
8
ui.go
@ -72,16 +72,16 @@ func startUI(width, height, scale int, title string) error {
|
|||||||
x := (videoMode.Width - width*scale) / 2
|
x := (videoMode.Width - width*scale) / 2
|
||||||
y := (videoMode.Height - height*scale) / 3
|
y := (videoMode.Height - height*scale) / 3
|
||||||
|
|
||||||
|
ch := make(chan struct{})
|
||||||
window := currentUI.window
|
window := currentUI.window
|
||||||
|
window.SetFramebufferSizeCallback(func(w *glfw.Window, width, height int) {
|
||||||
|
close(ch)
|
||||||
|
})
|
||||||
window.SetSize(width*scale, height*scale)
|
window.SetSize(width*scale, height*scale)
|
||||||
window.SetTitle(title)
|
window.SetTitle(title)
|
||||||
window.SetPosition(x, y)
|
window.SetPosition(x, y)
|
||||||
window.Show()
|
window.Show()
|
||||||
|
|
||||||
ch := make(chan struct{})
|
|
||||||
window.SetFramebufferSizeCallback(func(w *glfw.Window, width, height int) {
|
|
||||||
close(ch)
|
|
||||||
})
|
|
||||||
for {
|
for {
|
||||||
done := false
|
done := false
|
||||||
glfw.PollEvents()
|
glfw.PollEvents()
|
||||||
|
Loading…
Reference in New Issue
Block a user