List of usage examples for com.badlogic.gdx.backends.lwjgl LwjglFrame LwjglFrame
public LwjglFrame(ApplicationListener listener, LwjglApplicationConfiguration config)
From source file:com.o2d.pkayjava.editor.Main.java
License:Apache License
private void startLoadingEditor() { //first, kill off the splash if (!(SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_UNIX)) { splash.kill();//from ww w .j a va2s . c o m } Overlap2D overlap2D = new Overlap2D(); Rectangle maximumWindowBounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); double width = maximumWindowBounds.getWidth(); double height = maximumWindowBounds.getHeight(); if (SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_MAC) { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Overlap2D"); JglfwApplicationConfiguration config = new JglfwApplicationConfiguration(); config.width = (int) (width); config.height = (int) (height - height * .04); config.backgroundFPS = 0; config.title = "Overlap2D - Public Alpha v" + AppConfig.getInstance().version; new JglfwApplication(overlap2D, config); } else { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.title = "Overlap2D - Public Alpha v" + AppConfig.getInstance().version; config.fullscreen = true; config.resizable = false; config.width = (int) (width); config.height = (int) (height - height * .04); config.backgroundFPS = 0; mainFrame = new LwjglFrame(overlap2D, config); mainFrame.setExtendedState(mainFrame.getExtendedState() | JFrame.MAXIMIZED_BOTH); toggleVisible(); // subscribe to file dropping notifications, currently windows only DropTarget dropTarget = new DropTarget(mainFrame, new FileDropListener()); } if (!SystemUtils.IS_OS_UNIX) { // no aesthetics for linux users I guess.. setIcon(); } }
From source file:es.eucm.ead.editor.EditorDesktop.java
License:Open Source License
/** * {@link EditorDesktop} admits two optional arguments: args[0] The full * path of a project.json file to open the editor with args[1] "debug" to * launch the editor in debug mode. Question: What does this actually do? *//*from w w w .j a v a 2s.c o m*/ public static void main(String[] args) { boolean debug = false; if (args != null) { for (String arg : args) { if ("debug".equals(arg.toLowerCase())) { debug = true; break; } } } LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.forceExit = true; DesktopPlatform platform = new DesktopPlatform(); final LwjglFrame frame = new LwjglFrame( new EditorDesktop(platform, (args.length > 0 && !"debug".equals(args[0])) ? args[0] : null, debug), config); frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); platform.setFrame(frame); // set visible calls create() SwingEDTUtils.invokeLater(new Runnable() { @Override public void run() { frame.setVisible(true); } }); }
From source file:es.eucm.ead.engine.EngineDesktop.java
License:Open Source License
/** * Builds a desktop application./*from w w w. j a v a 2 s. c o m*/ * * @param width * Expected width of the application window. * @param height * Expected height of the application window. * * @throw IllegalArgumentException if {@code width < 0 || height < 0} */ public EngineDesktop(int width, int height) { if (width < 0) { throw new IllegalArgumentException("width must be > 0: " + width); } if (height < 0) { throw new IllegalArgumentException("height must be > 0: " + height); } this.width = width; this.height = height; LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); this.applicationListener = new EngineApplicationListener(new DesktopImageUtils()); config.width = width; config.height = height; config.forceExit = false; frame = new LwjglFrame(this.applicationListener, config); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { dispose(); } }); setSize(width, height); SwingEDTUtils.invokeLater(new Runnable() { @Override public void run() { frame.setVisible(true); } }); }