From d18fc36040357143359a1d6af5e527b03b728cb0 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 3 Jan 2018 05:25:22 +0900 Subject: [PATCH] Add DeviceScale() experimentally --- examples/windowsize/main.go | 2 ++ run.go | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/examples/windowsize/main.go b/examples/windowsize/main.go index 596d82561..f312e6fb1 100644 --- a/examples/windowsize/main.go +++ b/examples/windowsize/main.go @@ -167,6 +167,8 @@ FPS: %0.2f`, x, y, ebiten.CurrentFPS()) } func main() { + fmt.Printf("Device scale: %0.2f\n", ebiten.DeviceScale()) + var err error gophersImage, _, err = ebitenutil.NewImageFromFile(ebitenutil.JoinStringsIntoFilePath("_resources", "images", "gophers.jpg"), ebiten.FilterNearest) if err != nil { diff --git a/run.go b/run.go index d81ec05fa..088715748 100644 --- a/run.go +++ b/run.go @@ -20,6 +20,7 @@ import ( "github.com/hajimehoshi/ebiten/internal/audiobinding" "github.com/hajimehoshi/ebiten/internal/clock" + "github.com/hajimehoshi/ebiten/internal/devicescale" "github.com/hajimehoshi/ebiten/internal/ui" ) @@ -283,3 +284,7 @@ func SetRunnableInBackground(runnableInBackground bool) { func SetWindowIcon(iconImages []image.Image) { ui.SetWindowIcon(iconImages) } + +func DeviceScale() float64 { + return devicescale.DeviceScale() +}