Add DeviceScale() experimentally

This commit is contained in:
Hajime Hoshi 2018-01-03 05:25:22 +09:00
parent c82809867d
commit d18fc36040
2 changed files with 7 additions and 0 deletions

View File

@ -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 {

5
run.go
View File

@ -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()
}