mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Support command line args width= and height= for easier testing of portrait layouts.
This commit is contained in:
@@ -15,7 +15,7 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
public class GameLauncher {
|
public class GameLauncher {
|
||||||
public GameLauncher(final String versionString) {
|
public GameLauncher(final String versionString, final String[] args) {
|
||||||
String assetsDir = Files.exists(Paths.get("./res")) ? "./" : "../forge-gui/";
|
String assetsDir = Files.exists(Paths.get("./res")) ? "./" : "../forge-gui/";
|
||||||
|
|
||||||
// Place the file "switch_orientation.ini" to your assets folder to make the game switch to landscape orientation (unless desktopMode = true)
|
// Place the file "switch_orientation.ini" to your assets folder to make the game switch to landscape orientation (unless desktopMode = true)
|
||||||
@@ -29,12 +29,22 @@ public class GameLauncher {
|
|||||||
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
|
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
|
||||||
ApplicationListener start = Forge.getApp(new Lwjgl3Clipboard(), new Main.DesktopAdapter(switchOrientationFile),//todo get totalRAM && isTabletDevice
|
ApplicationListener start = Forge.getApp(new Lwjgl3Clipboard(), new Main.DesktopAdapter(switchOrientationFile),//todo get totalRAM && isTabletDevice
|
||||||
assetsDir, false, false, 0, false, 0, "", "");
|
assetsDir, false, false, 0, false, 0, "", "");
|
||||||
|
|
||||||
|
int windowWidth = Config.instance().getSettingData().width;
|
||||||
|
int windowHeight = Config.instance().getSettingData().height;
|
||||||
|
for(String arg : args) {
|
||||||
|
if(arg.startsWith("width="))
|
||||||
|
windowWidth = Integer.parseInt(arg.substring(6));
|
||||||
|
if(arg.startsWith("height="))
|
||||||
|
windowHeight = Integer.parseInt(arg.substring(7));
|
||||||
|
}
|
||||||
|
|
||||||
if (Config.instance().getSettingData().fullScreen) {
|
if (Config.instance().getSettingData().fullScreen) {
|
||||||
config.setFullscreenMode(Lwjgl3ApplicationConfiguration.getDisplayMode());
|
config.setFullscreenMode(Lwjgl3ApplicationConfiguration.getDisplayMode());
|
||||||
config.setAutoIconify(true);
|
config.setAutoIconify(true);
|
||||||
config.setHdpiMode(HdpiMode.Logical);
|
config.setHdpiMode(HdpiMode.Logical);
|
||||||
} else {
|
} else {
|
||||||
config.setWindowedMode(Config.instance().getSettingData().width, Config.instance().getSettingData().height);
|
config.setWindowedMode(windowWidth, windowHeight);
|
||||||
config.setResizable(false);
|
config.setResizable(false);
|
||||||
}
|
}
|
||||||
config.setTitle("Forge - " + versionString);
|
config.setTitle("Forge - " + versionString);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class Main {
|
|||||||
this is an indicator if the LWJGL3 has booted up succesfully. */
|
this is an indicator if the LWJGL3 has booted up succesfully. */
|
||||||
closeSplash();
|
closeSplash();
|
||||||
}
|
}
|
||||||
new GameLauncher(versionString);
|
new GameLauncher(versionString, args);
|
||||||
}
|
}
|
||||||
public static void closeSplash() {
|
public static void closeSplash() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user