Search in sources :

Example 1 with JglfwDisplayMode

use of com.badlogic.gdx.backends.jglfw.JglfwGraphics.JglfwDisplayMode in project libgdx by libgdx.

the class JglfwApplicationConfiguration method getDisplayModes.

public static DisplayMode[] getDisplayModes() {
    GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
    java.awt.DisplayMode desktopMode = device.getDisplayMode();
    java.awt.DisplayMode[] displayModes = device.getDisplayModes();
    Array<DisplayMode> modes = new Array();
    outer: for (java.awt.DisplayMode mode : displayModes) {
        for (DisplayMode other : modes) if (other.width == mode.getWidth() && other.height == mode.getHeight() && other.bitsPerPixel == mode.getBitDepth())
            // Duplicate.
            continue outer;
        if (mode.getBitDepth() != desktopMode.getBitDepth())
            continue;
        modes.add(new JglfwDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(), mode.getBitDepth()));
    }
    return modes.toArray(DisplayMode.class);
}
Also used : JglfwDisplayMode(com.badlogic.gdx.backends.jglfw.JglfwGraphics.JglfwDisplayMode) DisplayMode(com.badlogic.gdx.Graphics.DisplayMode) Array(com.badlogic.gdx.utils.Array) GraphicsDevice(java.awt.GraphicsDevice) JglfwDisplayMode(com.badlogic.gdx.backends.jglfw.JglfwGraphics.JglfwDisplayMode)

Aggregations

DisplayMode (com.badlogic.gdx.Graphics.DisplayMode)1 JglfwDisplayMode (com.badlogic.gdx.backends.jglfw.JglfwGraphics.JglfwDisplayMode)1 Array (com.badlogic.gdx.utils.Array)1 GraphicsDevice (java.awt.GraphicsDevice)1