add splashscreen for mobile-dev

This commit is contained in:
Anthony Calosa
2024-10-06 23:13:51 +08:00
parent 5d959dc963
commit f4671133f3
6 changed files with 25 additions and 5 deletions

View File

@@ -27,6 +27,7 @@
<include>**/bg_splash.png</include>
<include>**/bg_texture.jpg</include>
<include>**/font1.ttf</include>
<include>**/logo.png</include>
</includes>
</resource>
</resources>
@@ -84,11 +85,6 @@
<errTitle>forge</errTitle>
<downloadUrl>https://bell-sw.com/pages/downloads/#jdk-17-lts</downloadUrl>
<icon>src/main/config/forge-adventure.ico</icon>
<classPath>
<mainClass>forge.app.Main</mainClass>
<addDependencies>false</addDependencies>
<preCp>anything</preCp>
</classPath>
<jre>
<minVersion>17</minVersion>
<requiresJdk>jdkOnly</requiresJdk>
@@ -154,6 +150,9 @@
<mainClass>forge.app.Main</mainClass>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<SplashScreen-Image>splash/logo.png</SplashScreen-Image>
</manifestEntries>
</archive>
</configuration>
<executions>

View File

@@ -10,6 +10,7 @@ import org.apache.commons.lang3.tuple.Pair;
import javax.imageio.ImageIO;
import java.awt.Desktop;
import java.awt.SplashScreen;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
@@ -89,6 +90,14 @@ public class Main {
System.exit(0);
}
@Override
public void closeSplashScreen() {
SplashScreen splash = SplashScreen.getSplashScreen();
if (splash != null) {
splash.close();
}
}
@Override
public boolean isTablet() {
return true; //treat desktop the same as a tablet