ui: Adjust cursor position on fullscreen (#267)

This commit is contained in:
Hajime Hoshi 2017-06-30 01:39:15 +09:00
parent e7370d8a54
commit 5b6fa2d384

View File

@ -240,11 +240,10 @@ func (u *userInterface) glfwSize() (int, int) {
return int(float64(u.width) * u.scale * u.glfwScale), int(float64(u.height) * u.scale * u.glfwScale)
}
func (u *userInterface) actualScreenScale() float64 {
if u.deviceScale == 0 {
u.deviceScale = deviceScale()
func (u *userInterface) getScale() float64 {
if !u.fullscreen {
return u.scale
}
if u.fullscreen {
if u.fullscreenScale == 0 {
m := glfw.GetPrimaryMonitor()
v := m.GetVideoMode()
@ -256,9 +255,14 @@ func (u *userInterface) actualScreenScale() float64 {
}
u.fullscreenScale = s
}
return u.fullscreenScale * u.deviceScale
return u.fullscreenScale
}
func (u *userInterface) actualScreenScale() float64 {
if u.deviceScale == 0 {
u.deviceScale = deviceScale()
}
return u.scale * u.deviceScale
return u.getScale() * u.deviceScale
}
func (u *userInterface) pollEvents() {
@ -266,7 +270,7 @@ func (u *userInterface) pollEvents() {
if u.glfwScale == 0 {
u.glfwScale = glfwScale()
}
currentInput.update(u.window, u.scale*u.glfwScale)
currentInput.update(u.window, u.getScale()*u.glfwScale)
}
func (u *userInterface) update(g GraphicsContext) error {