diff --git a/RemixedDungeonDesktop/build.gradle b/RemixedDungeonDesktop/build.gradle index 7ad2db0dd6..c18448ee8c 100644 --- a/RemixedDungeonDesktop/build.gradle +++ b/RemixedDungeonDesktop/build.gradle @@ -162,6 +162,10 @@ construo.targets.each { target -> into("RemixedDungeon-${project.ext.version}-${tag}/mods/Remixed") } + zipTask.from(file("src/desktop/d_assets")) { + into("RemixedDungeon-${project.ext.version}-${tag}/mods/Remixed") + } + zipTask.from(file("src/desktop/l10ns")) { into("RemixedDungeon-${project.ext.version}-${tag}/mods/Remixed") } diff --git a/RemixedDungeonDesktop/src/desktop/d_assets/fonts/LXGWWenKaiScreen.ttf b/RemixedDungeonDesktop/src/desktop/d_assets/fonts/LXGWWenKaiScreen.ttf new file mode 100644 index 0000000000..8769c5261e Binary files /dev/null and b/RemixedDungeonDesktop/src/desktop/d_assets/fonts/LXGWWenKaiScreen.ttf differ diff --git a/RemixedDungeonDesktop/src/libgdx/java/com/nyrds/platform/gfx/SystemText.java b/RemixedDungeonDesktop/src/libgdx/java/com/nyrds/platform/gfx/SystemText.java index 8f6e43b8c6..2469ab28a9 100644 --- a/RemixedDungeonDesktop/src/libgdx/java/com/nyrds/platform/gfx/SystemText.java +++ b/RemixedDungeonDesktop/src/libgdx/java/com/nyrds/platform/gfx/SystemText.java @@ -11,6 +11,7 @@ import com.nyrds.platform.util.StringsManager; import com.watabou.glwrap.Matrix; import com.watabou.noosa.Text; + import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -34,8 +35,9 @@ public class SystemText extends Text { private static final SystemTextPseudoBatch batch = new SystemTextPseudoBatch(); private static final float oversample = 4; private ArrayList wordMask = null; + static { - generator = new FreeTypeFontGenerator(FileSystem.getInternalStorageFileHandle("fonts/pixel_font.ttf")); + invalidate(); } public SystemText(float baseLine) { @@ -98,6 +100,7 @@ private FreeTypeFontParameter getFontParameters(float baseLine) { final FreeTypeFontParameter fontParameters; fontParameters = new FreeTypeFontParameter(); fontParameters.characters = FreeTypeFontGenerator.DEFAULT_CHARS + StringsManager.getAllCharsAsString(); + //PUtil.slog("font", "characters " + fontParameters.characters); fontParameters.size = (int) (baseLine * oversample * fontScale); fontParameters.borderColor = Color.BLACK; fontParameters.borderWidth = oversample * fontScale; @@ -105,7 +108,7 @@ private FreeTypeFontParameter getFontParameters(float baseLine) { fontParameters.genMipMaps = true; fontParameters.magFilter = Texture.TextureFilter.Linear; fontParameters.minFilter = Texture.TextureFilter.MipMapLinearLinear; - fontParameters.spaceX = 0; + fontParameters.spaceX = -2; fontParameters.spaceY = 0; return fontParameters; } @@ -120,7 +123,7 @@ private void wrapText() { } lines.clear(); - if(mask != null) { + if (mask != null) { wordMask = new ArrayList<>(); } @@ -137,10 +140,10 @@ private void wrapText() { float line_width = 0; for (String word : words) { glyphLayout.setText(font, word); - if(mask != null) { + if (mask != null) { wordMask.add(mask[index]); } - if ((line_width + glyphLayout.width + spaceLayout.width)/oversample <= maxWidth) { + if ((line_width + glyphLayout.width + spaceLayout.width) / oversample <= maxWidth) { currentLine.add(word); line_width += glyphLayout.width + spaceLayout.width; } else { @@ -149,7 +152,7 @@ private void wrapText() { currentLine.add(word); line_width = glyphLayout.width + spaceLayout.width; } - index+=word.length(); + index += word.length(); } if (!currentLine.isEmpty()) { lines.add(currentLine); @@ -183,7 +186,7 @@ protected void updateMatrix() { @Override public void draw() { - if(dirty) { + if (dirty) { lines.clear(); measure(); } @@ -196,7 +199,7 @@ public void draw() { float x = 0; for (String word : line) { glyphLayout.setText(font, word); - if(wordMask == null || wordMask.get(wi)) { + if (wordMask == null || wordMask.get(wi)) { font.draw(batch, glyphLayout, x, y); } x += glyphLayout.width + spaceLayout.width; // Use spaceLayout.width @@ -256,8 +259,14 @@ public int lines() { public static void invalidate() { if (generator != null) { generator.dispose(); + } + + if (GamePreferences.classicFont()) { generator = new FreeTypeFontGenerator(FileSystem.getInternalStorageFileHandle("fonts/pixel_font.ttf")); + } else { + generator = new FreeTypeFontGenerator(FileSystem.getInternalStorageFileHandle("fonts/LXGWWenKaiScreen.ttf")); } + synchronized (fontCache) { for (BitmapFont font : fontCache.values()) { font.dispose(); diff --git a/RemixedDungeonDesktop/src/libgdx/java/com/nyrds/platform/storage/FileSystem.java b/RemixedDungeonDesktop/src/libgdx/java/com/nyrds/platform/storage/FileSystem.java index 6b7fb9232b..f1c88f5aa6 100644 --- a/RemixedDungeonDesktop/src/libgdx/java/com/nyrds/platform/storage/FileSystem.java +++ b/RemixedDungeonDesktop/src/libgdx/java/com/nyrds/platform/storage/FileSystem.java @@ -31,6 +31,7 @@ public class FileSystem { "mods/"+ModdingMode.activeMod()+"/", "mods/Remixed/", "../assets/", + "../d_assets/", "../l10ns/", "./", }) { @@ -48,6 +49,7 @@ public class FileSystem { for(String path : new String[] { "mods/Remixed/", "../assets/", + "../d_assets/", "./", }) { fileHandle = Gdx.files.internal(path+fileName); diff --git a/RemixedDungeonDesktop/src/libgdx/java/com/nyrds/platform/util/StringsManager.java b/RemixedDungeonDesktop/src/libgdx/java/com/nyrds/platform/util/StringsManager.java index 3785b8feb3..10a8b17a36 100644 --- a/RemixedDungeonDesktop/src/libgdx/java/com/nyrds/platform/util/StringsManager.java +++ b/RemixedDungeonDesktop/src/libgdx/java/com/nyrds/platform/util/StringsManager.java @@ -89,6 +89,7 @@ private static void parseStrings(String resource) { String line = Utils.EMPTY_STRING; while ((line = br.readLine()) != null) { + //PUtil.slog("strings",line); JSONArray entry = new JSONArray(line); String keyString = entry.getString(0);