public void run () { addCanvas(); setVisible(true); lwjglCanvas.getCanvas().requestFocus(); } });
public LwjglFrame (ApplicationListener listener, LwjglApplicationConfiguration config) { super(config.title); construct(listener, config); }
protected void stopped () { LwjglFrame.this.dispose(); }
protected void setDisplayMode (int width, int height) { Dimension size = new Dimension(Math.round(width / scaleX), Math.round(height / scaleY)); LwjglFrame.this.getContentPane().setPreferredSize(size); LwjglFrame.this.getContentPane().invalidate(); LwjglFrame.this.pack(); LwjglFrame.this.setLocationRelativeTo(null); updateSize(width, height); }
setHaltOnShutdown(true); setDefaultCloseOperation(EXIT_ON_CLOSE); AffineTransform transform = getGraphicsConfiguration().getDefaultTransform(); float scaleX = (float)transform.getScaleX(), scaleY = (float)transform.getScaleY(); Dimension size = new Dimension(Math.round(config.width / scaleX), Math.round(config.height / scaleY)); getContentPane().setPreferredSize(size); initialize(); pack(); Point location = getLocation(); if (location.x == 0 && location.y == 0) setLocationRelativeTo(null); lwjglCanvas.getCanvas().setSize(size);
public static void main(String[] args) { // create the config as usual final LwjglApplicationConfiguration cfg = createConfig(); // create your Game final game MyGame = new MyGame(); // create an LwjglFrame with your game and the configuration final LwjglFrame frame = new LwjglFrame(game, cfg); // add the game as a component listener frame.addComponentListener(game); // set the frame visible frame.setVisible(true); }
protected int getFrameRate () { int frameRate = LwjglFrame.this.getFrameRate(); return frameRate == 0 ? super.getFrameRate() : frameRate; } };
/** Adds the canvas to the content pane. This triggers addNotify and starts the canvas' game loop. */ protected void addCanvas () { getContentPane().add(lwjglCanvas.getCanvas()); }
protected void exception (Throwable t) { LwjglFrame.this.exception(t); }
setHaltOnShutdown(true); setDefaultCloseOperation(EXIT_ON_CLOSE); AffineTransform transform = getGraphicsConfiguration().getDefaultTransform(); float scaleX = (float)transform.getScaleX(), scaleY = (float)transform.getScaleY(); Dimension size = new Dimension(Math.round(config.width / scaleX), Math.round(config.height / scaleY)); getContentPane().setPreferredSize(size); initialize(); pack(); Point location = getLocation(); if (location.x == 0 && location.y == 0) setLocationRelativeTo(null); lwjglCanvas.getCanvas().setSize(size);
protected void setDisplayMode (int width, int height) { Dimension size = new Dimension(Math.round(width / scaleX), Math.round(height / scaleY)); LwjglFrame.this.getContentPane().setPreferredSize(size); LwjglFrame.this.getContentPane().invalidate(); LwjglFrame.this.pack(); LwjglFrame.this.setLocationRelativeTo(null); updateSize(width, height); }
public static void main(String[] args) { // create the config as usual final LwjglApplicationConfiguration cfg = createConfig(); // create your ApplicationListener as usual final ApplicationListener application = createApplication(); // create an LwjglFrame with your configuration and the listener final LwjglFrame frame = new LwjglFrame(application, cfg); // add a component listener for when the frame gets moved frame.addComponentListener(new ComponentAdapter() { @Override public void componentMoved(ComponentEvent e) { // somehow pause your game here MyGame.getInstance().pauseGame(); } }); // set the frame visible frame.setVisible(true); }
protected int getFrameRate () { int frameRate = LwjglFrame.this.getFrameRate(); return frameRate == 0 ? super.getFrameRate() : frameRate; } };
/** Adds the canvas to the content pane. This triggers addNotify and starts the canvas' game loop. */ protected void addCanvas () { getContentPane().add(lwjglCanvas.getCanvas()); }
protected void exception (Throwable t) { LwjglFrame.this.exception(t); }
setHaltOnShutdown(true); setDefaultCloseOperation(EXIT_ON_CLOSE); AffineTransform transform = getGraphicsConfiguration().getDefaultTransform(); float scaleX = (float)transform.getScaleX(), scaleY = (float)transform.getScaleY(); Dimension size = new Dimension(Math.round(config.width / scaleX), Math.round(config.height / scaleY)); getContentPane().setPreferredSize(size); initialize(); pack(); Point location = getLocation(); if (location.x == 0 && location.y == 0) setLocationRelativeTo(null); lwjglCanvas.getCanvas().setSize(size);
protected void setDisplayMode (int width, int height) { Dimension size = new Dimension(Math.round(width / scaleX), Math.round(height / scaleY)); LwjglFrame.this.getContentPane().setPreferredSize(size); LwjglFrame.this.getContentPane().invalidate(); LwjglFrame.this.pack(); LwjglFrame.this.setLocationRelativeTo(null); updateSize(width, height); }
public void run () { addCanvas(); setVisible(true); lwjglCanvas.getCanvas().requestFocus(); } });
public LwjglFrame (ApplicationListener listener, LwjglApplicationConfiguration config) { super(config.title); construct(listener, config); }
protected int getFrameRate () { int frameRate = LwjglFrame.this.getFrameRate(); return frameRate == 0 ? super.getFrameRate() : frameRate; } };