mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/uidriver/glfw: Bug fix: Need to reregister the callback after recreating the window
Updates #1588 Closes #1593
This commit is contained in:
parent
73f90f324f
commit
dcaa1f9722
@ -705,12 +705,13 @@ func (u *UserInterface) createWindow() error {
|
|||||||
u.window.SetTitle(u.title)
|
u.window.SetTitle(u.title)
|
||||||
// TODO: Set icons
|
// TODO: Set icons
|
||||||
|
|
||||||
|
u.registerWindowSetSizeCallback()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// registerWindowSetSizeCallback must be called from the main thread.
|
// registerWindowSetSizeCallback must be called from the main thread.
|
||||||
func (u *UserInterface) registerWindowSetSizeCallback() {
|
func (u *UserInterface) registerWindowSetSizeCallback() {
|
||||||
u.setSizeCallbackEnabled = true
|
|
||||||
u.window.SetSizeCallback(func(_ *glfw.Window, width, height int) {
|
u.window.SetSizeCallback(func(_ *glfw.Window, width, height int) {
|
||||||
if !u.setSizeCallbackEnabled {
|
if !u.setSizeCallbackEnabled {
|
||||||
return
|
return
|
||||||
@ -802,7 +803,7 @@ func (u *UserInterface) init() error {
|
|||||||
if err := u.createWindow(); err != nil {
|
if err := u.createWindow(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
u.registerWindowSetSizeCallback()
|
u.setSizeCallbackEnabled = true
|
||||||
|
|
||||||
setPosition := func() {
|
setPosition := func() {
|
||||||
u.iwindow.setPosition(u.getInitWindowPosition())
|
u.iwindow.setPosition(u.getInitWindowPosition())
|
||||||
|
Loading…
Reference in New Issue
Block a user