ui: Bug fix: compile error on browsers and mobiles

This commit is contained in:
Hajime Hoshi 2018-10-08 01:24:19 +09:00
parent 4a5548a4a0
commit f6c2d899f1
2 changed files with 10 additions and 1 deletions

View File

@ -22,6 +22,7 @@ import (
"github.com/gopherjs/gopherwasm/js"
"github.com/hajimehoshi/ebiten/internal/devicescale"
"github.com/hajimehoshi/ebiten/internal/hooks"
"github.com/hajimehoshi/ebiten/internal/input"
"github.com/hajimehoshi/ebiten/internal/opengl"
@ -153,6 +154,10 @@ func SetWindowDecorated(decorated bool) {
// Do nothing
}
func DeviceScaleFactor() float64 {
return devicescale.GetAt(0, 0)
}
func (u *userInterface) getScale() float64 {
if !u.fullscreen {
return u.scale
@ -174,7 +179,7 @@ func (u *userInterface) actualScreenScale() float64 {
// * Chrome just after restoring the lost context
// * Safari
// Let's use the devicePixelRatio as it is here.
return u.getScale() * deviceScale.GetAt(0, 0)
return u.getScale() * devicescale.GetAt(0, 0)
}
func (u *userInterface) updateGraphicsContext(g GraphicsContext) {

View File

@ -420,3 +420,7 @@ func SetVsyncEnabled(enabled bool) {
func UpdateTouches(touches []*input.Touch) {
input.Get().UpdateTouches(touches)
}
func DeviceScaleFactor() float64 {
return getDeviceScale()
}