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)
|
||||
// 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 fullscreenHeight = LwjglApplicationConfiguration.getDesktopDisplayMode().height;
|
||||
if (FileUtil.doesFileExist(desktopModeAssetsDir + "fullscreen_resolution.ini")) {
|
||||
String[] res = FileUtil.readFileToString(desktopModeAssetsDir + "fullscreen_resolution.ini").split("x");
|
||||
if (res.length == 2) {
|
||||
fullscreenWidth = Integer.parseInt(res[0].trim());
|
||||
fullscreenHeight = Integer.parseInt(res[1].trim());
|
||||
int desktopScreenWidth = LwjglApplicationConfiguration.getDesktopDisplayMode().width;
|
||||
int desktopScreenHeight = LwjglApplicationConfiguration.getDesktopDisplayMode().height;
|
||||
boolean fullscreenFlag = false;
|
||||
if (FileUtil.doesFileExist(desktopModeAssetsDir + "screen_resolution.ini")) {
|
||||
String[] res = FileUtil.readFileToString(desktopModeAssetsDir + "screen_resolution.ini").split("x");
|
||||
if (res.length == 3) {
|
||||
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();
|
||||
config.resizable = false;
|
||||
config.width = desktopMode ? fullscreenWidth : screenWidth;
|
||||
config.height = desktopMode ? fullscreenHeight : screenHeight;
|
||||
config.fullscreen = desktopMode;
|
||||
config.width = desktopMode ? desktopScreenWidth : screenWidth;
|
||||
config.height = desktopMode ? desktopScreenHeight : screenHeight;
|
||||
config.fullscreen = desktopMode && fullscreenFlag;
|
||||
config.title = "Forge";
|
||||
config.useHDPI = desktopMode; // enable HiDPI on Mac OS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user