OSDN Git Service

Put back AWT for getting DPI.
authorNathanSweet <nathan.sweet@gmail.com>
Sun, 10 Mar 2013 14:14:49 +0000 (15:14 +0100)
committerNathanSweet <nathan.sweet@gmail.com>
Sun, 10 Mar 2013 14:14:49 +0000 (15:14 +0100)
backends/gdx-backend-jglfw/src/com/badlogic/gdx/backends/jglfw/JglfwGraphics.java

index 6f38aba..bef8415 100644 (file)
@@ -15,11 +15,11 @@ import com.badlogic.gdx.utils.GdxRuntimeException;
 import com.badlogic.jglfw.GlfwVideoMode;
 import com.badlogic.jglfw.gl.GL;
 
+import java.awt.Toolkit;
+
 /** An implementation of the {@link Graphics} interface based on GLFW.
  * @author Nathan Sweet */
 public class JglfwGraphics implements Graphics {
-       static private final float DPI = 72;
-
        static int glMajorVersion, glMinorVersion;
 
        long window;
@@ -154,23 +154,23 @@ public class JglfwGraphics implements Graphics {
        }
 
        public float getPpiX () {
-               return DPI;
+               return Toolkit.getDefaultToolkit().getScreenResolution();
        }
 
        public float getPpiY () {
-               return DPI;
+               return Toolkit.getDefaultToolkit().getScreenResolution();
        }
 
        public float getPpcX () {
-               return DPI / 2.54f;
+               return Toolkit.getDefaultToolkit().getScreenResolution() / 2.54f;
        }
 
        public float getPpcY () {
-               return DPI / 2.54f;
+               return Toolkit.getDefaultToolkit().getScreenResolution() / 2.54f;
        }
 
        public float getDensity () {
-               return DPI / 160f;
+               return Toolkit.getDefaultToolkit().getScreenResolution() / 160f;
        }
 
        public boolean supportsDisplayModeChange () {