mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-13 22:47:26 +01:00
internal/glfw: refactoring: keep the original API when possible
Updates #1804
This commit is contained in:
parent
623c050537
commit
740dfd5aed
@ -208,12 +208,8 @@ 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) SetAspectRatioFixed(fixed bool) {
|
func (w *Window) SetAspectRatio(numer, denom int) {
|
||||||
n, d := glfw.DontCare, glfw.DontCare
|
w.w.SetAspectRatio(numer, denom)
|
||||||
if fixed {
|
|
||||||
n, d = w.GetSize()
|
|
||||||
}
|
|
||||||
w.w.SetAspectRatio(n, d)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) SetIcon(images []image.Image) {
|
func (w *Window) SetIcon(images []image.Image) {
|
||||||
|
@ -261,12 +261,8 @@ func (w *Window) SetSizeLimits(minw, minh, maxw, maxh int) {
|
|||||||
panicError()
|
panicError()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) SetAspectRatioFixed(fixed bool) {
|
func (w *Window) SetAspectRatio(numer, denom int) {
|
||||||
n, d := -1, -1
|
glfwDLL.call("glfwSetWindowAspectRatio", w.w, uintptr(numer), uintptr(denom))
|
||||||
if fixed {
|
|
||||||
n, d = w.GetSize()
|
|
||||||
}
|
|
||||||
glfwDLL.call("glfwSetWindowAspectRatio", w.w, uintptr(n), uintptr(d))
|
|
||||||
panicError()
|
panicError()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -932,7 +932,7 @@ func (u *UserInterface) init() error {
|
|||||||
u.window.Maximize()
|
u.window.Maximize()
|
||||||
}
|
}
|
||||||
|
|
||||||
u.window.SetAspectRatioFixed(u.isInitWindowAspectRatioFixed())
|
u.setWindowAspectRatioFixed(u.isInitWindowAspectRatioFixed())
|
||||||
|
|
||||||
u.window.Show()
|
u.window.Show()
|
||||||
|
|
||||||
@ -1623,3 +1623,11 @@ func (u *UserInterface) setOrigPos(x, y int) {
|
|||||||
u.origPosX = x
|
u.origPosX = x
|
||||||
u.origPosY = y
|
u.origPosY = y
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u *UserInterface) setWindowAspectRatioFixed(fixed bool) {
|
||||||
|
n, d := glfw.DontCare, glfw.DontCare
|
||||||
|
if fixed {
|
||||||
|
n, d = u.window.GetSize()
|
||||||
|
}
|
||||||
|
u.window.SetAspectRatio(n, d)
|
||||||
|
}
|
||||||
|
@ -233,7 +233,7 @@ func (w *Window) SetAspectRatioFixed(fixed bool) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.ui.t.Call(func() {
|
w.ui.t.Call(func() {
|
||||||
w.ui.window.SetAspectRatioFixed(fixed)
|
w.ui.setWindowAspectRatioFixed(fixed)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user