mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +00:00
fix windowmode settings
- Forge mobile port can be run on either windowed or fullscreen via settings
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
package forge.app;
|
package forge.app;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.ApplicationListener;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.backends.lwjgl3.*;
|
import com.badlogic.gdx.backends.lwjgl3.*;
|
||||||
import com.badlogic.gdx.graphics.glutils.HdpiMode;
|
import com.badlogic.gdx.graphics.glutils.HdpiMode;
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
|
import forge.adventure.util.Config;
|
||||||
import forge.assets.AssetsDownloader;
|
import forge.assets.AssetsDownloader;
|
||||||
import forge.interfaces.IDeviceAdapter;
|
import forge.interfaces.IDeviceAdapter;
|
||||||
import forge.localinstance.properties.ForgePreferences;
|
import forge.localinstance.properties.ForgePreferences;
|
||||||
@@ -103,10 +105,16 @@ public class Main {
|
|||||||
|
|
||||||
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
|
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
|
||||||
config.setResizable(false);
|
config.setResizable(false);
|
||||||
config.setWindowedMode(desktopMode ? desktopScreenWidth : screenWidth, desktopMode ? desktopScreenHeight : screenHeight);
|
ForgePreferences prefs = FModel.getPreferences();
|
||||||
if (desktopMode && fullscreenFlag) {
|
boolean propertyConfig = prefs != null && prefs.getPrefBoolean(ForgePreferences.FPref.UI_NETPLAY_COMPAT);
|
||||||
|
ApplicationListener start = Forge.getApp(new Lwjgl3Clipboard(), new DesktopAdapter(switchOrientationFile),//todo get totalRAM && isTabletDevice
|
||||||
|
desktopMode ? desktopModeAssetsDir : assetsDir, propertyConfig, false, 0, false, 0, "", "");
|
||||||
|
if (Config.instance().getSettingData().fullScreen) {
|
||||||
config.setFullscreenMode(Lwjgl3ApplicationConfiguration.getDisplayMode());
|
config.setFullscreenMode(Lwjgl3ApplicationConfiguration.getDisplayMode());
|
||||||
config.setAutoIconify(true); //fix alt-tab when running fullscreen
|
config.setAutoIconify(true);
|
||||||
|
config.setHdpiMode(HdpiMode.Logical);
|
||||||
|
} else {
|
||||||
|
config.setWindowedMode(Config.instance().getSettingData().width, Config.instance().getSettingData().height);
|
||||||
}
|
}
|
||||||
config.setTitle("Forge");
|
config.setTitle("Forge");
|
||||||
config.setWindowListener(new Lwjgl3WindowListener() {
|
config.setWindowListener(new Lwjgl3WindowListener() {
|
||||||
@@ -156,10 +164,7 @@ public class Main {
|
|||||||
if (desktopMode)
|
if (desktopMode)
|
||||||
config.setHdpiMode(HdpiMode.Logical);
|
config.setHdpiMode(HdpiMode.Logical);
|
||||||
|
|
||||||
ForgePreferences prefs = FModel.getPreferences();
|
new Lwjgl3Application(start, config);
|
||||||
boolean propertyConfig = prefs != null && prefs.getPrefBoolean(ForgePreferences.FPref.UI_NETPLAY_COMPAT);
|
|
||||||
new Lwjgl3Application(Forge.getApp(new Lwjgl3Clipboard(), new DesktopAdapter(switchOrientationFile),//todo get totalRAM && isTabletDevice
|
|
||||||
desktopMode ? desktopModeAssetsDir : assetsDir, propertyConfig, false, 0, false, 0, "", ""), config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class DesktopAdapter implements IDeviceAdapter {
|
private static class DesktopAdapter implements IDeviceAdapter {
|
||||||
|
|||||||
@@ -69,14 +69,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.raeleus.TenPatch</groupId>
|
<groupId>com.github.raeleus.TenPatch</groupId>
|
||||||
<artifactId>tenpatch</artifactId>
|
<artifactId>tenpatch</artifactId>
|
||||||
<version>5.2.2</version>
|
<version>5.2.3</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.fourthline.cling</groupId>
|
<groupId>org.fourthline.cling</groupId>
|
||||||
<artifactId>cling-core</artifactId>
|
<artifactId>cling-core</artifactId>
|
||||||
<version>2.1.2</version>
|
<version>2.1.2</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user