This commit is contained in:
Anthony Calosa
2024-11-22 15:45:44 +08:00
parent c773e39b52
commit 66045c0c0a
2 changed files with 17 additions and 11 deletions

View File

@@ -20,9 +20,21 @@ import java.util.Optional;
public class Main {
private static final String versionString = BuildInfo.getVersionString();
public static void main(String[] args) {
if (!OperatingSystem.isWindows()) {
/* Prevents crash on non Windows OS before creating the LWJGL3 window.
It seems it defeats the purpose of having a splash image since
this is an indicator if the LWJGL3 has booted up succesfully. */
closeSplash();
}
new GameLauncher(versionString);
}
public static void closeSplash() {
try {
Optional.ofNullable(SplashScreen.getSplashScreen()).ifPresent(SplashScreen::close);
} catch (Exception e) {
e.printStackTrace();
}
}
public static class DesktopAdapter implements IDeviceAdapter {
private final String switchOrientationFile;
@@ -96,15 +108,7 @@ public class Main {
@Override
public void closeSplashScreen() {
// FIXME: on Linux system it can't close splashscreen image or crash with SIGSEGV? How come it works on other OS?
if (OperatingSystem.isUnix() || OperatingSystem.isSolaris())
return;
//could throw exception..
try {
Optional.ofNullable(SplashScreen.getSplashScreen()).ifPresent(SplashScreen::close);
} catch (Exception e) {
e.printStackTrace();
}
closeSplash();
}
@Override