mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +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/gopherjs/gopherwasm/js"
|
||||||
|
|
||||||
|
"github.com/hajimehoshi/ebiten/internal/devicescale"
|
||||||
"github.com/hajimehoshi/ebiten/internal/hooks"
|
"github.com/hajimehoshi/ebiten/internal/hooks"
|
||||||
"github.com/hajimehoshi/ebiten/internal/input"
|
"github.com/hajimehoshi/ebiten/internal/input"
|
||||||
"github.com/hajimehoshi/ebiten/internal/opengl"
|
"github.com/hajimehoshi/ebiten/internal/opengl"
|
||||||
@ -153,6 +154,10 @@ func SetWindowDecorated(decorated bool) {
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DeviceScaleFactor() float64 {
|
||||||
|
return devicescale.GetAt(0, 0)
|
||||||
|
}
|
||||||
|
|
||||||
func (u *userInterface) getScale() float64 {
|
func (u *userInterface) getScale() float64 {
|
||||||
if !u.fullscreen {
|
if !u.fullscreen {
|
||||||
return u.scale
|
return u.scale
|
||||||
@ -174,7 +179,7 @@ func (u *userInterface) actualScreenScale() float64 {
|
|||||||
// * Chrome just after restoring the lost context
|
// * Chrome just after restoring the lost context
|
||||||
// * Safari
|
// * Safari
|
||||||
// Let's use the devicePixelRatio as it is here.
|
// 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) {
|
func (u *userInterface) updateGraphicsContext(g GraphicsContext) {
|
||||||
|
@ -420,3 +420,7 @@ func SetVsyncEnabled(enabled bool) {
|
|||||||
func UpdateTouches(touches []*input.Touch) {
|
func UpdateTouches(touches []*input.Touch) {
|
||||||
input.Get().UpdateTouches(touches)
|
input.Get().UpdateTouches(touches)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DeviceScaleFactor() float64 {
|
||||||
|
return getDeviceScale()
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user