mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +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)
|
||||
// TODO: Set icons
|
||||
|
||||
u.registerWindowSetSizeCallback()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// registerWindowSetSizeCallback must be called from the main thread.
|
||||
func (u *UserInterface) registerWindowSetSizeCallback() {
|
||||
u.setSizeCallbackEnabled = true
|
||||
u.window.SetSizeCallback(func(_ *glfw.Window, width, height int) {
|
||||
if !u.setSizeCallbackEnabled {
|
||||
return
|
||||
@ -802,7 +803,7 @@ func (u *UserInterface) init() error {
|
||||
if err := u.createWindow(); err != nil {
|
||||
return err
|
||||
}
|
||||
u.registerWindowSetSizeCallback()
|
||||
u.setSizeCallbackEnabled = true
|
||||
|
||||
setPosition := func() {
|
||||
u.iwindow.setPosition(u.getInitWindowPosition())
|
||||
|
Loading…
Reference in New Issue
Block a user