mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/ui: refactoring
This commit is contained in:
parent
57c123a412
commit
f2da62a175
@ -1220,24 +1220,16 @@ func (u *UserInterface) setWindowSizeInDIP(width, height int, fullscreen bool) {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
windowRecreated := u.setWindowSizeInDIPImpl(width, height, fullscreen)
|
u.setWindowSizeInDIPImpl(width, height, fullscreen)
|
||||||
|
|
||||||
u.adjustViewSize()
|
u.adjustViewSize()
|
||||||
|
|
||||||
// As width might be updated, update windowWidth/Height here.
|
// As width might be updated, update windowWidth/Height here.
|
||||||
u.windowWidthInDIP = width
|
u.windowWidthInDIP = width
|
||||||
u.windowHeightInDIP = height
|
u.windowHeightInDIP = height
|
||||||
|
|
||||||
if windowRecreated {
|
|
||||||
if g, ok := Graphics().(interface{ SetWindow(uintptr) }); ok {
|
|
||||||
g.SetWindow(u.nativeWindow())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserInterface) setWindowSizeInDIPImpl(width, height int, fullscreen bool) bool {
|
func (u *UserInterface) setWindowSizeInDIPImpl(width, height int, fullscreen bool) {
|
||||||
var windowRecreated bool
|
|
||||||
|
|
||||||
if fullscreen {
|
if fullscreen {
|
||||||
if x, y := u.origPos(); x == invalidPos || y == invalidPos {
|
if x, y := u.origPos(); x == invalidPos || y == invalidPos {
|
||||||
u.setOrigPos(u.window.GetPos())
|
u.setOrigPos(u.window.GetPos())
|
||||||
@ -1312,8 +1304,6 @@ func (u *UserInterface) setWindowSizeInDIPImpl(width, height int, fullscreen boo
|
|||||||
n, d = u.window.GetSize()
|
n, d = u.window.GetSize()
|
||||||
}
|
}
|
||||||
u.window.SetAspectRatio(n, d)
|
u.window.SetAspectRatio(n, d)
|
||||||
|
|
||||||
return windowRecreated
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// updateVsync must be called on the main thread.
|
// updateVsync must be called on the main thread.
|
||||||
|
Loading…
Reference in New Issue
Block a user