v1.2.0: added a failsafe for linux sometimes reporting infinite density

This commit is contained in:
Evan Debenham
2022-02-03 18:33:57 -05:00
parent 1370ae35f1
commit 41dc5c90af

View File

@@ -93,6 +93,9 @@ public class Game implements ApplicationListener {
@Override @Override
public void create() { public void create() {
density = Gdx.graphics.getDensity(); density = Gdx.graphics.getDensity();
if (density == Float.POSITIVE_INFINITY){
density = 100f / 160f; //assume 100PPI if density can't be found
}
dispHeight = Gdx.graphics.getDisplayMode().height; dispHeight = Gdx.graphics.getDisplayMode().height;
dispWidth = Gdx.graphics.getDisplayMode().width; dispWidth = Gdx.graphics.getDisplayMode().width;