mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
internal/ui: refactoring
This commit is contained in:
parent
35b9dd0846
commit
f1987cae10
@ -105,6 +105,9 @@ func (w *Window) IsMaximized() bool {
|
||||
if !w.ui.isRunning() {
|
||||
return w.ui.isInitWindowMaximized()
|
||||
}
|
||||
if !w.IsResizable() {
|
||||
return false
|
||||
}
|
||||
var v bool
|
||||
w.ui.t.Call(func() {
|
||||
v = w.ui.window.GetAttrib(glfw.Maximized) == glfw.True
|
||||
@ -113,6 +116,9 @@ func (w *Window) IsMaximized() bool {
|
||||
}
|
||||
|
||||
func (w *Window) Maximize() {
|
||||
// Do not allow maximizing the window when the window is not resizable.
|
||||
// On Windows, it is possible to restore the window from being maximized by mouse-dragging,
|
||||
// and this can be an unexpected behavior.
|
||||
if !w.IsResizable() {
|
||||
panic("ui: a window to maximize must be resizable")
|
||||
}
|
||||
|
@ -217,9 +217,6 @@ func SetWindowFloating(float bool) {
|
||||
//
|
||||
// MaximizeWindow is concurrent-safe.
|
||||
func MaximizeWindow() {
|
||||
if !IsWindowResizable() {
|
||||
panic("ebiten: a window to maximize must be resizable")
|
||||
}
|
||||
ui.Get().Window().Maximize()
|
||||
}
|
||||
|
||||
@ -231,9 +228,6 @@ func MaximizeWindow() {
|
||||
//
|
||||
// IsWindowMaximized is concurrent-safe.
|
||||
func IsWindowMaximized() bool {
|
||||
if !IsWindowResizable() {
|
||||
return false
|
||||
}
|
||||
return ui.Get().Window().IsMaximized()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user