mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 03:58:55 +01:00
ui: Refactoring: remove an unneeded member
This commit is contained in:
parent
5dfb361aca
commit
a64367f906
@ -40,7 +40,6 @@ type userInterface struct {
|
|||||||
height int
|
height int
|
||||||
|
|
||||||
scale float64
|
scale float64
|
||||||
cachedGLFWScale float64
|
|
||||||
fullscreenScale float64
|
fullscreenScale float64
|
||||||
|
|
||||||
running bool
|
running bool
|
||||||
@ -312,8 +311,8 @@ func ScreenOffset() (float64, float64) {
|
|||||||
v := m.GetVideoMode()
|
v := m.GetVideoMode()
|
||||||
d := devicescale.DeviceScale()
|
d := devicescale.DeviceScale()
|
||||||
_ = u.runOnMainThread(func() error {
|
_ = u.runOnMainThread(func() error {
|
||||||
ox = (float64(v.Width)*d/u.glfwScale() - float64(u.width)*u.actualScreenScale()) / 2
|
ox = (float64(v.Width)*d/glfwScale() - float64(u.width)*u.actualScreenScale()) / 2
|
||||||
oy = (float64(v.Height)*d/u.glfwScale() - float64(u.height)*u.actualScreenScale()) / 2
|
oy = (float64(v.Height)*d/glfwScale() - float64(u.height)*u.actualScreenScale()) / 2
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
return ox, oy
|
return ox, oy
|
||||||
@ -390,16 +389,9 @@ func Run(width, height int, scale float64, title string, g GraphicsContext) erro
|
|||||||
return u.loop(g)
|
return u.loop(g)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *userInterface) glfwScale() float64 {
|
|
||||||
if u.cachedGLFWScale == 0 {
|
|
||||||
u.cachedGLFWScale = glfwScale()
|
|
||||||
}
|
|
||||||
return u.cachedGLFWScale
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *userInterface) glfwSize() (int, int) {
|
func (u *userInterface) glfwSize() (int, int) {
|
||||||
w := int(float64(u.windowWidth) * u.getScale() * u.glfwScale())
|
w := int(float64(u.windowWidth) * u.getScale() * glfwScale())
|
||||||
h := int(float64(u.height) * u.getScale() * u.glfwScale())
|
h := int(float64(u.height) * u.getScale() * glfwScale())
|
||||||
return w, h
|
return w, h
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,8 +402,8 @@ func (u *userInterface) getScale() float64 {
|
|||||||
if u.fullscreenScale == 0 {
|
if u.fullscreenScale == 0 {
|
||||||
m := glfw.GetPrimaryMonitor()
|
m := glfw.GetPrimaryMonitor()
|
||||||
v := m.GetVideoMode()
|
v := m.GetVideoMode()
|
||||||
sw := float64(v.Width) / u.glfwScale() / float64(u.width)
|
sw := float64(v.Width) / glfwScale() / float64(u.width)
|
||||||
sh := float64(v.Height) / u.glfwScale() / float64(u.height)
|
sh := float64(v.Height) / glfwScale() / float64(u.height)
|
||||||
s := sw
|
s := sw
|
||||||
if s > sh {
|
if s > sh {
|
||||||
s = sh
|
s = sh
|
||||||
@ -427,7 +419,7 @@ func (u *userInterface) actualScreenScale() float64 {
|
|||||||
|
|
||||||
func (u *userInterface) pollEvents() {
|
func (u *userInterface) pollEvents() {
|
||||||
glfw.PollEvents()
|
glfw.PollEvents()
|
||||||
currentInput.update(u.window, u.getScale()*u.glfwScale())
|
currentInput.update(u.window, u.getScale()*glfwScale())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *userInterface) update(g GraphicsContext) error {
|
func (u *userInterface) update(g GraphicsContext) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user