diff options
| author | ilotterytea <iltsu@alright.party> | 2024-10-26 00:52:53 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-10-26 00:52:53 +0500 |
| commit | 4c205aaaf26b65ed6f5ada09b894345f131d5be7 (patch) | |
| tree | 0feeb0aa6cd7057f1ce4ec344a9d86c9bf67cee0 /core/src/kz/ilotterytea/maxon/utils | |
| parent | d1ee70ccb99cc23cbd3d20bb5daf70cd9aa54205 (diff) | |
upd: code cleanup
Diffstat (limited to 'core/src/kz/ilotterytea/maxon/utils')
4 files changed, 6 insertions, 66 deletions
diff --git a/core/src/kz/ilotterytea/maxon/utils/GameUpdater.java b/core/src/kz/ilotterytea/maxon/utils/GameUpdater.java index 1c4ef94..6b7c407 100644 --- a/core/src/kz/ilotterytea/maxon/utils/GameUpdater.java +++ b/core/src/kz/ilotterytea/maxon/utils/GameUpdater.java @@ -68,8 +68,5 @@ public class GameUpdater implements Net.HttpResponseListener { return version; } - public void setVersion(String version) { - this.version = version; - } } } diff --git a/core/src/kz/ilotterytea/maxon/utils/OsUtils.java b/core/src/kz/ilotterytea/maxon/utils/OsUtils.java index 7d45c5d..bbefc41 100644 --- a/core/src/kz/ilotterytea/maxon/utils/OsUtils.java +++ b/core/src/kz/ilotterytea/maxon/utils/OsUtils.java @@ -1,7 +1,7 @@ package kz.ilotterytea.maxon.utils; public class OsUtils { - private static String OS = System.getProperty("os.name").toLowerCase(); + private static final String OS = System.getProperty("os.name").toLowerCase(); static public boolean isAndroid = System.getProperty("java.runtime.name").contains("Android"); static public boolean isMac = !isAndroid && OS.contains("mac"); @@ -9,19 +9,13 @@ public class OsUtils { static public boolean isLinux = !isAndroid && OS.contains("linux"); static public boolean isIos = !isAndroid && (!(isWindows || isLinux || isMac)) || OS.startsWith("ios"); - static public boolean isARM = System.getProperty("os.arch").startsWith("arm") || System.getProperty("os.arch").startsWith("aarch64"); - static public boolean is64Bit = System.getProperty("os.arch").contains("64") || System.getProperty("os.arch").startsWith("armv8"); - - public static boolean isGwt = false; - public static boolean isMobile = isIos || isAndroid; - public static boolean isPC = isWindows || isMac || isIos; + public static final boolean isPC = isWindows || isMac || isIos; static { try { Class.forName("com.google.gwt.core.client.GWT"); - isGwt = true; } catch(Exception ignored) { /* IGNORED */ } @@ -32,56 +26,13 @@ public class OsUtils { isWindows = false; isLinux = false; isMac = false; - is64Bit = false; isMobile = true; } } - public static String getUserConfigDirectory() - { - return getUserConfigDirectory(null); - } - - public static String getUserConfigDirectory(String applicationName) - { - String CONFIG_HOME = null; - - if((CONFIG_HOME = System.getenv("XDG_CONFIG_HOME"))==null) - { - if(isLinux || isAndroid) - { - CONFIG_HOME = System.getProperty("user.home")+"/.config"; - } - else if(isMac) - { - CONFIG_HOME = System.getProperty("user.home")+"/Library/Preferences"; - } - else if(isIos) - { - CONFIG_HOME = System.getProperty("user.home")+"/Documents"; - } - else if(isWindows) - { - if((CONFIG_HOME = System.getenv("APPDATA"))==null) - { - CONFIG_HOME = System.getProperty("user.home")+"/Documents/My Games"; - } - } - } - - if(applicationName==null || CONFIG_HOME==null) return CONFIG_HOME; - - return CONFIG_HOME+"/"+applicationName; - } - - public static String getUserDataDirectory() - { - return getUserDataDirectory(null); - } - public static String getUserDataDirectory(String applicationName) { - String DATA_HOME = null; + String DATA_HOME; if((DATA_HOME = System.getenv("XDG_DATA_HOME"))==null) { diff --git a/core/src/kz/ilotterytea/maxon/utils/ScreenshotFactory.java b/core/src/kz/ilotterytea/maxon/utils/ScreenshotFactory.java index 76cd92b..d955935 100644 --- a/core/src/kz/ilotterytea/maxon/utils/ScreenshotFactory.java +++ b/core/src/kz/ilotterytea/maxon/utils/ScreenshotFactory.java @@ -18,17 +18,10 @@ public class ScreenshotFactory { * Default without any compression. Y is flipped. */ public static void takeScreenshot(){ - _takeScreenshot(Deflater.NO_COMPRESSION, true); + _takeScreenshot(); } - /** - * Take a screenshot. It will be saved in the user data directory, it is different for each platform (Windows: %appdata%/.maxoning/screenshots/, Linux: ~/.local/share/maxoning/screenshots). - */ - public static void takeScreenshot(int compression, boolean flipY){ - _takeScreenshot(compression, flipY); - } - - private static void _takeScreenshot(int compression, boolean flipY) { + private static void _takeScreenshot() { File file = new File(MaxonConstants.GAME_SCREENSHOT_FOLDER); if (!file.exists()) { @@ -45,7 +38,7 @@ public class ScreenshotFactory { pixels.put(i, (byte) 255); } - PixmapIO.writePNG(new FileHandle(file.getPath() + String.format("/screenshot-%s.png", dtf.format(now))), pixmap, compression, flipY); + PixmapIO.writePNG(new FileHandle(file.getPath() + String.format("/screenshot-%s.png", dtf.format(now))), pixmap, Deflater.NO_COMPRESSION, true); pixmap.dispose(); } }
\ No newline at end of file diff --git a/core/src/kz/ilotterytea/maxon/utils/formatters/NumberFormatter.java b/core/src/kz/ilotterytea/maxon/utils/formatters/NumberFormatter.java index f6c0fa4..7ed4583 100644 --- a/core/src/kz/ilotterytea/maxon/utils/formatters/NumberFormatter.java +++ b/core/src/kz/ilotterytea/maxon/utils/formatters/NumberFormatter.java @@ -41,7 +41,6 @@ public class NumberFormatter { String suffix = e.getValue(); double truncated = value / (divideBy / 10.0); //the number part of the output times 10 - boolean hasDecimal = truncated < 100 && (truncated / 10d) != (truncated / 10); return formatWithSuffix(truncated / 10d, suffix); } |
