I'm doing some research on making a game that will be able to scale its graphical resources to suit the DPI of whatever device it's on.
In order to do this, I would like to be able to query the DPI of the device, to appropriately scale the assets.
It's a 2D game, and the art style suits arbitrary scaling quite well.
example of what I would do with res/dpi combos:
iPhone/iTouch, at 320x480 (163 dpi) - text will be the normal size
iPhone4, at 640x960 (326 dpi) - text will be twice as large
iPad, at 768x1024 (132 dpi) - text will probably be capped at some minimum size, to take advantage of the greater screen real estate.
So, on iPhone OS, is there a way to query the screen's DPI?
(and as a side note - is this possible on Android devices at all?)
You can fetch this information in Android with the DisplayMetrics class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With