Skip to content

Commit

Permalink
Merge pull request #6428 from kevlahnota/master2
Browse files Browse the repository at this point in the history
fix GameLauncher
  • Loading branch information
kevlahnota authored Oct 25, 2024
2 parents bd3bf82 + 6f3debb commit 6362796
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
19 changes: 3 additions & 16 deletions forge-gui-mobile-dev/src/forge/app/GameLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,7 @@

public class GameLauncher {
public GameLauncher(final String versionString) {
// Set this to "true" to make the mobile game port run as a full-screen desktop application
boolean desktopMode = true;//cmd.hasOption("fullscreen");
// Set this to the location where you want the mobile game port to look for assets when working as a full-screen desktop application
// (uncomment the bottom version and comment the top one to load the res folder from the current folder the .jar is in if you would
// like to make the game load from a desktop game folder configuration).
//String desktopModeAssetsDir = "../forge-gui/";
String desktopModeAssetsDir = "./";
if (!Files.exists(Paths.get(desktopModeAssetsDir + "res")))
desktopModeAssetsDir = "../forge-gui/";//try IDE run

String assetsDir = "./";
if (!Files.exists(Paths.get(assetsDir + "res")))
assetsDir = "../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)
String switchOrientationFile = assetsDir + "switch_orientation.ini";
Expand All @@ -39,7 +27,7 @@ public GameLauncher(final String versionString) {
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
config.setResizable(false);
ApplicationListener start = Forge.getApp(new Lwjgl3Clipboard(), new Main.DesktopAdapter(switchOrientationFile),//todo get totalRAM && isTabletDevice
desktopMode ? desktopModeAssetsDir : assetsDir, false, false, 0, false, 0, "", "");
assetsDir, false, false, 0, false, 0, "", "");
if (Config.instance().getSettingData().fullScreen) {
config.setFullscreenMode(Lwjgl3ApplicationConfiguration.getDisplayMode());
config.setAutoIconify(true);
Expand All @@ -58,8 +46,7 @@ public boolean closeRequested() {
}
});

if (desktopMode)
config.setHdpiMode(HdpiMode.Logical);
config.setHdpiMode(HdpiMode.Logical);

new Lwjgl3Application(start, config);
}
Expand Down
5 changes: 3 additions & 2 deletions forge-gui-mobile/src/forge/assets/AssetsDownloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ public static void checkForUpdates(boolean exited, Runnable runnable) {
return;
}
}
//currently for desktop/mobile-dev release on github
final String releaseTag = Forge.getDeviceAdapter().getReleaseTag(GITHUB_RELEASES_URL_ATOM);

final String packageSize = GuiBase.isAndroid() ? "160MB" : "270MB";
final String apkSize = "12MB";

Expand All @@ -58,6 +57,8 @@ public static void checkForUpdates(boolean exited, Runnable runnable) {
String message;
boolean connectedToInternet = Forge.getDeviceAdapter().isConnectedToInternet();
if (connectedToInternet) {
//currently for desktop/mobile-dev release on github
final String releaseTag = Forge.getDeviceAdapter().getReleaseTag(GITHUB_RELEASES_URL_ATOM);
try {
URL versionUrl = new URL(versionText);
String version = FileUtil.readFileToString(versionUrl);
Expand Down

0 comments on commit 6362796

Please sign in to comment.