mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
[Mobile] dispose texture as an option
This commit is contained in:
@@ -73,6 +73,7 @@ public class Forge implements ApplicationListener {
|
|||||||
public static boolean hdstart = false;
|
public static boolean hdstart = false;
|
||||||
public static boolean isPortraitMode = false;
|
public static boolean isPortraitMode = false;
|
||||||
public static boolean gameInProgress = false;
|
public static boolean gameInProgress = false;
|
||||||
|
public static boolean disposeTextures = false;
|
||||||
public static int cacheSize = 400;
|
public static int cacheSize = 400;
|
||||||
public static int totalDeviceRAM = 0;
|
public static int totalDeviceRAM = 0;
|
||||||
public static int androidVersion = 0;
|
public static int androidVersion = 0;
|
||||||
@@ -138,6 +139,7 @@ public class Forge implements ApplicationListener {
|
|||||||
enablePreloadExtendedArt = prefs.getPrefBoolean(FPref.UI_ENABLE_PRELOAD_EXTENDED_ART);
|
enablePreloadExtendedArt = prefs.getPrefBoolean(FPref.UI_ENABLE_PRELOAD_EXTENDED_ART);
|
||||||
locale = prefs.getPref(FPref.UI_LANGUAGE);
|
locale = prefs.getPref(FPref.UI_LANGUAGE);
|
||||||
autoCache = prefs.getPrefBoolean(FPref.UI_AUTO_CACHE_SIZE);
|
autoCache = prefs.getPrefBoolean(FPref.UI_AUTO_CACHE_SIZE);
|
||||||
|
disposeTextures = prefs.getPrefBoolean(FPref.UI_ENABLE_DISPOSE_TEXTURES);
|
||||||
|
|
||||||
if (autoCache) {
|
if (autoCache) {
|
||||||
//increase cacheSize for devices with RAM more than 5GB, default is 400. Some phones have more than 10GB RAM (Mi 10, OnePlus 8, S20, etc..)
|
//increase cacheSize for devices with RAM more than 5GB, default is 400. Some phones have more than 10GB RAM (Mi 10, OnePlus 8, S20, etc..)
|
||||||
@@ -437,7 +439,7 @@ public class Forge implements ApplicationListener {
|
|||||||
String previousScreen = currentScreen != null ? currentScreen.toString() : "";
|
String previousScreen = currentScreen != null ? currentScreen.toString() : "";
|
||||||
|
|
||||||
gameInProgress = toNewScreen.toLowerCase().contains("match") || previousScreen.toLowerCase().contains("match");
|
gameInProgress = toNewScreen.toLowerCase().contains("match") || previousScreen.toLowerCase().contains("match");
|
||||||
boolean dispose = toNewScreen.toLowerCase().contains("homescreen");
|
boolean dispose = toNewScreen.toLowerCase().contains("homescreen") && disposeTextures;
|
||||||
try {
|
try {
|
||||||
endKeyInput(); //end key input before switching screens
|
endKeyInput(); //end key input before switching screens
|
||||||
ForgeAnimation.endAll(); //end all active animations before switching screens
|
ForgeAnimation.endAll(); //end all active animations before switching screens
|
||||||
@@ -464,10 +466,11 @@ public class Forge implements ApplicationListener {
|
|||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
graphics.end();
|
graphics.end();
|
||||||
BugReporter.reportException(ex);
|
BugReporter.reportException(ex);
|
||||||
}
|
} finally {
|
||||||
if(dispose)
|
if(dispose)
|
||||||
ImageCache.disposeTexture();
|
ImageCache.disposeTexture();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render() {
|
public void render() {
|
||||||
|
|||||||
@@ -274,6 +274,16 @@ public class SettingsPage extends TabPage<SettingsScreen> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
3);
|
3);
|
||||||
|
lstSettings.addItem(new BooleanSetting(FPref.UI_ENABLE_DISPOSE_TEXTURES,
|
||||||
|
localizer.getMessage("lblDisposeTextures"),
|
||||||
|
localizer.getMessage("nlDisposeTextures")) {
|
||||||
|
@Override
|
||||||
|
public void select() {
|
||||||
|
super.select();
|
||||||
|
Forge.disposeTextures = FModel.getPreferences().getPrefBoolean(FPref.UI_ENABLE_DISPOSE_TEXTURES);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
3);
|
||||||
if (GuiBase.isAndroid()) { //this option does nothing except on Android
|
if (GuiBase.isAndroid()) { //this option does nothing except on Android
|
||||||
lstSettings.addItem(new BooleanSetting(FPref.UI_AUTO_CACHE_SIZE,
|
lstSettings.addItem(new BooleanSetting(FPref.UI_AUTO_CACHE_SIZE,
|
||||||
localizer.getMessage("lblAutoCacheSize"),
|
localizer.getMessage("lblAutoCacheSize"),
|
||||||
|
|||||||
@@ -1006,6 +1006,8 @@ lblEnableUnknownCards=Erlaube unbekannte Karten
|
|||||||
nlEnableUnknownCards=Erlaube unbekannte Karten von unbekannten Sets. (Erfordert Neustart)
|
nlEnableUnknownCards=Erlaube unbekannte Karten von unbekannten Sets. (Erfordert Neustart)
|
||||||
lblExperimentalNetworkCompatibility=Experimentelle Netzwerkkompatibilität
|
lblExperimentalNetworkCompatibility=Experimentelle Netzwerkkompatibilität
|
||||||
nlExperimentalNetworkCompatibility=Forge wechselt auf kompatiblen Netzwerk-Stream. (Im Zweifel bitte ausschalten)
|
nlExperimentalNetworkCompatibility=Forge wechselt auf kompatiblen Netzwerk-Stream. (Im Zweifel bitte ausschalten)
|
||||||
|
lblDisposeTextures=Dispose Textures
|
||||||
|
nlDisposeTextures=When enabled, disposes the card art caches. (If unsure, turn OFF this option)
|
||||||
lblAutoCacheSize=Aktiviere automatische Cache-Größe
|
lblAutoCacheSize=Aktiviere automatische Cache-Größe
|
||||||
nlAutoCacheSize=Wenn aktiviert, wird die Cache-Größe beim Start automatisch ermittelt und eingestellt. (Im Zweifel bitte ausschalten)
|
nlAutoCacheSize=Wenn aktiviert, wird die Cache-Größe beim Start automatisch ermittelt und eingestellt. (Im Zweifel bitte ausschalten)
|
||||||
#MatchScreen.java
|
#MatchScreen.java
|
||||||
|
|||||||
@@ -1006,6 +1006,8 @@ lblEnableUnknownCards=Enable Unknown Cards
|
|||||||
nlEnableUnknownCards=Enable Unknown Cards to be loaded to Unknown Set. (Requires restart)
|
nlEnableUnknownCards=Enable Unknown Cards to be loaded to Unknown Set. (Requires restart)
|
||||||
lblExperimentalNetworkCompatibility=Experimental Network Compatibility
|
lblExperimentalNetworkCompatibility=Experimental Network Compatibility
|
||||||
nlExperimentalNetworkCompatibility=Forge switches to compatible network stream. (If unsure, turn OFF this option)
|
nlExperimentalNetworkCompatibility=Forge switches to compatible network stream. (If unsure, turn OFF this option)
|
||||||
|
lblDisposeTextures=Dispose Textures
|
||||||
|
nlDisposeTextures=When enabled, disposes the card art caches. (If unsure, turn OFF this option)
|
||||||
lblAutoCacheSize=Enable Auto Cache Size
|
lblAutoCacheSize=Enable Auto Cache Size
|
||||||
nlAutoCacheSize=When enabled, Cache size are automatically determined on startup. (If unsure, turn OFF this option)
|
nlAutoCacheSize=When enabled, Cache size are automatically determined on startup. (If unsure, turn OFF this option)
|
||||||
#MatchScreen.java
|
#MatchScreen.java
|
||||||
|
|||||||
@@ -1006,6 +1006,8 @@ lblEnableUnknownCards=Habilitar cartas desconocidas
|
|||||||
nlEnableUnknownCards=Habilitar que las cartas desconocidas se carguen en el Unknown Set. (Requiere reinicio)
|
nlEnableUnknownCards=Habilitar que las cartas desconocidas se carguen en el Unknown Set. (Requiere reinicio)
|
||||||
lblExperimentalNetworkCompatibility=Compatibilidad de red experimental
|
lblExperimentalNetworkCompatibility=Compatibilidad de red experimental
|
||||||
nlExperimentalNetworkCompatibility=Forge cambia a un flujo de red compatible. (Si no estás seguro, deshabilita esta opción)
|
nlExperimentalNetworkCompatibility=Forge cambia a un flujo de red compatible. (Si no estás seguro, deshabilita esta opción)
|
||||||
|
lblDisposeTextures=Dispose Textures
|
||||||
|
nlDisposeTextures=When enabled, disposes the card art caches. (If unsure, turn OFF this option)
|
||||||
lblAutoCacheSize=Activar tamaño de caché automático
|
lblAutoCacheSize=Activar tamaño de caché automático
|
||||||
nlAutoCacheSize=Cuando se activa, el tamaño de la caché se determina automáticamente al inicio. (Si no estás seguro, desactiva esta opción)
|
nlAutoCacheSize=Cuando se activa, el tamaño de la caché se determina automáticamente al inicio. (Si no estás seguro, desactiva esta opción)
|
||||||
#MatchScreen.java
|
#MatchScreen.java
|
||||||
|
|||||||
@@ -1006,6 +1006,8 @@ lblEnableUnknownCards=Enable Unknown Cards
|
|||||||
nlEnableUnknownCards=Enable Unknown Cards to be loaded to Unknown Set. (Requires restart)
|
nlEnableUnknownCards=Enable Unknown Cards to be loaded to Unknown Set. (Requires restart)
|
||||||
lblExperimentalNetworkCompatibility=Experimental Network Compatibility
|
lblExperimentalNetworkCompatibility=Experimental Network Compatibility
|
||||||
nlExperimentalNetworkCompatibility=Forge switches to compatible network stream. (If unsure, turn OFF this option)
|
nlExperimentalNetworkCompatibility=Forge switches to compatible network stream. (If unsure, turn OFF this option)
|
||||||
|
lblDisposeTextures=Dispose Textures
|
||||||
|
nlDisposeTextures=When enabled, disposes the card art caches. (If unsure, turn OFF this option)
|
||||||
lblAutoCacheSize=Enable Auto Cache Size
|
lblAutoCacheSize=Enable Auto Cache Size
|
||||||
nlAutoCacheSize=When enabled, Cache size are automatically determined on startup. (If unsure, turn OFF this option)
|
nlAutoCacheSize=When enabled, Cache size are automatically determined on startup. (If unsure, turn OFF this option)
|
||||||
#MatchScreen.java
|
#MatchScreen.java
|
||||||
|
|||||||
@@ -1006,6 +1006,8 @@ lblEnableUnknownCards=未知のカードを有効にする
|
|||||||
nlEnableUnknownCards=未知のカードを未知のセットにまとめます。(再起動必須)
|
nlEnableUnknownCards=未知のカードを未知のセットにまとめます。(再起動必須)
|
||||||
lblExperimentalNetworkCompatibility=実験的なネットワークコンパチビリティ
|
lblExperimentalNetworkCompatibility=実験的なネットワークコンパチビリティ
|
||||||
nlExperimentalNetworkCompatibility=Forge がコンパチブルネットワークストリーミに切り替えます。 (分からない場合はオフにしてください)
|
nlExperimentalNetworkCompatibility=Forge がコンパチブルネットワークストリーミに切り替えます。 (分からない場合はオフにしてください)
|
||||||
|
lblDisposeTextures=Dispose Textures
|
||||||
|
nlDisposeTextures=When enabled, disposes the card art caches. (If unsure, turn OFF this option)
|
||||||
lblAutoCacheSize=キャッシュサイズ自動計算
|
lblAutoCacheSize=キャッシュサイズ自動計算
|
||||||
nlAutoCacheSize=有効にすると、キャッシュサイズは起動時に自動計算されます。 (分からない場合はオフにしてください)
|
nlAutoCacheSize=有効にすると、キャッシュサイズは起動時に自動計算されます。 (分からない場合はオフにしてください)
|
||||||
#MatchScreen.java
|
#MatchScreen.java
|
||||||
|
|||||||
@@ -1005,6 +1005,8 @@ lblEnableUnknownCards=启用未知卡牌
|
|||||||
nlEnableUnknownCards=将未知卡牌加载到未知系列中。(需要重启)
|
nlEnableUnknownCards=将未知卡牌加载到未知系列中。(需要重启)
|
||||||
lblExperimentalNetworkCompatibility=实验性网络兼容
|
lblExperimentalNetworkCompatibility=实验性网络兼容
|
||||||
nlExperimentalNetworkCompatibility=Forge将切换为兼容性的网络流。(如果不清楚此选项的作用,请关闭此选项)
|
nlExperimentalNetworkCompatibility=Forge将切换为兼容性的网络流。(如果不清楚此选项的作用,请关闭此选项)
|
||||||
|
lblDisposeTextures=Dispose Textures
|
||||||
|
nlDisposeTextures=When enabled, disposes the card art caches. (If unsure, turn OFF this option)
|
||||||
lblAutoCacheSize=启用自动缓存大小
|
lblAutoCacheSize=启用自动缓存大小
|
||||||
nlAutoCacheSize=启用后,Forge将于启动时自动确定缓存大小。(如果不清楚此选项的作用,请关闭此选项)
|
nlAutoCacheSize=启用后,Forge将于启动时自动确定缓存大小。(如果不清楚此选项的作用,请关闭此选项)
|
||||||
#MatchScreen.java
|
#MatchScreen.java
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
|
|||||||
UI_ENABLE_BORDER_MASKING("Crop"),
|
UI_ENABLE_BORDER_MASKING("Crop"),
|
||||||
UI_SHOW_FPS("false"),
|
UI_SHOW_FPS("false"),
|
||||||
UI_NETPLAY_COMPAT("false"),
|
UI_NETPLAY_COMPAT("false"),
|
||||||
|
UI_ENABLE_DISPOSE_TEXTURES("false"),
|
||||||
UI_LOAD_UNKNOWN_CARDS("true"),
|
UI_LOAD_UNKNOWN_CARDS("true"),
|
||||||
UI_AUTO_CACHE_SIZE("false"),
|
UI_AUTO_CACHE_SIZE("false"),
|
||||||
UI_ALLOW_ORDER_GRAVEYARD_WHEN_NEEDED ("Never"),
|
UI_ALLOW_ORDER_GRAVEYARD_WHEN_NEEDED ("Never"),
|
||||||
|
|||||||
Reference in New Issue
Block a user