mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
devicescale: Panic on Android when called from init funcs
This commit is contained in:
parent
d8dba69b47
commit
167d21ec46
@ -65,7 +65,7 @@ import (
|
|||||||
|
|
||||||
func impl() float64 {
|
func impl() float64 {
|
||||||
if !jni.IsJVMAvailable() {
|
if !jni.IsJVMAvailable() {
|
||||||
return 0
|
panic("devicescale: JVM is not available yet: is this called from init funcitons?")
|
||||||
}
|
}
|
||||||
s := 0.0
|
s := 0.0
|
||||||
if err := jni.RunOnJVM(func(vm, env, ctx uintptr) error {
|
if err := jni.RunOnJVM(func(vm, env, ctx uintptr) error {
|
||||||
|
3
run.go
3
run.go
@ -502,8 +502,7 @@ func SetWindowIcon(iconImages []image.Image) {
|
|||||||
// DeviceScaleFactor returns a meaningful value on high-DPI display environment,
|
// DeviceScaleFactor returns a meaningful value on high-DPI display environment,
|
||||||
// otherwise DeviceScaleFactor returns 1.
|
// otherwise DeviceScaleFactor returns 1.
|
||||||
//
|
//
|
||||||
// DeviceScaleFactor might return 0 on init function on some devices like Android.
|
// DeviceScaleFactor might panic on init function on some devices like Android.
|
||||||
// Don't expect DeviceScaleFactor returns a valid value until main starts.
|
|
||||||
// Then, it is not recommended to call DeviceScaleFactor from init functions.
|
// Then, it is not recommended to call DeviceScaleFactor from init functions.
|
||||||
//
|
//
|
||||||
// DeviceScaleFactor is concurrent-safe.
|
// DeviceScaleFactor is concurrent-safe.
|
||||||
|
Loading…
Reference in New Issue
Block a user