mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- Implemented optional texture filtering for card pictures on the battlefield in mobile Forge (helpful on larger tablets and when running mobile Forge on PC), disabled by default.
This commit is contained in:
@@ -53,6 +53,7 @@ public class Forge implements ApplicationListener {
|
||||
private static boolean exited;
|
||||
private static int continuousRenderingCount = 1; //initialize to 1 since continuous rendering is the default
|
||||
private static final Stack<FScreen> screens = new Stack<FScreen>();
|
||||
private static boolean textureFiltering = false;
|
||||
|
||||
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0) {
|
||||
if (GuiBase.getInterface() == null) {
|
||||
@@ -75,15 +76,19 @@ public class Forge implements ApplicationListener {
|
||||
splashScreen = new SplashScreen();
|
||||
Gdx.input.setInputProcessor(new MainInputProcessor());
|
||||
|
||||
ForgePreferences prefs = new ForgePreferences();
|
||||
|
||||
String skinName;
|
||||
if (FileUtil.doesFileExist(ForgeConstants.MAIN_PREFS_FILE)) {
|
||||
skinName = new ForgePreferences().getPref(FPref.UI_SKIN);
|
||||
skinName = prefs.getPref(FPref.UI_SKIN);
|
||||
}
|
||||
else {
|
||||
skinName = "default"; //use default skin if preferences file doesn't exist yet
|
||||
}
|
||||
FSkin.loadLight(skinName, splashScreen);
|
||||
|
||||
textureFiltering = prefs.getPrefBoolean(FPref.UI_LIBGDX_TEXTURE_FILTERING);
|
||||
|
||||
//load model on background thread (using progress bar to report progress)
|
||||
FThreads.invokeInBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
@@ -262,6 +267,10 @@ public class Forge implements ApplicationListener {
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isTextureFilteringEnabled() {
|
||||
return textureFiltering;
|
||||
}
|
||||
|
||||
public static boolean isLandscapeMode() {
|
||||
return screenWidth > screenHeight;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import com.google.common.cache.CacheLoader;
|
||||
|
||||
import forge.Forge;
|
||||
import forge.ImageKeys;
|
||||
import forge.model.FModel;
|
||||
import forge.properties.ForgePreferences;
|
||||
|
||||
final class ImageLoader extends CacheLoader<String, Texture> {
|
||||
@Override
|
||||
@@ -16,8 +18,14 @@ final class ImageLoader extends CacheLoader<String, Texture> {
|
||||
if (file != null) {
|
||||
FileHandle fh = new FileHandle(file);
|
||||
try {
|
||||
if (Forge.isTextureFilteringEnabled()) {
|
||||
Texture t = new Texture(fh, true);
|
||||
t.setFilter(Texture.TextureFilter.MipMapLinearNearest, Texture.TextureFilter.MipMapNearestNearest);
|
||||
return t;
|
||||
} else {
|
||||
return new Texture(fh);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Forge.log("Could not read image file " + fh.path() + "\n\nException:\n" + ex.toString());
|
||||
}
|
||||
|
||||
@@ -189,6 +189,10 @@ public class SettingsPage extends TabPage<SettingsScreen> {
|
||||
"Show Match Background",
|
||||
"Show match background image on battlefield, otherwise background texture shown instead."),
|
||||
4);
|
||||
lstSettings.addItem(new BooleanSetting(FPref.UI_LIBGDX_TEXTURE_FILTERING,
|
||||
"Battlefield Texture Filtering",
|
||||
"Filter card art on battlefield to make it look less pixelated on large screens (restart required)."),
|
||||
4);
|
||||
lstSettings.addItem(new CustomSelectSetting(FPref.UI_DISPLAY_CURRENT_COLORS,
|
||||
"Detailed Card Color",
|
||||
"Displays the breakdown of the current color of cards in the card detail information panel.",
|
||||
|
||||
@@ -58,6 +58,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
|
||||
UI_COMPACT_LIST_ITEMS ("false"),
|
||||
UI_CARD_SIZE ("small"),
|
||||
UI_SINGLE_CARD_ZOOM("false"),
|
||||
UI_LIBGDX_TEXTURE_FILTERING("false"),
|
||||
UI_BUGZ_NAME (""),
|
||||
UI_BUGZ_PWD (""),
|
||||
UI_ANTE ("false"),
|
||||
|
||||
Reference in New Issue
Block a user