mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Normalize line endings
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="libs/gdx-backend-lwjgl-natives.jar"/>
|
||||
<classpathentry kind="lib" path="libs/gdx-backend-lwjgl.jar" sourcepath="libs/gdx-backend-lwjgl-sources.jar"/>
|
||||
<classpathentry kind="lib" path="libs/gdx-natives.jar"/>
|
||||
<classpathentry kind="lib" path="libs/gdx-freetype-natives.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="libs/gdx-backend-lwjgl-natives.jar"/>
|
||||
<classpathentry kind="lib" path="libs/gdx-backend-lwjgl.jar" sourcepath="libs/gdx-backend-lwjgl-sources.jar"/>
|
||||
<classpathentry kind="lib" path="libs/gdx-natives.jar"/>
|
||||
<classpathentry kind="lib" path="libs/gdx-freetype-natives.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>forge-gui-mobile-dev</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<variableList>
|
||||
<variable>
|
||||
<name>copy_PARENT</name>
|
||||
<value>$%7BPARENT-1-PROJECT_LOC%7D/trunk</value>
|
||||
</variable>
|
||||
</variableList>
|
||||
</projectDescription>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>forge-gui-mobile-dev</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<variableList>
|
||||
<variable>
|
||||
<name>copy_PARENT</name>
|
||||
<value>$%7BPARENT-1-PROJECT_LOC%7D/trunk</value>
|
||||
</variable>
|
||||
</variableList>
|
||||
</projectDescription>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
|
||||
@@ -1,137 +1,137 @@
|
||||
package forge.app;
|
||||
|
||||
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;
|
||||
import forge.assets.AssetsDownloader;
|
||||
import forge.interfaces.IDeviceAdapter;
|
||||
import forge.util.FileUtil;
|
||||
import forge.util.OperatingSystem;
|
||||
import forge.util.RestartUtil;
|
||||
import forge.util.Utils;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
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)
|
||||
// Can be specified inside the file fullscreen_resolution.ini to override default (in the format WxH, e.g. 1920x1080)
|
||||
int desktopScreenWidth = LwjglApplicationConfiguration.getDesktopDisplayMode().width;
|
||||
int desktopScreenHeight = LwjglApplicationConfiguration.getDesktopDisplayMode().height;
|
||||
boolean fullscreenFlag = true;
|
||||
if (FileUtil.doesFileExist(desktopModeAssetsDir + "screen_resolution.ini")) {
|
||||
String[] res = FileUtil.readFileToString(desktopModeAssetsDir + "screen_resolution.ini").split("x");
|
||||
fullscreenFlag = res.length == 3 ? Integer.parseInt(res[2].trim()) > 0 : true;
|
||||
if (res.length >= 2) {
|
||||
desktopScreenWidth = Integer.parseInt(res[0].trim());
|
||||
desktopScreenHeight = Integer.parseInt(res[1].trim());
|
||||
}
|
||||
}
|
||||
|
||||
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||
config.resizable = false;
|
||||
config.width = desktopMode ? desktopScreenWidth : screenWidth;
|
||||
config.height = desktopMode ? desktopScreenHeight : screenHeight;
|
||||
config.fullscreen = desktopMode && fullscreenFlag;
|
||||
config.title = "Forge";
|
||||
config.useHDPI = desktopMode; // enable HiDPI on Mac OS
|
||||
|
||||
new LwjglApplication(Forge.getApp(new LwjglClipboard(), new DesktopAdapter(switchOrientationFile),
|
||||
desktopMode ? desktopModeAssetsDir : assetsDir), config);
|
||||
}
|
||||
|
||||
private static class DesktopAdapter implements IDeviceAdapter {
|
||||
private final String switchOrientationFile;
|
||||
|
||||
private DesktopAdapter(String switchOrientationFile0) {
|
||||
switchOrientationFile = switchOrientationFile0;
|
||||
}
|
||||
|
||||
//just assume desktop always connected to wifi
|
||||
@Override
|
||||
public boolean isConnectedToInternet() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnectedToWifi() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDownloadsDir() {
|
||||
return System.getProperty("user.home") + "/Downloads/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean openFile(String filename) {
|
||||
try {
|
||||
Desktop.getDesktop().open(new File(filename));
|
||||
return true;
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restart() {
|
||||
if (RestartUtil.prepareForRestart()) {
|
||||
Gdx.app.exit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
Gdx.app.exit(); //can just use Gdx.app.exit for desktop
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTablet() {
|
||||
return true; //treat desktop the same as a tablet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLandscapeMode(boolean landscapeMode) {
|
||||
//create file to indicate that landscape mode should be used
|
||||
if (landscapeMode) {
|
||||
FileUtil.writeFile(switchOrientationFile, "1");
|
||||
}
|
||||
else {
|
||||
FileUtil.deleteFile(switchOrientationFile);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preventSystemSleep(boolean preventSleep) {
|
||||
OperatingSystem.preventSystemSleep(preventSleep);
|
||||
}
|
||||
}
|
||||
}
|
||||
package forge.app;
|
||||
|
||||
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;
|
||||
import forge.assets.AssetsDownloader;
|
||||
import forge.interfaces.IDeviceAdapter;
|
||||
import forge.util.FileUtil;
|
||||
import forge.util.OperatingSystem;
|
||||
import forge.util.RestartUtil;
|
||||
import forge.util.Utils;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
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)
|
||||
// Can be specified inside the file fullscreen_resolution.ini to override default (in the format WxH, e.g. 1920x1080)
|
||||
int desktopScreenWidth = LwjglApplicationConfiguration.getDesktopDisplayMode().width;
|
||||
int desktopScreenHeight = LwjglApplicationConfiguration.getDesktopDisplayMode().height;
|
||||
boolean fullscreenFlag = true;
|
||||
if (FileUtil.doesFileExist(desktopModeAssetsDir + "screen_resolution.ini")) {
|
||||
String[] res = FileUtil.readFileToString(desktopModeAssetsDir + "screen_resolution.ini").split("x");
|
||||
fullscreenFlag = res.length == 3 ? Integer.parseInt(res[2].trim()) > 0 : true;
|
||||
if (res.length >= 2) {
|
||||
desktopScreenWidth = Integer.parseInt(res[0].trim());
|
||||
desktopScreenHeight = Integer.parseInt(res[1].trim());
|
||||
}
|
||||
}
|
||||
|
||||
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||
config.resizable = false;
|
||||
config.width = desktopMode ? desktopScreenWidth : screenWidth;
|
||||
config.height = desktopMode ? desktopScreenHeight : screenHeight;
|
||||
config.fullscreen = desktopMode && fullscreenFlag;
|
||||
config.title = "Forge";
|
||||
config.useHDPI = desktopMode; // enable HiDPI on Mac OS
|
||||
|
||||
new LwjglApplication(Forge.getApp(new LwjglClipboard(), new DesktopAdapter(switchOrientationFile),
|
||||
desktopMode ? desktopModeAssetsDir : assetsDir), config);
|
||||
}
|
||||
|
||||
private static class DesktopAdapter implements IDeviceAdapter {
|
||||
private final String switchOrientationFile;
|
||||
|
||||
private DesktopAdapter(String switchOrientationFile0) {
|
||||
switchOrientationFile = switchOrientationFile0;
|
||||
}
|
||||
|
||||
//just assume desktop always connected to wifi
|
||||
@Override
|
||||
public boolean isConnectedToInternet() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnectedToWifi() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDownloadsDir() {
|
||||
return System.getProperty("user.home") + "/Downloads/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean openFile(String filename) {
|
||||
try {
|
||||
Desktop.getDesktop().open(new File(filename));
|
||||
return true;
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restart() {
|
||||
if (RestartUtil.prepareForRestart()) {
|
||||
Gdx.app.exit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
Gdx.app.exit(); //can just use Gdx.app.exit for desktop
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTablet() {
|
||||
return true; //treat desktop the same as a tablet
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLandscapeMode(boolean landscapeMode) {
|
||||
//create file to indicate that landscape mode should be used
|
||||
if (landscapeMode) {
|
||||
FileUtil.writeFile(switchOrientationFile, "1");
|
||||
}
|
||||
else {
|
||||
FileUtil.deleteFile(switchOrientationFile);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preventSystemSleep(boolean preventSleep) {
|
||||
OperatingSystem.preventSystemSleep(preventSleep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user