From dff7e98cc0e11192232fa1accf8464226771d26a Mon Sep 17 00:00:00 2001 From: Willem Date: Sat, 5 Feb 2022 14:43:14 +0100 Subject: [PATCH] Moved broken number render code, todo fix --- .../distributedrebirth/gdxapp/Demo4DMain.java | 24 ++-- .../screen/SystemBaseGlyphRenderer.java | 110 ++++++++++++++++++ ...derer.java => SystemBasePartRenderer.java} | 34 +++--- .../base2t/glyph/BãßBȍőnGlyphSetʸᴰ.java | 96 +++++++++++++++ .../numberxd/base2t/part/BãßBȍőnPartʸᴰ.java | 106 ++--------------- 5 files changed, 249 insertions(+), 121 deletions(-) create mode 100644 demo4d-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/SystemBaseGlyphRenderer.java rename demo4d-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/{BasePartRenderer.java => SystemBasePartRenderer.java} (79%) diff --git a/demo4d-gdxapp/src/main/love/distributedrebirth/gdxapp/Demo4DMain.java b/demo4d-gdxapp/src/main/love/distributedrebirth/gdxapp/Demo4DMain.java index 5266e84c..02abb751 100644 --- a/demo4d-gdxapp/src/main/love/distributedrebirth/gdxapp/Demo4DMain.java +++ b/demo4d-gdxapp/src/main/love/distributedrebirth/gdxapp/Demo4DMain.java @@ -20,7 +20,7 @@ import love.distributedrebirth.gdxapp.matrix4d.ScreenMatrix4D; import love.distributedrebirth.gdxapp.music.MusicManager; import love.distributedrebirth.gdxapp.music.MusicPlayerRenderer; import love.distributedrebirth.gdxapp.music.MusicSongType; -import love.distributedrebirth.gdxapp.screen.BasePartRenderer; +import love.distributedrebirth.gdxapp.screen.SystemBasePartRenderer; import love.distributedrebirth.gdxapp.screen.BasicConsoleRenderer; import love.distributedrebirth.gdxapp.screen.HebrewWalletRenderer; import love.distributedrebirth.gdxapp.screen.ScreenCredits; @@ -30,6 +30,7 @@ import love.distributedrebirth.gdxapp.screen.ScreenIntro; import love.distributedrebirth.gdxapp.screen.ScreenIntroMission; import love.distributedrebirth.gdxapp.screen.ScreenLoading; import love.distributedrebirth.gdxapp.screen.ScreenUnicode4D; +import love.distributedrebirth.gdxapp.screen.SystemBaseGlyphRenderer; import love.distributedrebirth.numberxd.base2t.part.warp.TOSWarpCore; import net.spookygames.gdx.nativefilechooser.NativeFileChooser; @@ -53,7 +54,8 @@ public class Demo4DMain extends Game { private ImBoolean showImGuiDemo = new ImBoolean(false); private ImBoolean showMusicPlayer = new ImBoolean(false); private ImBoolean showHebrewWallet = new ImBoolean(false); - private ImBoolean showBasePart = new ImBoolean(false); + private ImBoolean showSystemBasePart = new ImBoolean(false); + private ImBoolean showSystemGlyphPart = new ImBoolean(false); private ImBoolean showBasicConsole = new ImBoolean(false); public Demo4DMain(List args, int viewWidth, int viewHeight, NativeFileChooser fileChooser) { @@ -106,7 +108,8 @@ public class Demo4DMain extends Game { putWidget(new MusicPlayerRenderer(this)); putWidget(new HebrewWalletRenderer(this)); - putWidget(new BasePartRenderer(this)); + putWidget(new SystemBasePartRenderer(this)); + putWidget(new SystemBaseGlyphRenderer(this)); putWidget(new BasicConsoleRenderer(this)); putScreen(new ScreenLoading(this)); @@ -170,8 +173,11 @@ public class Demo4DMain extends Game { if (showHebrewWallet.get()) { widgets.get(HebrewWalletRenderer.class).render(showHebrewWallet); } - if (showBasePart.get()) { - widgets.get(BasePartRenderer.class).render(showBasePart); + if (showSystemBasePart.get()) { + widgets.get(SystemBasePartRenderer.class).render(showSystemBasePart); + } + if (showSystemGlyphPart.get()) { + widgets.get(SystemBaseGlyphRenderer.class).render(showSystemGlyphPart); } if (showBasicConsole.get()) { widgets.get(BasicConsoleRenderer.class).render(showBasicConsole); @@ -220,13 +226,17 @@ public class Demo4DMain extends Game { if (ImGui.menuItem("Hebrew Wallet")) { showHebrewWallet.set(true); } + ImGui.separator(); if (ImGui.menuItem("Base Part")) { - showBasePart.set(true); + showSystemBasePart.set(true); } + if (ImGui.menuItem("Base Glyph")) { + showSystemGlyphPart.set(true); + } + ImGui.separator(); if (ImGui.menuItem("Basic Console")) { showBasicConsole.set(true); } - ImGui.separator(); if (ImGui.menuItem("Music Player")) { showMusicPlayer.set(true); } diff --git a/demo4d-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/SystemBaseGlyphRenderer.java b/demo4d-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/SystemBaseGlyphRenderer.java new file mode 100644 index 00000000..4288671a --- /dev/null +++ b/demo4d-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/SystemBaseGlyphRenderer.java @@ -0,0 +1,110 @@ +package love.distributedrebirth.gdxapp.screen; + +import java.util.ArrayList; +import java.util.List; + +import imgui.ImGui; +import imgui.flag.ImGuiCond; +import imgui.flag.ImGuiTableFlags; +import imgui.type.ImBoolean; +import imgui.type.ImInt; +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; +import love.distributedrebirth.gdxapp.Demo4DMain; +import love.distributedrebirth.gdxapp.ImGuiRendererMain; +import love.distributedrebirth.numberxd.base2t.glyph.BaseGlyphSet; +import love.distributedrebirth.numberxd.base2t.glyph.BaseGlyphSetNumber; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class SystemBaseGlyphRenderer extends ImGuiRendererMain { + + private ImInt selectedGlyphPart = new ImInt(); + + public SystemBaseGlyphRenderer(Demo4DMain main) { + super(main); + } + + @Override + public void render(ImBoolean widgetOpen) { + ImGui.setNextWindowPos(200, 200, ImGuiCond.FirstUseEver); + ImGui.setNextWindowSize(640, 480, ImGuiCond.FirstUseEver); + ImGui.begin("Base glyph", widgetOpen); + + List bases = new ArrayList<>(); + for (BaseGlyphSet glyphSet:BaseGlyphSet.values()) { + bases.add(glyphSet); + } + String[] items = new String[bases.size()]; + for (int i=0;i> default BaseGlyphSetNumber BȍőnGlyphSetNumber36() { return GET_BBC().GET_OBJ(BãßBȍőnGlyphSetKeyʸᴰ.GEMATRIA, BaseGlyphSetNumber.class); } + + default String BȍőnPrintGlyphSetNumber10(int number, int numberMax) { + StringBuilder buf = new StringBuilder(); + if (numberMax < 10) { + buf.append(BȍőnGlyphSetNumber10().BȍőnCharFor(number)); + } else if (numberMax < 100) { + int count = number; + int mod10 = count % 10; + int div10 = count / 10 % 10; + buf.append(BȍőnGlyphSetNumber10().BȍőnCharFor(div10)); + buf.append(BȍőnGlyphSetNumber10().BȍőnCharSeperator()); + buf.append(BȍőnGlyphSetNumber10().BȍőnCharFor(mod10)); + } else if (numberMax < 1000) { + int count = number; + int mod10 = count % 10; + int div10 = count / 10 % 10; + int div100 = count / 100 % 10; + buf.append(BȍőnGlyphSetNumber10().BȍőnCharFor(div10)); + buf.append(BȍőnGlyphSetNumber10().BȍőnCharSeperator()); + buf.append(BȍőnGlyphSetNumber10().BȍőnCharFor(div100)); + buf.append(BȍőnGlyphSetNumber10().BȍőnCharSeperator()); + buf.append(BȍőnGlyphSetNumber10().BȍőnCharFor(mod10)); + } else { + throw new IllegalStateException("Can't handle more than 1000 values."); + } + if (BaseGlyphSet.HEBREW.equals(this)) { + return buf.reverse().toString(); // TODO: ImGui workaround + } + return buf.toString(); + } + + default String BȍőnPrintGlyphSetNumber16(int number, int numberMax) { + //BãßBȍőnGlyphSetʸᴰ glyphSet = this; + StringBuilder buf = new StringBuilder(); + if (numberMax < 16) { + buf.append(BȍőnGlyphSetNumber16().BȍőnCharFor(number)); + } else if (numberMax < 256) { + buf.append(BȍőnGlyphSetNumber16().BȍőnCharFor(number >> 4)); + buf.append(BȍőnGlyphSetNumber16().BȍőnCharSeperator()); + BaseGlyphSet secondGlyphSet = BȍőnGlyphSetNumber16().BȍőnAltGlyphSet(); + if (secondGlyphSet != null) { + buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor(number & 0x0F)); + } else { + buf.append(BȍőnGlyphSetNumber16().BȍőnCharFor(number & 0x0F)); + } + } else if (numberMax < 0xFFF+1) { + buf.append(BȍőnGlyphSetNumber16().BȍőnCharFor((number >> 8) & 0x0F)); + buf.append(BȍőnGlyphSetNumber16().BȍőnCharSeperator()); + BaseGlyphSet secondGlyphSet = BȍőnGlyphSetNumber16().BȍőnAltGlyphSet(); + if (secondGlyphSet != null) { + buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor((number >> 4) & 0x0F)); + buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharSeperator()); + buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor(number & 0x0F)); + } else { + buf.append(BȍőnGlyphSetNumber16().BȍőnCharFor((number >> 4) & 0x0F)); + buf.append(BȍőnGlyphSetNumber16().BȍőnCharSeperator()); + buf.append(BȍőnGlyphSetNumber16().BȍőnCharFor(number & 0x0F)); + } + } else { + throw new IllegalStateException("Can't handle more than 0xFFF values."); + } + if (BaseGlyphSet.HEBREW.equals(this)) { + return buf.reverse().toString(); // TODO: ImGui workaround + } + return buf.toString(); + } + + default String BȍőnPrintGlyphSetNumber36(int number, int numberMax) { + StringBuilder buf = new StringBuilder(); + if (numberMax < 9) { + buf.append(BȍőnGlyphSetNumber36().BȍőnCharFor36(number + 1)); + } else if (numberMax < 99) { + int count = number + 1; + int mod10 = (count % 9) + 1; + int div10 = ((count / 9) % 9) + 1; + buf.append(BȍőnGlyphSetNumber36().BȍőnCharFor36(div10)); + buf.append(BȍőnGlyphSetNumber36().BȍőnCharSeperator()); + buf.append(BȍőnGlyphSetNumber36().BȍőnCharFor36(mod10)); + } else if (numberMax < 999) { + int count = number; + int mod10 = (count % 9) + 1; + int div10 = ((count / 90) & 9) + 1; + int div100 = ((count / 900) & 9) + 1; + buf.append(BȍőnGlyphSetNumber36().BȍőnCharFor36(div10)); + buf.append(BȍőnGlyphSetNumber36().BȍőnCharSeperator()); + buf.append(BȍőnGlyphSetNumber36().BȍőnCharFor36(div100)); + buf.append(BȍőnGlyphSetNumber36().BȍőnCharSeperator()); + buf.append(BȍőnGlyphSetNumber36().BȍőnCharFor36(mod10)); + } else { + throw new IllegalStateException("Can't handle more than 1000 values."); + } + if (BaseGlyphSet.HEBREW.equals(this)) { + return buf.reverse().toString(); // TODO: ImGui workaround + } + return buf.toString(); + } } diff --git a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/BãßBȍőnPartʸᴰ.java b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/BãßBȍőnPartʸᴰ.java index dce90ea4..c55896fc 100644 --- a/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/BãßBȍőnPartʸᴰ.java +++ b/demo4d-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/BãßBȍőnPartʸᴰ.java @@ -35,100 +35,6 @@ public interface BãßBȍőnPartʸᴰ> extends return GET_BBC().GET_STR(BãßBȍőnPartKeyʸᴰ.CHINA_VALUE); } - default String BȍőnGlyphSetNumber10(BaseGlyphSet glyphSet) { - StringBuilder buf = new StringBuilder(); - T[] values = BãßInstances(); - if (values.length <= 10) { - buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharFor(BȍőnRangTelNul())); - } else if (values.length <= 100) { - int count = BȍőnRangTelNul(); - int mod10 = count % 10; - int div10 = count / 10; - buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharFor(div10)); - buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharSeperator()); - buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharFor(mod10)); - } else if (values.length <= 1000) { - int count = BȍőnRangTelNul(); - int mod10 = count % 10; - int div10 = count / 10; - int div100 = count / 100; - buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharFor(div10)); - buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharSeperator()); - buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharFor(div100)); - buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharSeperator()); - buf.append(glyphSet.BȍőnGlyphSetNumber10().BȍőnCharFor(mod10)); - } else { - throw new IllegalStateException("Can't handle more than 1000 values."); - } - if (BaseGlyphSet.HEBREW.equals(glyphSet)) { - return buf.reverse().toString(); // TODO: ImGui workaround - } - return buf.toString(); - } - - default String BȍőnGlyphSetNumber16(BaseGlyphSet glyphSet) { - StringBuilder buf = new StringBuilder(); - T[] values = BãßInstances(); - if (values.length <= 16) { - buf.append(glyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor(BȍőnRangTelNul())); - } else if (values.length <= 256) { - buf.append(glyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor(BȍőnRangTelNul() >> 4)); - buf.append(glyphSet.BȍőnGlyphSetNumber16().BȍőnCharSeperator()); - BaseGlyphSet secondGlyphSet = glyphSet.BȍőnGlyphSetNumber16().BȍőnAltGlyphSet(); - if (secondGlyphSet == null) { - secondGlyphSet = glyphSet; - } - buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor(BȍőnRangTelNul() & 0x0F)); - } else if (values.length <= 0xFFF+1) { - buf.append(glyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor((BȍőnRangTelNul() >> 8) & 0x0F)); - buf.append(glyphSet.BȍőnGlyphSetNumber16().BȍőnCharSeperator()); - BaseGlyphSet secondGlyphSet = glyphSet.BȍőnGlyphSetNumber16().BȍőnAltGlyphSet(); - if (secondGlyphSet == null) { - secondGlyphSet = glyphSet; - } - buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor((BȍőnRangTelNul() >> 4) & 0x0F)); - buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharSeperator()); - buf.append(secondGlyphSet.BȍőnGlyphSetNumber16().BȍőnCharFor(BȍőnRangTelNul() & 0x0F)); - } else { - throw new IllegalStateException("Can't handle more than 0xFFF values."); - } - if (BaseGlyphSet.HEBREW.equals(glyphSet)) { - return buf.reverse().toString(); // TODO: ImGui workaround - } - return buf.toString(); - } - - default String BȍőnGlyphSetNumber36(BaseGlyphSet glyphSet) { - StringBuilder buf = new StringBuilder(); - T[] values = BãßInstances(); - if (values.length <= 9) { - buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharFor36(BȍőnRangTelEen())); - } else if (values.length <= 99) { - int count = BȍőnRangTelNul(); - int mod10 = count % 9 + 1; - int div10 = count / 9 + 1; - buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharFor36(div10)); - buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharSeperator()); - buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharFor36(mod10)); - } else if (values.length <= 999) { - int count = BȍőnRangTelNul(); - int mod10 = count % 9 + 1; - int div10 = count / 90 + 1; - int div100 = count / 900 + 1; - buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharFor36(div10)); - buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharSeperator()); - buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharFor36(div100)); - buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharSeperator()); - buf.append(glyphSet.BȍőnGlyphSetNumber36().BȍőnCharFor36(mod10)); - } else { - throw new IllegalStateException("Can't handle more than 1000 values."); - } - if (BaseGlyphSet.HEBREW.equals(glyphSet)) { - return buf.reverse().toString(); // TODO: ImGui workaround - } - return buf.toString(); - } - @SuppressWarnings("unchecked") default T BãßValueOfTone(String identifierTone) { Map mapTone = GET_BBC().GET_MAP_OBJ(BãßBȍőnPartKeyʸᴰ.MAP_TONE); @@ -146,4 +52,16 @@ public interface BãßBȍőnPartʸᴰ> extends } return (T) mapChina.get(chinaKey); } + + default String BȍőnPrintGlyphSetNumber10(BaseGlyphSet glyphSet) { + return glyphSet.BȍőnPrintGlyphSetNumber10(BȍőnRangTelNul(), BãßInstances().length); + } + + default String BȍőnPrintGlyphSetNumber16(BaseGlyphSet glyphSet) { + return glyphSet.BȍőnPrintGlyphSetNumber16(BȍőnRangTelNul(), BãßInstances().length); + } + + default String BȍőnPrintGlyphSetNumber36(BaseGlyphSet glyphSet) { + return glyphSet.BȍőnPrintGlyphSetNumber36(BȍőnRangTelNul(), BãßInstances().length); + } }