mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +00:00
- Improved the Forge Mobile Dev project: it can now function as a fullscreen back-port of the mobile Forge app running on Linux, Mac and Windows PCs.
- Added desktopMode parameter to forge-gui-mobile-dev Main: set it to "true" to make the game run in full-screen mode. - Added desktopModeAssetsDir parameter to forge-gui-mobile-dev Main: it can be set to make the game use the standard desktop Forge assets folder structure. - Disabled resizing for the forge-gui-mobile-dev screen when running in standard cellphone/tablet "emulation" mode since it causes visual graphics corruption. - Added a Maven plugin to forge-gui-mobile-dev to build a .jar with dependencies (like for desktop Forge) that can function as a standalone executable running on Linux, Mac and Windows systems.
This commit is contained in:
@@ -21,6 +21,37 @@
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<attach>false</attach>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>forge.app.Main</mainClass>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Implementation-Version>${fullversionstring}</Implementation-Version>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<!-- this is used for inheritance merges -->
|
||||
<phase>package</phase>
|
||||
<!-- bind to the packaging phase -->
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.io.IOException;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglClipboard;
|
||||
|
||||
import forge.Forge;
|
||||
@@ -18,18 +19,42 @@ import forge.util.Utils;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
// Set this to "true" to make the mobile game port run as a full-screen desktop application
|
||||
boolean desktopMode = false;
|
||||
// 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 = "./";
|
||||
|
||||
// Assets directory used when the game fully emulates smartphone/tablet mode (desktopMode = false), useful when debugging from IDE
|
||||
String assetsDir = AssetsDownloader.SHARE_DESKTOP_ASSETS ? "../forge-gui/" : "testAssets/";
|
||||
if (!AssetsDownloader.SHARE_DESKTOP_ASSETS) {
|
||||
FileUtil.ensureDirectoryExists(assetsDir);
|
||||
}
|
||||
|
||||
// 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";
|
||||
boolean landscapeMode = FileUtil.doesFileExist(switchOrientationFile);
|
||||
|
||||
// Width and height for standard smartphone/tablet mode (desktopMode = false)
|
||||
int screenWidth = landscapeMode ? (int)(Utils.BASE_HEIGHT * 16 / 9) : (int)Utils.BASE_WIDTH;
|
||||
int screenHeight = (int)Utils.BASE_HEIGHT;
|
||||
|
||||
// Fullscreen width and height for desktop mode (desktopMode = true)
|
||||
int fullscreenWidth = LwjglApplicationConfiguration.getDesktopDisplayMode().width;
|
||||
int fullscreenHeight = LwjglApplicationConfiguration.getDesktopDisplayMode().height;
|
||||
|
||||
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||
config.resizable = false;
|
||||
config.width = desktopMode ? fullscreenWidth : screenWidth;
|
||||
config.height = desktopMode ? fullscreenHeight : screenHeight;
|
||||
config.fullscreen = desktopMode ? true : false;
|
||||
config.title = "Forge";
|
||||
//config.useHDPI = true; // enable HiDPI on Mac OS X (not tested)
|
||||
|
||||
new LwjglApplication(Forge.getApp(new LwjglClipboard(), new DesktopAdapter(switchOrientationFile),
|
||||
assetsDir), "Forge", screenWidth, screenHeight);
|
||||
desktopMode ? desktopModeAssetsDir : assetsDir), config);
|
||||
}
|
||||
|
||||
private static class DesktopAdapter implements IDeviceAdapter {
|
||||
|
||||
Reference in New Issue
Block a user