mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +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() {
|
if !w.ui.isRunning() {
|
||||||
return w.ui.isInitWindowMaximized()
|
return w.ui.isInitWindowMaximized()
|
||||||
}
|
}
|
||||||
|
if !w.IsResizable() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
var v bool
|
var v bool
|
||||||
w.ui.t.Call(func() {
|
w.ui.t.Call(func() {
|
||||||
v = w.ui.window.GetAttrib(glfw.Maximized) == glfw.True
|
v = w.ui.window.GetAttrib(glfw.Maximized) == glfw.True
|
||||||
@ -113,6 +116,9 @@ func (w *Window) IsMaximized() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) Maximize() {
|
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() {
|
if !w.IsResizable() {
|
||||||
panic("ui: a window to maximize must be resizable")
|
panic("ui: a window to maximize must be resizable")
|
||||||
}
|
}
|
||||||
|
@ -217,9 +217,6 @@ func SetWindowFloating(float bool) {
|
|||||||
//
|
//
|
||||||
// MaximizeWindow is concurrent-safe.
|
// MaximizeWindow is concurrent-safe.
|
||||||
func MaximizeWindow() {
|
func MaximizeWindow() {
|
||||||
if !IsWindowResizable() {
|
|
||||||
panic("ebiten: a window to maximize must be resizable")
|
|
||||||
}
|
|
||||||
ui.Get().Window().Maximize()
|
ui.Get().Window().Maximize()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,9 +228,6 @@ func MaximizeWindow() {
|
|||||||
//
|
//
|
||||||
// IsWindowMaximized is concurrent-safe.
|
// IsWindowMaximized is concurrent-safe.
|
||||||
func IsWindowMaximized() bool {
|
func IsWindowMaximized() bool {
|
||||||
if !IsWindowResizable() {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return ui.Get().Window().IsMaximized()
|
return ui.Get().Window().IsMaximized()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user