Created
January 5, 2018 15:50
-
-
Save Blunderchips/04c6f38d2eb7151e88f69870f7d24646 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.badlogic.gdx.ApplicationAdapter; | |
import com.badlogic.gdx.Gdx; | |
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; | |
import com.badlogic.gdx.backends.lwjgl.LwjglCanvas; | |
import java.awt.Canvas; | |
import javax.swing.JFrame; | |
import javax.swing.JPanel; | |
public final class SwingWindow extends JFrame { | |
public SwingWindow() { | |
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration(); | |
cfg.width = 800; | |
cfg.height = 60; | |
super.setSize(cfg.width, cfg.height); | |
super.setTitle(cfg.title); | |
JPanel panel = new JPanel(); | |
Canvas canvas = new LwjglCanvas(new ApplicationAdapter() {}, cfg).getCanvas(); | |
canvas.setBounds(0, 0, super.getWidth(), super.getHeight()); | |
panel.add(canvas); | |
super.add(panel); | |
super.setLocationRelativeTo(null); | |
super.setDefaultCloseOperation(DISPOSE_ON_CLOSE); | |
super.setUndecorated(true); | |
super.setLocationRelativeTo(null); | |
} | |
@Override | |
public void dispose() { | |
super.dispose(); | |
Gdx.app.exit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment