mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
ui: Bug fix: compile error on browsers and mobiles
This commit is contained in:
parent
4a5548a4a0
commit
f6c2d899f1
@ -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) {
|
||||
|
@ -420,3 +420,7 @@ func SetVsyncEnabled(enabled bool) {
|
||||
func UpdateTouches(touches []*input.Touch) {
|
||||
input.Get().UpdateTouches(touches)
|
||||
}
|
||||
|
||||
func DeviceScaleFactor() float64 {
|
||||
return getDeviceScale()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user