mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +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)
|
||||
}
|
||||
|
||||
func (w *Window) SetKeepAspectRatio(keep bool) {
|
||||
func (w *Window) SetAspectRatioFixed(fixed bool) {
|
||||
n, d := glfw.DontCare, glfw.DontCare
|
||||
if keep {
|
||||
if fixed {
|
||||
n, d = w.GetSize()
|
||||
}
|
||||
w.w.SetAspectRatio(n, d)
|
||||
|
@ -261,9 +261,9 @@ func (w *Window) SetSizeLimits(minw, minh, maxw, maxh int) {
|
||||
panicError()
|
||||
}
|
||||
|
||||
func (w *Window) SetKeepAspectRatio(keep bool) {
|
||||
func (w *Window) SetAspectRatioFixed(fixed bool) {
|
||||
n, d := -1, -1
|
||||
if keep {
|
||||
if fixed {
|
||||
n, d = w.GetSize()
|
||||
}
|
||||
glfwDLL.call("glfwSetWindowAspectRatio", w.w, uintptr(n), uintptr(d))
|
||||
|
@ -85,19 +85,19 @@ type UserInterface struct {
|
||||
initFullscreenWidthInDIP int
|
||||
initFullscreenHeightInDIP int
|
||||
|
||||
initFullscreen bool
|
||||
initCursorMode CursorMode
|
||||
initWindowDecorated bool
|
||||
initWindowResizable bool
|
||||
initWindowPositionXInDIP int
|
||||
initWindowPositionYInDIP int
|
||||
initWindowWidthInDIP int
|
||||
initWindowHeightInDIP int
|
||||
initWindowFloating bool
|
||||
initWindowMaximized bool
|
||||
initWindowKeepAspectRatio bool
|
||||
initScreenTransparent bool
|
||||
initFocused bool
|
||||
initFullscreen bool
|
||||
initCursorMode CursorMode
|
||||
initWindowDecorated bool
|
||||
initWindowResizable bool
|
||||
initWindowPositionXInDIP int
|
||||
initWindowPositionYInDIP int
|
||||
initWindowWidthInDIP int
|
||||
initWindowHeightInDIP int
|
||||
initWindowFloating bool
|
||||
initWindowMaximized bool
|
||||
initWindowAspectRatioFixed bool
|
||||
initScreenTransparent bool
|
||||
initFocused bool
|
||||
|
||||
fpsModeInited bool
|
||||
|
||||
@ -280,16 +280,16 @@ func (u *UserInterface) setWindowSizeLimitsInDIP(minw, minh, maxw, maxh int) boo
|
||||
return true
|
||||
}
|
||||
|
||||
func (u *UserInterface) isInitWindowKeepAspectRatio() bool {
|
||||
func (u *UserInterface) isInitWindowAspectRatioFixed() bool {
|
||||
u.m.RLock()
|
||||
v := u.initWindowKeepAspectRatio
|
||||
v := u.initWindowAspectRatioFixed
|
||||
u.m.RUnlock()
|
||||
return v
|
||||
}
|
||||
|
||||
func (u *UserInterface) setInitWindowKeepAspectRatio(keep bool) {
|
||||
func (u *UserInterface) setInitWindowAspectRatioFixed(fixed bool) {
|
||||
u.m.Lock()
|
||||
u.initWindowKeepAspectRatio = keep
|
||||
u.initWindowAspectRatioFixed = fixed
|
||||
u.m.Unlock()
|
||||
}
|
||||
|
||||
@ -932,8 +932,7 @@ func (u *UserInterface) init() error {
|
||||
u.window.Maximize()
|
||||
}
|
||||
|
||||
keepAspectRatio := u.isInitWindowKeepAspectRatio()
|
||||
u.window.SetKeepAspectRatio(keepAspectRatio)
|
||||
u.window.SetAspectRatioFixed(u.isInitWindowAspectRatioFixed())
|
||||
|
||||
u.window.Show()
|
||||
|
||||
|
@ -227,13 +227,13 @@ func (w *Window) SetSizeLimits(minw, minh, maxw, maxh int) {
|
||||
w.ui.t.Call(w.ui.updateWindowSizeLimits)
|
||||
}
|
||||
|
||||
func (w *Window) SetKeepAspectRatio(keep bool) {
|
||||
func (w *Window) SetAspectRatioFixed(fixed bool) {
|
||||
if !w.ui.isRunning() {
|
||||
w.ui.setInitWindowKeepAspectRatio(keep)
|
||||
w.ui.setInitWindowAspectRatioFixed(fixed)
|
||||
return
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
func (*Window) SetKeepAspectRatio(keep bool) {
|
||||
func (*Window) SetAspectRatioFixed(fixed bool) {
|
||||
}
|
||||
|
||||
func (*Window) SetIcon(iconImages []image.Image) {
|
||||
|
@ -72,11 +72,9 @@ func SetWindowResizable(resizable bool) {
|
||||
ui.Get().Window().SetResizable(resizable)
|
||||
}
|
||||
|
||||
// SetWindowKeepAspectRatio sets whether the window should keep its aspect ratio while resizing.
|
||||
func SetWindowKeepAspectRatio(keep bool) {
|
||||
if w := ui.Get().Window(); w != nil {
|
||||
w.SetKeepAspectRatio(keep)
|
||||
}
|
||||
// SetWindowAspectRatioFixed sets whether the window should keep its aspect ratio while resizing.
|
||||
func SetWindowAspectRatioFixed(fixed bool) {
|
||||
ui.Get().Window().SetAspectRatioFixed(fixed)
|
||||
}
|
||||
|
||||
// SetWindowTitle sets the title of the window.
|
||||
|
Loading…
Reference in New Issue
Block a user