mirror of https://github.com/kivy/kivy.git
metrics: add iOS support for Metrics.density/Metrics.dpi
This commit is contained in:
parent
596cbab408
commit
42fb4c69c5
|
@ -156,6 +156,9 @@ class Metrics(object):
|
||||||
if platform() == 'android':
|
if platform() == 'android':
|
||||||
import android
|
import android
|
||||||
return android.get_dpi()
|
return android.get_dpi()
|
||||||
|
elif platform() == 'ios':
|
||||||
|
import ios
|
||||||
|
return ios.get_dpi()
|
||||||
|
|
||||||
# for all other platforms..
|
# for all other platforms..
|
||||||
from kivy.base import EventLoop
|
from kivy.base import EventLoop
|
||||||
|
@ -189,6 +192,9 @@ class Metrics(object):
|
||||||
import jnius
|
import jnius
|
||||||
Hardware = jnius.autoclass('org.renpy.android.Hardware')
|
Hardware = jnius.autoclass('org.renpy.android.Hardware')
|
||||||
return Hardware.metrics.scaledDensity
|
return Hardware.metrics.scaledDensity
|
||||||
|
elif platform() == 'ios':
|
||||||
|
import ios
|
||||||
|
return ios.get_scale()
|
||||||
|
|
||||||
return 1.0
|
return 1.0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue