Draw unicode4d glyphs working

This commit is contained in:
Willem Cazander 2022-03-18 02:10:02 +01:00
parent df5efd4dab
commit 5dfd954db1
9 changed files with 223 additions and 90 deletions

View file

@ -38,7 +38,7 @@ public class GlyphDemoComponent {
private final DeskAppLauncher basePartLauncher;
public GlyphDemoComponent() {
unicodeLauncher = new DeskAppLauncher(DeskAppMenuSection.PROGRAMMING, "Demo Unicode Plane", () -> new DemoUnicodePlaneDeskApp(createBundle()));
unicodeLauncher = new DeskAppLauncher(DeskAppMenuSection.PROGRAMMING, "Demo Unicode Plane", () -> new DemoUnicodePlaneDeskApp(createBundle(), unicode4DService));
baseGlyphLauncher = new DeskAppLauncher(DeskAppMenuSection.PROGRAMMING, "Demo Glyph Set", () -> new DemoGlyphSetDeskApp(createBundle()));
basePartLauncher = new DeskAppLauncher(DeskAppMenuSection.PROGRAMMING, "Demo Number Parts", () -> new DemoNumberPartDeskApp(createBundle()));
}

View file

@ -5,17 +5,22 @@ import java.util.ResourceBundle;
import imgui.ImGui;
import imgui.flag.ImGuiTableFlags;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4Unicode4DService;
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.unicode4d.UnicodePlaneᶻᴰ;
import love.distributedrebirth.unicode4d.draw.DrawCharacter;
import love.distributedrebirth.unicode4d.draw.ImCharacter;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class DemoUnicodePlaneDeskApp extends AbstractDeskApp implements DeskAppRenderer {
private final VrGem4Unicode4DService unicode4DService;
private final ResourceBundle bundle;
public DemoUnicodePlaneDeskApp(ResourceBundle bundle) {
public DemoUnicodePlaneDeskApp(ResourceBundle bundle, VrGem4Unicode4DService unicode4DService) {
this.unicode4DService = unicode4DService;
this.bundle = bundle;
}
@ -40,16 +45,31 @@ public class DemoUnicodePlaneDeskApp extends AbstractDeskApp implements DeskAppR
ImGui.tableNextColumn();
ImGui.text(plane.name());
ImGui.tableNextColumn();
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);
if (plane.isPlane0()) {
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 {
// LIMITED;
// Dear ImGui Assertion Failed: draw_list->_VtxCurrentIdx < (1 << 16) && "Too many vertices in ImDrawList using 16-bit indices. Read comment above"
// Assertion Located At: /tmp/imgui/jni/imgui.cpp:4526
int offset = 33;
for (int i=plane.getStart()+offset;i<plane.getStart()+7+offset;i++) {
DrawCharacter drawChar = unicode4DService.getCharacterForUnicode(i);
if (drawChar != null) {
new ImCharacter(drawChar).render();
} else {
ImGui.text("?");
}
ImGui.sameLine();
}
buf.append(" ");
}
ImGui.text(buf.toString());
}
ImGui.endTable();
}