use of com.badlogic.gdx.Graphics.DisplayMode in project AmazingMaze by TheVirtualMachine.
the class DesktopLauncher method main.
public static void main(String[] arg) {
System.setProperty("org.lwjgl.opengl.Display.allowSoftwareOpenGL", "true");
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
DisplayMode displayMode = LwjglApplicationConfiguration.getDesktopDisplayMode();
config.setFromDisplayMode(displayMode);
config.title = "Amazing Maze";
config.vSyncEnabled = true;
config.foregroundFPS = 0;
config.addIcon("icons/128.png", FileType.Internal);
config.addIcon("icons/32.png", FileType.Internal);
config.addIcon("icons/16.png", FileType.Internal);
new LwjglApplication(new AmazingMazeGame(), config);
}
use of com.badlogic.gdx.Graphics.DisplayMode in project libgdx by libgdx.
the class LwjglApplicationConfiguration method getDisplayModes.
public static DisplayMode[] getDisplayModes() {
GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice device = genv.getDefaultScreenDevice();
java.awt.DisplayMode desktopMode = device.getDisplayMode();
java.awt.DisplayMode[] displayModes = device.getDisplayModes();
ArrayList<DisplayMode> modes = new ArrayList<DisplayMode>();
int idx = 0;
for (java.awt.DisplayMode mode : displayModes) {
boolean duplicate = false;
for (int i = 0; i < modes.size(); i++) {
if (modes.get(i).width == mode.getWidth() && modes.get(i).height == mode.getHeight() && modes.get(i).bitsPerPixel == mode.getBitDepth()) {
duplicate = true;
break;
}
}
if (duplicate)
continue;
if (mode.getBitDepth() != desktopMode.getBitDepth())
continue;
modes.add(new LwjglApplicationConfigurationDisplayMode(mode.getWidth(), mode.getHeight(), mode.getRefreshRate(), mode.getBitDepth()));
}
return modes.toArray(new DisplayMode[modes.size()]);
}
use of com.badlogic.gdx.Graphics.DisplayMode 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);
}
use of com.badlogic.gdx.Graphics.DisplayMode in project libgdx by libgdx.
the class Lwjgl3ApplicationConfiguration method getDisplayModes.
/**
* @return the available {@link DisplayMode}s of the primary monitor
*/
public static DisplayMode[] getDisplayModes() {
Lwjgl3Application.initializeGlfw();
Buffer videoModes = GLFW.glfwGetVideoModes(GLFW.glfwGetPrimaryMonitor());
DisplayMode[] result = new DisplayMode[videoModes.limit()];
for (int i = 0; i < result.length; i++) {
GLFWVidMode videoMode = videoModes.get(i);
result[i] = new Lwjgl3Graphics.Lwjgl3DisplayMode(GLFW.glfwGetPrimaryMonitor(), videoMode.width(), videoMode.height(), videoMode.refreshRate(), videoMode.redBits() + videoMode.greenBits() + videoMode.blueBits());
}
return result;
}
use of com.badlogic.gdx.Graphics.DisplayMode in project libgdx by libgdx.
the class DisplayModeTest method create.
@Override
public void create() {
DisplayMode displayMode = Gdx.graphics.getDisplayMode();
DisplayMode displayModeForMonitor = Gdx.graphics.getDisplayMode(Gdx.graphics.getMonitor());
DisplayMode[] displayModes = Gdx.graphics.getDisplayModes();
DisplayMode[] displayModesForMonitor = Gdx.graphics.getDisplayModes(Gdx.graphics.getMonitor());
Gdx.app.log("DisplayModeTest", "Display mode (using Gdx.graphics.getDisplayMode() ) : " + displayMode);
Gdx.app.log("DisplayModeTest", "Display mode (using Gdx.graphics.getDisplayMode(Gdx.graphics.getMonitor()) ) : " + Arrays.toString(displayModes));
Gdx.app.log("DisplayModeTest", "Display mode (using Gdx.graphics.getDisplayModes() ) : " + Arrays.toString(displayModesForMonitor));
Gdx.app.log("DisplayModeTest", "Display mode (using Gdx.graphics.getDisplayModes(Gdx.graphics.getMonitor()) ): " + displayModeForMonitor);
assertDisplayModeEquals(displayMode, displayModeForMonitor);
assertDisplayModesEquals(displayModes, displayModesForMonitor);
}
Aggregations