screen dpi/ppi

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Martin Eigel
:warning: Old Version Published before Godot 3 was released.

Is there a way to get dpi/ppi of the display? This e.g. is handy for constant size on-screen controls with mobile devices.

:bust_in_silhouette: Reply From: KRL

There are three options that i see:

  1. Ask a user at start or in options what is his screen size in inches and calculate it
  2. Publish different versions for different devices
  3. Use function: get_model_name() (don’t know if this really returns model of device because it’s undescripted in help)

Thanks for the suggestions, but seriously? There is


on Android, not sure about iOS and in Unity it’s


Pretty sure the typical user is not too keen to figure out and enter device specifications.

Martin Eigel | 2016-03-29 22:07

Where did you found this? Can’t find it in api.

KRL | 2016-03-30 20:19

I gave a downvote because i really think these solutions are “thin”.

I think its a really bad idea to assume that the user knows the screen size, I would say that it is always best to assume that the user is “stupid”.

To publish a version for different devices could be possible in some cases, but even if for example a version is for “mobile” only there are still a ton of screen sizes and resolutions.

I am not sure how get_model_name() works on different devices, only tried it on desktop pc where it just returns “generic device” and therefor tells us absolutely nothing. Even if it returns the exact model it would still require to have a huge list of models and the respective screen size, and when new devices are in sales, we would have to update that list.

If it isn’t for some very specific case, design your game to be responsive! One way or another.

Godot even have some build in methods of handling different screen sizes/resolutions

Rasmus | 2016-12-30 12:05

:bust_in_silhouette: Reply From: Laurence

Haven’t tried it out myself but maybe look at OS.get_screen_dpi()

Might need to do


Just to get the dpi from the screen where your game runs if there should be multiple screens.

Rasmus | 2016-12-30 11:41