mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +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)
|
||||
}
|
||||
|
||||
func (w *Window) SetAspectRatioFixed(fixed bool) {
|
||||
n, d := glfw.DontCare, glfw.DontCare
|
||||
if fixed {
|
||||
n, d = w.GetSize()
|
||||
}
|
||||
w.w.SetAspectRatio(n, d)
|
||||
func (w *Window) SetAspectRatio(numer, denom int) {
|
||||
w.w.SetAspectRatio(numer, denom)
|
||||
}
|
||||
|
||||
func (w *Window) SetIcon(images []image.Image) {
|
||||
|
@ -261,12 +261,8 @@ func (w *Window) SetSizeLimits(minw, minh, maxw, maxh int) {
|
||||
panicError()
|
||||
}
|
||||
|
||||
func (w *Window) SetAspectRatioFixed(fixed bool) {
|
||||
n, d := -1, -1
|
||||
if fixed {
|
||||
n, d = w.GetSize()
|
||||
}
|
||||
glfwDLL.call("glfwSetWindowAspectRatio", w.w, uintptr(n), uintptr(d))
|
||||
func (w *Window) SetAspectRatio(numer, denom int) {
|
||||
glfwDLL.call("glfwSetWindowAspectRatio", w.w, uintptr(numer), uintptr(denom))
|
||||
panicError()
|
||||
}
|
||||
|
||||
|
@ -932,7 +932,7 @@ func (u *UserInterface) init() error {
|
||||
u.window.Maximize()
|
||||
}
|
||||
|
||||
u.window.SetAspectRatioFixed(u.isInitWindowAspectRatioFixed())
|
||||
u.setWindowAspectRatioFixed(u.isInitWindowAspectRatioFixed())
|
||||
|
||||
u.window.Show()
|
||||
|
||||
@ -1623,3 +1623,11 @@ func (u *UserInterface) setOrigPos(x, y int) {
|
||||
u.origPosX = x
|
||||
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
|
||||
}
|
||||
w.ui.t.Call(func() {
|
||||
w.ui.window.SetAspectRatioFixed(fixed)
|
||||
w.ui.setWindowAspectRatioFixed(fixed)
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user