gdx-studio
git clone https://git.pyrossh.dev/gdx-studio
An IDE for creating Games using libgdx and Java supported on all platforms Android, iOS, Desktop
src/scene2d/desktop/Main.java
| a9b2a64 | 1 | package scene2d.desktop; |
| a9b2a64 | 2 | |
| a9b2a64 | 3 | import java.awt.Dimension; |
| a9b2a64 | 4 | import java.awt.Toolkit; |
| a9b2a64 | 5 | |
| a9b2a64 | 6 | import scene2d.Scene; |
| a9b2a64 | 7 | |
| a9b2a64 | 8 | import com.badlogic.gdx.Files.FileType; |
| a9b2a64 | 9 | import com.badlogic.gdx.backends.lwjgl.LwjglApplication; |
| a9b2a64 | 10 | import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; |
| a9b2a64 | 11 | |
| a9b2a64 | 12 | public class Main {
|
| a9b2a64 | 13 | |
| a9b2a64 | 14 | public static void main(String[] argc) {
|
| a9b2a64 | 15 | final LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration(); |
| a9b2a64 | 16 | Scene.configJson = Scene.jsonReader.parse(Main.class.getClassLoader().getResourceAsStream("config"));
|
| a9b2a64 | 17 | if(Scene.configJson.getBoolean("hasIcon"))
|
| a9b2a64 | 18 | cfg.addIcon("icon.png", FileType.Internal);
|
| a9b2a64 | 19 | String[] screen = Scene.configJson.getString("screenSize").split("x");
|
| a9b2a64 | 20 | String[] target = Scene.configJson.getString("targetSize").split("x");
|
| a9b2a64 | 21 | cfg.width = Integer.parseInt(screen[0]); |
| a9b2a64 | 22 | cfg.height = Integer.parseInt(screen[1]); |
| a9b2a64 | 23 | Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); |
| a9b2a64 | 24 | cfg.x = (int) ((dimension.getWidth() - cfg.width) / 2); |
| a9b2a64 | 25 | cfg.y = (int) ((dimension.getHeight() - cfg.height) / 2); |
| a9b2a64 | 26 | cfg.resizable = Scene.configJson.getBoolean("resize");
|
| a9b2a64 | 27 | cfg.forceExit = Scene.configJson.getBoolean("forceExit");
|
| a9b2a64 | 28 | cfg.fullscreen = Scene.configJson.getBoolean("fullScreen");
|
| a9b2a64 | 29 | cfg.useGL20 = Scene.configJson.getBoolean("useGL20");
|
| a9b2a64 | 30 | cfg.vSyncEnabled = Scene.configJson.getBoolean("vSync");
|
| a9b2a64 | 31 | cfg.audioDeviceBufferCount = Scene.configJson.getInt("audioBufferCount");
|
| a9b2a64 | 32 | LwjglApplicationConfiguration.disableAudio = Scene.configJson.getBoolean("disableAudio");
|
| a9b2a64 | 33 | Scene.targetWidth = Integer.parseInt(target[0]); |
| a9b2a64 | 34 | Scene.targetHeight = Integer.parseInt(target[1]); |
| a9b2a64 | 35 | new LwjglApplication(Scene.app, cfg); |
| a9b2a64 | 36 | } |
| a9b2a64 | 37 | } |
| a9b2a64 | 38 |