mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
- Added a possibility to run the mobile-Forge-on-desktop installation windowed using an extra parameter in screen_resolution.ini (e.g. 1920x1080x1 runs full-screen, 1920x1080x0 runs windowed).
- The file "fullscreen_resolution.ini" was renamed to "screen_resolution.ini" due to the change in its purpose.
This commit is contained in:
@@ -43,21 +43,27 @@ public class Main {
|
|||||||
|
|
||||||
// Fullscreen width and height for desktop mode (desktopMode = true)
|
// Fullscreen width and height for desktop mode (desktopMode = true)
|
||||||
// Can be specified inside the file fullscreen_resolution.ini to override default (in the format WxH, e.g. 1920x1080)
|
// Can be specified inside the file fullscreen_resolution.ini to override default (in the format WxH, e.g. 1920x1080)
|
||||||
int fullscreenWidth = LwjglApplicationConfiguration.getDesktopDisplayMode().width;
|
int desktopScreenWidth = LwjglApplicationConfiguration.getDesktopDisplayMode().width;
|
||||||
int fullscreenHeight = LwjglApplicationConfiguration.getDesktopDisplayMode().height;
|
int desktopScreenHeight = LwjglApplicationConfiguration.getDesktopDisplayMode().height;
|
||||||
if (FileUtil.doesFileExist(desktopModeAssetsDir + "fullscreen_resolution.ini")) {
|
boolean fullscreenFlag = false;
|
||||||
String[] res = FileUtil.readFileToString(desktopModeAssetsDir + "fullscreen_resolution.ini").split("x");
|
if (FileUtil.doesFileExist(desktopModeAssetsDir + "screen_resolution.ini")) {
|
||||||
if (res.length == 2) {
|
String[] res = FileUtil.readFileToString(desktopModeAssetsDir + "screen_resolution.ini").split("x");
|
||||||
fullscreenWidth = Integer.parseInt(res[0].trim());
|
if (res.length == 3) {
|
||||||
fullscreenHeight = Integer.parseInt(res[1].trim());
|
fullscreenFlag = Integer.parseInt(res[2].trim()) > 0;
|
||||||
|
desktopScreenWidth = Integer.parseInt(res[0].trim());
|
||||||
|
desktopScreenHeight = Integer.parseInt(res[1].trim());
|
||||||
|
} else if (res.length == 2) {
|
||||||
|
fullscreenFlag = true;
|
||||||
|
desktopScreenWidth = Integer.parseInt(res[0].trim());
|
||||||
|
desktopScreenHeight = Integer.parseInt(res[1].trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||||
config.resizable = false;
|
config.resizable = false;
|
||||||
config.width = desktopMode ? fullscreenWidth : screenWidth;
|
config.width = desktopMode ? desktopScreenWidth : screenWidth;
|
||||||
config.height = desktopMode ? fullscreenHeight : screenHeight;
|
config.height = desktopMode ? desktopScreenHeight : screenHeight;
|
||||||
config.fullscreen = desktopMode;
|
config.fullscreen = desktopMode && fullscreenFlag;
|
||||||
config.title = "Forge";
|
config.title = "Forge";
|
||||||
config.useHDPI = desktopMode; // enable HiDPI on Mac OS
|
config.useHDPI = desktopMode; // enable HiDPI on Mac OS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user