Added glocal china unit test and added T07PartPlanIt

This commit is contained in:
Willem Cazander 2022-01-31 17:21:32 +01:00
parent daad0690fc
commit 9793e70937
6 changed files with 297 additions and 21 deletions

View file

@ -8,7 +8,9 @@ import imgui.ImGui;
import imgui.ImGuiIO;
import imgui.gl3.ImGuiImplGl3;
import imgui.glfw.ImGuiImplGlfw;
import love.distributedrebirth.numberxd.base2t.T60Sexagesimal;
import love.distributedrebirth.numberxd.base2t.BasePartFactory;
import love.distributedrebirth.numberxd.base2t.facet.BasePart;
import love.distributedrebirth.numberxd.base2t.facet.BasePartAlt1;
/**
* Create and shutdown of ImGui and font activations.
@ -22,7 +24,6 @@ public class ImGuiSetup {
private static final short[] glyphRangesArabic = new short[]{0x0600, 0x06FF};
private static final short[] glyphRangesSubSuper0 = new short[]{0x00B2, 0x00B9};
private static final short[] glyphRangesSubSuper1 = new short[]{0x2070, 0x209F};
private static final short[] glyphRangesToneLetters0 = new short[]{0x02E5, 0x02E9};
public static void init() {
long windowHandle = -1;
@ -53,13 +54,18 @@ public class ImGuiSetup {
rangesBuilder.addRanges(glyphRangesArabic);
rangesBuilder.addRanges(glyphRangesSubSuper0);
rangesBuilder.addRanges(glyphRangesSubSuper1);
rangesBuilder.addRanges(glyphRangesToneLetters0);
rangesBuilder.addText("\u4ed9⁴ ˧꜏⋇꜊꜔ ⁴ﷲΩ@");
rangesBuilder.addText("©Δ∞ \u4ed9\u4e0a\u4e3b\u5929");
for (T60Sexagesimal value:T60Sexagesimal.values()) {
rangesBuilder.addText(value.getIdentifierLetter());
rangesBuilder.addText(value.getChinaKey());
for (int base:BasePartFactory.getSupportedBases()) {
for (BasePart part:BasePartFactory.buildBasePartsByBase(base)) {
rangesBuilder.addText(part.getIdentifierTone());
rangesBuilder.addText(part.getIdentifierLetter());
rangesBuilder.addText(part.getChinaKey());
if (part instanceof BasePartAlt1) {
rangesBuilder.addText(BasePartAlt1.class.cast(part).getAlt1Value());
}
}
}
final ImFontConfig fontConfig = new ImFontConfig();

View file

@ -1,16 +1,21 @@
package love.distributedrebirth.demo4d.screen;
import java.util.Arrays;
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.demo4d.Demo4DMain;
import love.distributedrebirth.demo4d.ImGuiRendererMain;
import love.distributedrebirth.numberxd.base2t.T60Sexagesimal;
import love.distributedrebirth.numberxd.base2t.BasePartFactory;
import love.distributedrebirth.numberxd.base2t.facet.BasePart;
import love.distributedrebirth.numberxd.base2t.facet.BasePartAlt1;
import love.distributedrebirth.numberxd.base2t.facet.BasePartAlt2;
import love.distributedrebirth.numberxd.base2t.facet.BasePartAlt3;
import love.distributedrebirth.numberxd.base2t.facet.BasePartAlt4;
/**
*
@ -19,6 +24,8 @@ import love.distributedrebirth.numberxd.base2t.facet.BasePart;
*/
public class BasePartRenderer extends ImGuiRendererMain {
private ImInt selectedBasePart = new ImInt();
public BasePartRenderer(Demo4DMain main) {
super(main);
}
@ -29,21 +36,34 @@ public class BasePartRenderer extends ImGuiRendererMain {
ImGui.setNextWindowSize(640, 480, ImGuiCond.FirstUseEver);
ImGui.begin("Base part", widgetOpen);
ImGui.text("Current part type:");
ImGui.text("Current Part");
ImGui.sameLine();
ImGui.text("T60Sexagesimal");
int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV;
ImGui.beginTable("base-part", 5, flags);
ImGui.tableSetupColumn("ordinal");
ImGui.tableSetupColumn("idTone");
ImGui.tableSetupColumn("idLetter");
ImGui.tableSetupColumn("ChinaKey");
ImGui.tableSetupColumn("ChinaValue");
ImGui.tableHeadersRow();
List<BasePart> parts = Arrays.asList(T60Sexagesimal.values());
for (BasePart part:parts) {
List<String> bases = new ArrayList<>();
for (int base:BasePartFactory.getSupportedBases()) {
bases.add(Integer.toString(base));
}
String[] items = new String[bases.size()];
ImGui.combo("Type", selectedBasePart, bases.toArray(items));
String selectedItem = items[selectedBasePart.get()];
Integer baseNumber = Integer.valueOf(selectedItem);
BasePart[] baseParts = BasePartFactory.buildBasePartsByBase(baseNumber);
int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV;
ImGui.beginTable("base-part", 9, flags);
ImGui.tableSetupColumn("Ordinal");
ImGui.tableSetupColumn("Tone");
ImGui.tableSetupColumn("Letter");
ImGui.tableSetupColumn("ChinaK");
ImGui.tableSetupColumn("ChinaV");
ImGui.tableSetupColumn("Alt1");
ImGui.tableSetupColumn("Alt2");
ImGui.tableSetupColumn("Alt3");
ImGui.tableSetupColumn("Alt4");
ImGui.tableHeadersRow();
for (BasePart part:baseParts) {
ImGui.tableNextRow();
ImGui.tableNextColumn();
ImGui.text(Integer.toString(part.ordinal()));
@ -55,7 +75,33 @@ public class BasePartRenderer extends ImGuiRendererMain {
ImGui.text(part.getChinaKey());
ImGui.tableNextColumn();
ImGui.text(part.getChinaValue());
ImGui.tableNextColumn();
if (part instanceof BasePartAlt1) {
ImGui.text(BasePartAlt1.class.cast(part).getAlt1Value());
} else {
ImGui.text("");
}
ImGui.tableNextColumn();
if (part instanceof BasePartAlt2) {
ImGui.text(BasePartAlt2.class.cast(part).getAlt1Value());
} else {
ImGui.text("");
}
ImGui.tableNextColumn();
if (part instanceof BasePartAlt3) {
ImGui.text(BasePartAlt3.class.cast(part).getAlt1Value());
} else {
ImGui.text("");
}
ImGui.tableNextColumn();
if (part instanceof BasePartAlt4) {
ImGui.text(BasePartAlt4.class.cast(part).getAlt1Value());
} else {
ImGui.text("");
}
}
ImGui.endTable();
ImGui.end();