mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
Add ebiten.ScreenScale() (#191)
This commit is contained in:
parent
2157061479
commit
62dffe5405
@ -32,7 +32,6 @@ const (
|
||||
|
||||
var (
|
||||
gophersImage *ebiten.Image
|
||||
screenScale = initScreenScale
|
||||
keyStates = map[ebiten.Key]int{
|
||||
ebiten.KeyUp: 0,
|
||||
ebiten.KeyDown: 0,
|
||||
@ -51,6 +50,7 @@ func update(screen *ebiten.Image) error {
|
||||
keyStates[key]++
|
||||
}
|
||||
d := 0
|
||||
screenScale := ebiten.ScreenScale()
|
||||
switch screenScale {
|
||||
case 1:
|
||||
d = 32
|
||||
|
@ -97,6 +97,10 @@ func SetScreenScale(scale int) bool {
|
||||
return currentUI.setScreenSize(currentUI.width, currentUI.height, scale)
|
||||
}
|
||||
|
||||
func ScreenScale() int {
|
||||
return currentUI.scale
|
||||
}
|
||||
|
||||
func ActualScale() int {
|
||||
return currentUI.actualScale()
|
||||
}
|
||||
|
@ -59,6 +59,10 @@ func SetScreenScale(scale int) bool {
|
||||
return currentUI.setScreenSize(width, height, scale)
|
||||
}
|
||||
|
||||
func ScreenScale() int {
|
||||
return canvas.Get("dataset").Get("ebitenScale").Int()
|
||||
}
|
||||
|
||||
func ActualScale() int {
|
||||
return canvas.Get("dataset").Get("ebitenActualScale").Int()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user