mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
ebiten: rename SetKeepWindowAspectRatio -> SetWindowAspectRatioFixed
Updates #1804
This commit is contained in:
parent
18659ef4ab
commit
623c050537
@ -208,9 +208,9 @@ func (w *Window) SetSizeLimits(minw, minh, maxw, maxh int) {
|
|||||||
w.w.SetSizeLimits(minw, minh, maxw, maxh)
|
w.w.SetSizeLimits(minw, minh, maxw, maxh)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) SetKeepAspectRatio(keep bool) {
|
func (w *Window) SetAspectRatioFixed(fixed bool) {
|
||||||
n, d := glfw.DontCare, glfw.DontCare
|
n, d := glfw.DontCare, glfw.DontCare
|
||||||
if keep {
|
if fixed {
|
||||||
n, d = w.GetSize()
|
n, d = w.GetSize()
|
||||||
}
|
}
|
||||||
w.w.SetAspectRatio(n, d)
|
w.w.SetAspectRatio(n, d)
|
||||||
|
@ -261,9 +261,9 @@ func (w *Window) SetSizeLimits(minw, minh, maxw, maxh int) {
|
|||||||
panicError()
|
panicError()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) SetKeepAspectRatio(keep bool) {
|
func (w *Window) SetAspectRatioFixed(fixed bool) {
|
||||||
n, d := -1, -1
|
n, d := -1, -1
|
||||||
if keep {
|
if fixed {
|
||||||
n, d = w.GetSize()
|
n, d = w.GetSize()
|
||||||
}
|
}
|
||||||
glfwDLL.call("glfwSetWindowAspectRatio", w.w, uintptr(n), uintptr(d))
|
glfwDLL.call("glfwSetWindowAspectRatio", w.w, uintptr(n), uintptr(d))
|
||||||
|
@ -95,7 +95,7 @@ type UserInterface struct {
|
|||||||
initWindowHeightInDIP int
|
initWindowHeightInDIP int
|
||||||
initWindowFloating bool
|
initWindowFloating bool
|
||||||
initWindowMaximized bool
|
initWindowMaximized bool
|
||||||
initWindowKeepAspectRatio bool
|
initWindowAspectRatioFixed bool
|
||||||
initScreenTransparent bool
|
initScreenTransparent bool
|
||||||
initFocused bool
|
initFocused bool
|
||||||
|
|
||||||
@ -280,16 +280,16 @@ func (u *UserInterface) setWindowSizeLimitsInDIP(minw, minh, maxw, maxh int) boo
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserInterface) isInitWindowKeepAspectRatio() bool {
|
func (u *UserInterface) isInitWindowAspectRatioFixed() bool {
|
||||||
u.m.RLock()
|
u.m.RLock()
|
||||||
v := u.initWindowKeepAspectRatio
|
v := u.initWindowAspectRatioFixed
|
||||||
u.m.RUnlock()
|
u.m.RUnlock()
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserInterface) setInitWindowKeepAspectRatio(keep bool) {
|
func (u *UserInterface) setInitWindowAspectRatioFixed(fixed bool) {
|
||||||
u.m.Lock()
|
u.m.Lock()
|
||||||
u.initWindowKeepAspectRatio = keep
|
u.initWindowAspectRatioFixed = fixed
|
||||||
u.m.Unlock()
|
u.m.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -932,8 +932,7 @@ func (u *UserInterface) init() error {
|
|||||||
u.window.Maximize()
|
u.window.Maximize()
|
||||||
}
|
}
|
||||||
|
|
||||||
keepAspectRatio := u.isInitWindowKeepAspectRatio()
|
u.window.SetAspectRatioFixed(u.isInitWindowAspectRatioFixed())
|
||||||
u.window.SetKeepAspectRatio(keepAspectRatio)
|
|
||||||
|
|
||||||
u.window.Show()
|
u.window.Show()
|
||||||
|
|
||||||
|
@ -227,13 +227,13 @@ func (w *Window) SetSizeLimits(minw, minh, maxw, maxh int) {
|
|||||||
w.ui.t.Call(w.ui.updateWindowSizeLimits)
|
w.ui.t.Call(w.ui.updateWindowSizeLimits)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) SetKeepAspectRatio(keep bool) {
|
func (w *Window) SetAspectRatioFixed(fixed bool) {
|
||||||
if !w.ui.isRunning() {
|
if !w.ui.isRunning() {
|
||||||
w.ui.setInitWindowKeepAspectRatio(keep)
|
w.ui.setInitWindowAspectRatioFixed(fixed)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.ui.t.Call(func() {
|
w.ui.t.Call(func() {
|
||||||
w.ui.window.SetKeepAspectRatio(keep)
|
w.ui.window.SetAspectRatioFixed(fixed)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ func (*Window) IsMinimized() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*Window) SetKeepAspectRatio(keep bool) {
|
func (*Window) SetAspectRatioFixed(fixed bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*Window) SetIcon(iconImages []image.Image) {
|
func (*Window) SetIcon(iconImages []image.Image) {
|
||||||
|
@ -72,11 +72,9 @@ func SetWindowResizable(resizable bool) {
|
|||||||
ui.Get().Window().SetResizable(resizable)
|
ui.Get().Window().SetResizable(resizable)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetWindowKeepAspectRatio sets whether the window should keep its aspect ratio while resizing.
|
// SetWindowAspectRatioFixed sets whether the window should keep its aspect ratio while resizing.
|
||||||
func SetWindowKeepAspectRatio(keep bool) {
|
func SetWindowAspectRatioFixed(fixed bool) {
|
||||||
if w := ui.Get().Window(); w != nil {
|
ui.Get().Window().SetAspectRatioFixed(fixed)
|
||||||
w.SetKeepAspectRatio(keep)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetWindowTitle sets the title of the window.
|
// SetWindowTitle sets the title of the window.
|
||||||
|
Loading…
Reference in New Issue
Block a user