Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix GameLauncher #6428

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading