death to unicode

This commit is contained in:
Willem Cazander 2022-10-16 15:55:25 +02:00
parent 023710722c
commit 555a59080b
4 changed files with 147 additions and 111 deletions

View file

@ -3,9 +3,7 @@ package love.distributedrebirth.gdxapp4d.app.glyphdemo.apps;
import java.util.ResourceBundle;
import imgui.ImGui;
import imgui.flag.ImGuiStyleVar;
import imgui.flag.ImGuiTableFlags;
import imgui.flag.ImGuiWindowFlags;
import imgui.type.ImBoolean;
import love.distributedrebirth.bassboonyd.info.BãßBȍőnAuthor注;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4Unicode4DService;
@ -13,7 +11,6 @@ import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.AbstractDeskApp;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppContourSection;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppRenderer;
import love.distributedrebirth.numberxd.unicode.UnicodePlane;
import love.distributedrebirth.unicode4d.draw.DrawCharacter;
import love.distributedrebirth.unicode4d.draw.ImCharacter;
@BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
@ -46,37 +43,26 @@ public class DemoUnicodePlaneDeskApp extends AbstractDeskApp implements DeskAppR
ImGui.tableSetupColumn(getTxt("colText"));
ImGui.tableHeadersRow();
for (UnicodePlane plane:UnicodePlane.values()) {
if (!plane.isPlaneValid()) {
continue;
}
StringBuilder buf = new StringBuilder();
int offset = 33;
for (int i=plane.getStart()+offset;i<plane.getStart()+33+offset;i++) {
buf.appendCodePoint(i);
if (plane.isPlane0() && render4DPlane0.get() == false) {
buf.append(" ");
}
}
ImGui.tableNextRow();
ImGui.tableNextColumn();
ImGui.text(plane.name());
ImGui.tableNextColumn();
if (plane.isPlane0() && render4DPlane0.get() == false) {
StringBuilder buf = new StringBuilder();
int offset = 33;
for (int i=plane.getStart()+offset;i<plane.getStart()+33+offset;i++) {
if (i < 65536) {
buf.append((char)i);
}
buf.append(" ");
}
ImGui.text(buf.toString());
} else {
ImGui.pushStyleVar(ImGuiStyleVar.ItemSpacing, 0f, 0f);
int offset = 33;
// workaround for error; Too many vertices in ImDrawList using 16-bit indices.
// hard coded height to fix line height and row0 height + no scoll to disable mouse scroll
ImGui.beginChild("row"+plane.name(), 0f, ImCharacter.HEIGHT, false, ImGuiWindowFlags.NoScrollWithMouse);
for (int i=plane.getStart()+offset;i<plane.getStart()+33+offset;i++) {
DrawCharacter drawChar = unicode4DService.getCharacterForUnicode(i);
if (drawChar != null) {
ImCharacter.render(drawChar);
} else {
ImGui.text("?");
}
ImGui.sameLine();
}
ImGui.endChild();
ImGui.popStyleVar();
ImCharacter.render("row"+plane.name(), buf.toString(), '?', v -> unicode4DService.getCharacterForUnicode(v));
}
}
ImGui.endTable();