From c60f7cca65b4b442d801d6194c3050a502bb1db9 Mon Sep 17 00:00:00 2001 From: Willem Date: Sat, 12 Mar 2022 20:59:21 +0100 Subject: [PATCH] wip bug hunt --- .../app/notepad/NotepadComponent.java | 4 + .../gdxapp4d/app/notepad/NotepadDeskApp.java | 49 +++++++++++ .../numberxd/base2t/part/T08PartOctal.java | 2 +- .../unicode4d/CodePointᶻᴰ.java | 16 ++-- .../unicode4d/atlas/FontAtlas.java | 3 +- .../unicode4d/atlas/FontAtlasStoreGlyph.java | 42 ++++++++++ .../unicode4d/TestConvFont.java | 12 ++- .../gdxapp4d/tos4/GDXAppTos4Activator.java | 13 +++ .../gdxapp4d/tos4/GDXAppTos4BootFactory.java | 20 +++++ .../gdxapp4d/tos4/GDXAppTos4Startup.java | 1 + .../tos4/service/SystemGdxBootArgs.java | 2 + .../service/SystemGdxBootReadyListener.java | 9 ++ gdxapp4d-vrgem4/pom.xml | 20 +++++ .../vrgem4/GDXAppVrGem4Activator.java | 25 ++++-- .../vrgem4/VrGem4Unicode4DServiceImpl.java | 82 +++++++++++++++++++ .../service/VrGem4Unicode4DService.java | 11 +++ .../vrgem4/view/DeskTopScreenMenu.java | 3 - .../vrgem4/view/apps/Unicode4DApp.java | 73 ----------------- 18 files changed, 290 insertions(+), 97 deletions(-) create mode 100644 gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemGdxBootReadyListener.java create mode 100644 gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/VrGem4Unicode4DServiceImpl.java create mode 100644 gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/VrGem4Unicode4DService.java delete mode 100644 gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/apps/Unicode4DApp.java diff --git a/gdxapp4d-app-notepad/src/main/java/love/distributedrebirth/gdxapp4d/app/notepad/NotepadComponent.java b/gdxapp4d-app-notepad/src/main/java/love/distributedrebirth/gdxapp4d/app/notepad/NotepadComponent.java index a098113c..a46f1e73 100644 --- a/gdxapp4d-app-notepad/src/main/java/love/distributedrebirth/gdxapp4d/app/notepad/NotepadComponent.java +++ b/gdxapp4d-app-notepad/src/main/java/love/distributedrebirth/gdxapp4d/app/notepad/NotepadComponent.java @@ -7,6 +7,7 @@ import org.osgi.service.component.annotations.Reference; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog; import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService; +import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4Unicode4DService; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection; @@ -19,6 +20,9 @@ public class NotepadComponent { @Reference private VrGem4DeskAppService deskAppService; + @Reference + private VrGem4Unicode4DService unicode4DService; + private final DeskAppLauncher launcher; public NotepadComponent() { diff --git a/gdxapp4d-app-notepad/src/main/java/love/distributedrebirth/gdxapp4d/app/notepad/NotepadDeskApp.java b/gdxapp4d-app-notepad/src/main/java/love/distributedrebirth/gdxapp4d/app/notepad/NotepadDeskApp.java index fbe9f536..9b453802 100644 --- a/gdxapp4d-app-notepad/src/main/java/love/distributedrebirth/gdxapp4d/app/notepad/NotepadDeskApp.java +++ b/gdxapp4d-app-notepad/src/main/java/love/distributedrebirth/gdxapp4d/app/notepad/NotepadDeskApp.java @@ -1,10 +1,14 @@ package love.distributedrebirth.gdxapp4d.app.notepad; +import imgui.ImColor; +import imgui.ImDrawList; import imgui.ImGui; +import imgui.ImVec2; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; 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.atlas.FontAtlasStoreGlyph; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") public class NotepadDeskApp extends AbstractDeskApp implements DeskAppRenderer { @@ -20,5 +24,50 @@ public class NotepadDeskApp extends AbstractDeskApp implements DeskAppRenderer { public void render() { ImGui.text("Value:"); ImGui.text(value); + + //FontAtlasStore plane = GDXAppMain.INSTANCE.basePlane.getPlaneByName("MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A"); + FontAtlasStoreGlyph glyph = null; //plane.getBaseGlyphByUnicode("27d6"); + + ImCharacter c = new ImCharacter(glyph); + + c.render(); + } + + + class ImCharacter { + + private final FontAtlasStoreGlyph glyph; + + public ImCharacter(FontAtlasStoreGlyph glyph) { + this.glyph = glyph; + + //List tongs = glyph.getTongs(); + } + + public void render() { + ImVec2 size = new ImVec2(144f, 48f); + ImGui.invisibleButton("canvas", size.x, size.y); + ImVec2 p0 = ImGui.getItemRectMin(); + ImVec2 p1 = ImGui.getItemRectMax(); // p1 = p0 + size + ImDrawList drawList = ImGui.getWindowDrawList(); + drawList.pushClipRect(p0.x, p0.y, p1.x, p1.y); + // draw unicode4D + drawList.addQuad(p0.x, p0.y, p0.x+size.x, p0.y, p1.x, p1.y, p0.x, p0.y+size.y, + ImColor.intToColor(127, 127, 255, 255), 5f); + + drawList.addLine(p0.x+10, p0.y+40, p0.x+20, p0.y+10, ImColor.intToColor(255, 127, 63, 255)); + drawList.addLine(p0.x+30, p0.y+40, p0.x+20, p0.y+10, ImColor.intToColor(255, 127, 63, 255)); + drawList.addLine(p0.x+13, p0.y+30, p0.x+27, p0.y+30, ImColor.intToColor(255, 127, 63, 255)); + + drawList.popClipRect(); + //System.out.println("p0.x="+p0.x+" p0.y="+p0.y); + //System.out.println("p1.x="+p1.x+" p1.y="+p1.y); + +// for (int n = 0; n < (1.0f + Math.sin(ImGui.getTime() * 5.7f)) * 40.0f; n++) { +// drawList.addCircle(p0.x + size.x * 0.5f, p0.y + size.y * 0.5f, size.y * (0.01f + n * 0.03f), +// ImColor.intToColor(255, 140 - n * 4, n * 3, 255) +// ); +// } + } } } diff --git a/gdxapp4d-lib-numberxd/src/main/java/love/distributedrebirth/numberxd/base2t/part/T08PartOctal.java b/gdxapp4d-lib-numberxd/src/main/java/love/distributedrebirth/numberxd/base2t/part/T08PartOctal.java index 0c23c90d..411349ed 100644 --- a/gdxapp4d-lib-numberxd/src/main/java/love/distributedrebirth/numberxd/base2t/part/T08PartOctal.java +++ b/gdxapp4d-lib-numberxd/src/main/java/love/distributedrebirth/numberxd/base2t/part/T08PartOctal.java @@ -7,7 +7,7 @@ import love.distributedrebirth.bassboonyd.BãßBȍőnClassInfoʸᴰ; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") @BãßBȍőnClassInfoʸᴰ(name = "T08PartOctal", purpose = "The distribution by 8 (human part).") -public enum T08PartOctal implements BãßBȍőnPartʸᴰ,BãßBȍőnPartShiftBitsʸᴰ { +public enum T08PartOctal implements BãßBȍőnPartShiftBitsʸᴰ { PART_1("˥","心","heart",0), PART_2("˩","頭","head", 3), diff --git a/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/CodePointᶻᴰ.java b/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/CodePointᶻᴰ.java index 3b1d574c..e9bfa3c9 100644 --- a/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/CodePointᶻᴰ.java +++ b/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/CodePointᶻᴰ.java @@ -36,16 +36,16 @@ public enum CodePointᶻᴰ { public int getArgumentUnicode(V036Teger teger) { int unicode = 0; - unicode += teger.getValue(T02PartBinary.PART_1).getValueNumber(); - unicode += teger.getValue(T02PartBinary.PART_2).getValueNumber() << 18; + unicode += getArgument(teger, T02PartBinary.PART_1); + unicode += getArgument(teger, T02PartBinary.PART_2) << 15; return unicode; } public void setArgumentUnicode(V036Teger teger, int unicode) { - teger.getValue(T02PartBinary.PART_1).setValueNumber(unicode); - teger.getValue(T02PartBinary.PART_2).setValueNumber(unicode >> 18); + setArgument(teger, T02PartBinary.PART_1, unicode); + setArgument(teger, T02PartBinary.PART_2, unicode >> 15); } - + /* public long getArgumentNumber(V036Teger teger) { return teger.getValueNumber(); } @@ -53,11 +53,11 @@ public enum CodePointᶻᴰ { public void setArgumentNumber(V036Teger teger, long number) { teger.setValueNumber(number); } - + */ public CodePointCommandᶻᴰ getCommand(V036Teger teger) { int mode = 0; - mode += ((teger.getValue(T02PartBinary.PART_1).getValueNumber() >> 15) & 0b111) << 0; - mode += ((teger.getValue(T02PartBinary.PART_2).getValueNumber() >> 15) & 0b111) << 3; + mode += (teger.getValue(T02PartBinary.PART_1).getValueNumber() >> 15) << 0; + mode += (teger.getValue(T02PartBinary.PART_2).getValueNumber() >> 15) << 3; return CodePointCommandᶻᴰ.values()[mode]; } diff --git a/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/atlas/FontAtlas.java b/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/atlas/FontAtlas.java index 1623ccf8..d4f5c5be 100644 --- a/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/atlas/FontAtlas.java +++ b/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/atlas/FontAtlas.java @@ -2,7 +2,6 @@ package love.distributedrebirth.unicode4d.atlas; import java.util.Collection; import java.util.HashMap; -import java.util.List; import java.util.Map; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; @@ -23,7 +22,7 @@ public class FontAtlas { return stores.values(); } - public void setStores(List planes) { + public void setStores(Collection planes) { for (FontAtlasStore plane:planes) { addStore(plane); } diff --git a/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/atlas/FontAtlasStoreGlyph.java b/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/atlas/FontAtlasStoreGlyph.java index 9f415688..81b1e8bb 100644 --- a/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/atlas/FontAtlasStoreGlyph.java +++ b/gdxapp4d-lib-unicodezd/src/main/java/love/distributedrebirth/unicode4d/atlas/FontAtlasStoreGlyph.java @@ -9,6 +9,9 @@ import java.util.List; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.numberxd.base2t.Base2Terminator; +import love.distributedrebirth.numberxd.base2t.BaseAppenderOctal; +import love.distributedrebirth.numberxd.base2t.BaseIteratorOctalAdapter; +import love.distributedrebirth.numberxd.base2t.part.T08PartOctal; import love.distributedrebirth.numberxd.base2t.type.V072Tong; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") @@ -30,6 +33,45 @@ public class FontAtlasStoreGlyph { public void addTong(V072Tong glyph) { this.tongs.add(glyph); } + + public List getOct64() { + List result = new ArrayList<>(); + BaseAppenderOctal appender = new BaseAppenderOctal(result); + for (V072Tong tong: tongs) { + tong.fillOctalsByClone(appender); + } + return result; + } + + public void setOct64(List data) { + BaseIteratorOctalAdapter adapter = new BaseIteratorOctalAdapter(data.iterator()); + List result = new ArrayList<>(); + while (adapter.hasNext()) { + result.add(new V072Tong(adapter)); + } + tongs = result; + } + + public byte[] getByte64() { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try { + Base2Terminator.INSTANCE.Bãß2WriteTong(tongs, baos); + } catch (IOException e) { + throw new RuntimeException(e); + } + return baos.toByteArray(); + } + + public void setByte64(byte[] decodedBytes) { + ByteArrayInputStream bais = new ByteArrayInputStream(decodedBytes); + try { + List result = new ArrayList<>(); + Base2Terminator.INSTANCE.Bãß2ReadTong(bais, result); + tongs = result; + } catch (IOException e) { + throw new RuntimeException(e); + } + } public String getBase64() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); diff --git a/gdxapp4d-lib-unicodezd/src/test/java/love/distributedrebirth/unicode4d/TestConvFont.java b/gdxapp4d-lib-unicodezd/src/test/java/love/distributedrebirth/unicode4d/TestConvFont.java index 462512a6..4c3a9289 100644 --- a/gdxapp4d-lib-unicodezd/src/test/java/love/distributedrebirth/unicode4d/TestConvFont.java +++ b/gdxapp4d-lib-unicodezd/src/test/java/love/distributedrebirth/unicode4d/TestConvFont.java @@ -73,7 +73,8 @@ public class TestConvFont { conf("noto-sans-brahmi", new File(in+"plane1/noto-sans-brahmi.ttf.xml"), new File(out+"plane1/noto-sans-brahmi.ttf4d")); conf("code-2002", new File(in+"plane2/code-2002.ttf.xml"), new File(out+"plane2/code-2002.ttf4d")); - + + System.out.println("Done conversion."); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -141,6 +142,15 @@ public class TestConvFont { baseGlyph.setTongs(tongs); fontStore.addGlyph(baseGlyph); + int unicode = CodePointᶻᴰ.INSTANCE.searchUnicode(baseGlyph.getTongs()); + System.out.println("Converted: "+Integer.toHexString(unicode)); + + FontAtlasStoreGlyph baseGlyph2 = new FontAtlasStoreGlyph(); + baseGlyph2.setByte64(baseGlyph.getByte64()); + + int unicode2 = CodePointᶻᴰ.INSTANCE.searchUnicode(baseGlyph2.getTongs()); + System.out.println("Converted2: "+Integer.toHexString(unicode2)); + } else if ("contour".equals(qName)) { } diff --git a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Activator.java b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Activator.java index 8e6d9fd0..e1784d44 100644 --- a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Activator.java +++ b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Activator.java @@ -32,6 +32,7 @@ import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFont import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpBase; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; +import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootReadyListener; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxFont; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog; import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpSea; @@ -62,6 +63,7 @@ public class GDXAppTos4Activator implements BundleActivator { private WaterDevice warpshipDevice; private SystemGdxTerminal systemGdxTerminal; private GDXAppTos4BootListener bootScreen; + private List bootReadyListeners = new ArrayList<>(); private static final String SYSTEM_USER_HOME = "user.home"; private static final String HYPERDRIVE_HOME = "Hyperdrive"; @@ -83,6 +85,12 @@ public class GDXAppTos4Activator implements BundleActivator { this.bootScreen = bootScreen; } + public void fireBootCompleted() { + for (SystemGdxBootReadyListener listener: bootReadyListeners) { + listener.bootCompleted(); + } + } + public boolean hasStartError() { return startError; } @@ -294,6 +302,11 @@ public class GDXAppTos4Activator implements BundleActivator { public void shutdown() { Gdx.app.exit(); } + + @Override + public void addBootReadyListener(SystemGdxBootReadyListener listener) { + bootReadyListeners.add(listener); + } } public class SystemWarpShipImpl implements SystemWarpShip { diff --git a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4BootFactory.java b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4BootFactory.java index fef73161..46310a99 100644 --- a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4BootFactory.java +++ b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4BootFactory.java @@ -98,6 +98,26 @@ public class GDXAppTos4BootFactory { "imgui.gl3,"+ "imgui.type,"+ "net.spookygames.gdx.nativefilechooser,"+ + "org.x4o.xml,"+ + "org.x4o.xml.conv,"+ + "org.x4o.xml.conv.text,"+ + "org.x4o.xml.el,"+ + "org.x4o.xml.eld,"+ + "org.x4o.xml.eld.lang,"+ + "org.x4o.xml.eld.xsd,"+ + "org.x4o.xml.element,"+ + "org.x4o.xml.io,"+ + "org.x4o.xml.io.sax,"+ + "org.x4o.xml.io.sax.ext,"+ + "org.x4o.xml.lang,"+ + "org.x4o.xml.lang.phase,"+ + "org.x4o.xml.lang.task,"+ + "org.x4o.xml.lang.task.run,"+ + "javax.el,"+ + "org.apache.el,"+ + "org.apache.el.lang,"+ + "org.apache.el.parser,"+ + "org.apache.el.util,"+ "love.distributedrebirth.bassboonyd,"+ "love.distributedrebirth.bassboonyd.jmx,"+ "love.distributedrebirth.numberxd,"+ diff --git a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Startup.java b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Startup.java index 5dd7da5a..bbf110fa 100644 --- a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Startup.java +++ b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/GDXAppTos4Startup.java @@ -35,6 +35,7 @@ public class GDXAppTos4Startup { LOG.debug("Release boot-screen"); systemActivator.setBootListener(null); tos4.disposeScreen(bootScreen); + systemActivator.fireBootCompleted(); }); } } catch (Exception e) { diff --git a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemGdxBootArgs.java b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemGdxBootArgs.java index e2d6ab0e..b438e7eb 100644 --- a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemGdxBootArgs.java +++ b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemGdxBootArgs.java @@ -15,4 +15,6 @@ public interface SystemGdxBootArgs { NativeFileChooser getFileChooser(); void shutdown(); + + void addBootReadyListener(SystemGdxBootReadyListener listener); } diff --git a/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemGdxBootReadyListener.java b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemGdxBootReadyListener.java new file mode 100644 index 00000000..459fd6de --- /dev/null +++ b/gdxapp4d-tos4/src/main/java/love/distributedrebirth/gdxapp4d/tos4/service/SystemGdxBootReadyListener.java @@ -0,0 +1,9 @@ +package love.distributedrebirth.gdxapp4d.tos4.service; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public interface SystemGdxBootReadyListener { + + void bootCompleted(); +} diff --git a/gdxapp4d-vrgem4/pom.xml b/gdxapp4d-vrgem4/pom.xml index eb90d4f6..0393c5b8 100644 --- a/gdxapp4d-vrgem4/pom.xml +++ b/gdxapp4d-vrgem4/pom.xml @@ -89,6 +89,26 @@ imgui.gl3, imgui.type, net.spookygames.gdx.nativefilechooser, + org.x4o.xml, + org.x4o.xml.conv, + org.x4o.xml.conv.text, + org.x4o.xml.el, + org.x4o.xml.eld, + org.x4o.xml.eld.lang, + org.x4o.xml.eld.xsd, + org.x4o.xml.element, + org.x4o.xml.io, + org.x4o.xml.io.sax, + org.x4o.xml.io.sax.ext, + org.x4o.xml.lang, + org.x4o.xml.lang.phase, + org.x4o.xml.lang.task, + org.x4o.xml.lang.task.run, + javax.el, + org.apache.el, + org.apache.el.lang, + org.apache.el.parser, + org.apache.el.util, love.distributedrebirth.bassboonyd, love.distributedrebirth.bassboonyd.jmx, love.distributedrebirth.numberxd, diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/GDXAppVrGem4Activator.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/GDXAppVrGem4Activator.java index a7e2dff6..926f46c0 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/GDXAppVrGem4Activator.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/GDXAppVrGem4Activator.java @@ -16,6 +16,7 @@ import imgui.type.ImBoolean; import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ; import love.distributedrebirth.bassboonyd.jmx.DefaultEnumBaseᴶᴹˣ; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; +import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootReadyListener; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxFont; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog; import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpShip; @@ -199,7 +200,6 @@ public class GDXAppVrGem4Activator implements BundleActivator { return; } bootScreen.bootLine("vrGEM4: chains resolved."); - try { systemWarpShip.loadBundles(context, registratedSeas); } catch (BundleException e) { @@ -207,18 +207,25 @@ public class GDXAppVrGem4Activator implements BundleActivator { bootScreen.bootLine("ERROR: "+e.getMessage()); return; } + bootArgs.addBootReadyListener(new SystemGdxBootReadyListener() { + @Override + public void bootCompleted() { + Gdx.app.postRunnable(new Runnable() { + @Override + public void run() { + terminal.selectScreen(ScreenDesktop1.class); + terminal.disposeScreen(bootScreen); + } + }); + logger.info(this, "Boot done"); + } + }); + try { Thread.sleep(VIEW_SLEEP_TIME); } catch (InterruptedException ignored) { } - Gdx.app.postRunnable(new Runnable() { - @Override - public void run() { - terminal.selectScreen(ScreenDesktop1.class); - terminal.disposeScreen(bootScreen); - } - }); - logger.info(this, "Boot done"); + bootScreen.bootLine("vrGEM4: Init bundles..."); } //TODO: add layer or ?? private ,DefaultAuthorInfoʸᴰ> T[] storeInstances() { diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/VrGem4Unicode4DServiceImpl.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/VrGem4Unicode4DServiceImpl.java new file mode 100644 index 00000000..2548e3ef --- /dev/null +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/VrGem4Unicode4DServiceImpl.java @@ -0,0 +1,82 @@ +package love.distributedrebirth.gdxapp4d.vrgem4; + +import java.io.File; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.osgi.framework.BundleContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; + +import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog; +import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpShip; +import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4Unicode4DService; +import love.distributedrebirth.unicode4d.CodePointᶻᴰ; +import love.distributedrebirth.unicode4d.atlas.FontAtlas; +import love.distributedrebirth.unicode4d.atlas.FontAtlasDriver; +import love.distributedrebirth.unicode4d.atlas.FontAtlasStore; +import love.distributedrebirth.unicode4d.atlas.FontAtlasStoreGlyph; + +@Component +public class VrGem4Unicode4DServiceImpl implements VrGem4Unicode4DService { + + private final FontAtlas masterFontAtlas; + private final Map unicodeMap; + + @Reference + private SystemGdxLog log; + + @Reference + private SystemWarpShip warpShip; + + + public VrGem4Unicode4DServiceImpl() { + masterFontAtlas = new FontAtlas(); + unicodeMap = new HashMap<>(); + } + + @Activate + void open(final BundleContext context) { + log.debug(this, SystemGdxLog.ACTIVATE); + List glyps = warpShip.searchMagic(context, "application/x-font-ttf4d"); + try { + for (File glypSet:glyps) { + log.debug(this, "Loading glypSet: {}", glypSet); + FontAtlas atlas = FontAtlasDriver.newInstance().createReader().readFile(glypSet); + masterFontAtlas.setStores(atlas.getStores()); + } + } catch (Exception e) { + log.error(this, e.getMessage(), e); + } + log.info(this, "Master font atlas size: {}", masterFontAtlas.getStores().size()); + + for (FontAtlasStore fontStore:masterFontAtlas.getStores()) { + log.info(this,"Map unicode: {}", fontStore.getName()); + for (FontAtlasStoreGlyph glyph: fontStore.getGlyphs()) { + int unicode = CodePointᶻᴰ.INSTANCE.searchUnicode(glyph.getTongs()); + if (unicode > 0) { + unicodeMap.put(Character.valueOf((char) unicode), glyph); + } + } + } + log.info(this, "unicode map size: {}", unicodeMap.size()); + } + + @Deactivate + void close() { + log.debug(this, SystemGdxLog.DEACTIVATE); + } + + @Override + public FontAtlas getMasterFontAtlas() { + return masterFontAtlas; + } + + @Override + public FontAtlasStoreGlyph getGlyphForUnicode(char unicode) { + return unicodeMap.get(unicode); + } +} diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/VrGem4Unicode4DService.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/VrGem4Unicode4DService.java new file mode 100644 index 00000000..3eb01680 --- /dev/null +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/service/VrGem4Unicode4DService.java @@ -0,0 +1,11 @@ +package love.distributedrebirth.gdxapp4d.vrgem4.service; + +import love.distributedrebirth.unicode4d.atlas.FontAtlas; +import love.distributedrebirth.unicode4d.atlas.FontAtlasStoreGlyph; + +public interface VrGem4Unicode4DService { + + FontAtlas getMasterFontAtlas(); + + FontAtlasStoreGlyph getGlyphForUnicode(char unicode); +} diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/DeskTopScreenMenu.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/DeskTopScreenMenu.java index b844f869..75d2f686 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/DeskTopScreenMenu.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/DeskTopScreenMenu.java @@ -25,7 +25,6 @@ import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSectio import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppRenderer; import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.SystemBaseGlyphApp; import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.SystemBasePartApp; -import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.Unicode4DApp; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") public class DeskTopScreenMenu { @@ -45,8 +44,6 @@ public class DeskTopScreenMenu { apps = new ArrayList<>(); apps.add(new DeskAppLauncher(DeskAppMenuSection.PROGRAMMING, "Sys Glyph Set", () -> new SystemBaseGlyphApp())); apps.add(new DeskAppLauncher(DeskAppMenuSection.PROGRAMMING, "Sys Number Parts", () -> new SystemBasePartApp())); - - apps.add(new DeskAppLauncher(DeskAppMenuSection.PROGRAMMING, "Unicode4D", () -> new Unicode4DApp())); } public void renderMenu(DeskTopScreen appScreen) { diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/apps/Unicode4DApp.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/apps/Unicode4DApp.java deleted file mode 100644 index 4ab3fd20..00000000 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/apps/Unicode4DApp.java +++ /dev/null @@ -1,73 +0,0 @@ -package love.distributedrebirth.gdxapp4d.vrgem4.view.apps; - -import java.util.List; - -import imgui.ImColor; -import imgui.ImDrawList; -import imgui.ImGui; -import imgui.ImVec2; -import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; -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.base2t.type.V072Tong; -import love.distributedrebirth.unicode4d.atlas.FontAtlasStore; -import love.distributedrebirth.unicode4d.atlas.FontAtlasStoreGlyph; - -@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -public class Unicode4DApp extends AbstractDeskApp implements DeskAppRenderer { - - public void create() { - getContours().setTitle("Unicode4D"); - getContours().registrateContour(DeskAppContourSection.MAIN, this); - } - - @Override - public void render() { - ImGui.text("There is unicode and unicode4D"); - - //FontAtlasStore plane = GDXAppMain.INSTANCE.basePlane.getPlaneByName("MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A"); - FontAtlasStoreGlyph glyph = null; //plane.getBaseGlyphByUnicode("27d6"); - - ImCharacter c = new ImCharacter(glyph); - - c.render(); - } - - class ImCharacter { - - private final FontAtlasStoreGlyph glyph; - - public ImCharacter(FontAtlasStoreGlyph glyph) { - this.glyph = glyph; - - //List tongs = glyph.getTongs(); - } - - public void render() { - ImVec2 size = new ImVec2(144f, 48f); - ImGui.invisibleButton("canvas", size.x, size.y); - ImVec2 p0 = ImGui.getItemRectMin(); - ImVec2 p1 = ImGui.getItemRectMax(); // p1 = p0 + size - ImDrawList drawList = ImGui.getWindowDrawList(); - drawList.pushClipRect(p0.x, p0.y, p1.x, p1.y); - // draw unicode4D - drawList.addQuad(p0.x, p0.y, p0.x+size.x, p0.y, p1.x, p1.y, p0.x, p0.y+size.y, - ImColor.intToColor(127, 127, 255, 255), 5f); - - drawList.addLine(p0.x+10, p0.y+40, p0.x+20, p0.y+10, ImColor.intToColor(255, 127, 63, 255)); - drawList.addLine(p0.x+30, p0.y+40, p0.x+20, p0.y+10, ImColor.intToColor(255, 127, 63, 255)); - drawList.addLine(p0.x+13, p0.y+30, p0.x+27, p0.y+30, ImColor.intToColor(255, 127, 63, 255)); - - drawList.popClipRect(); - //System.out.println("p0.x="+p0.x+" p0.y="+p0.y); - //System.out.println("p1.x="+p1.x+" p1.y="+p1.y); - -// for (int n = 0; n < (1.0f + Math.sin(ImGui.getTime() * 5.7f)) * 40.0f; n++) { -// drawList.addCircle(p0.x + size.x * 0.5f, p0.y + size.y * 0.5f, size.y * (0.01f + n * 0.03f), -// ImColor.intToColor(255, 140 - n * 4, n * 3, 255) -// ); -// } - } - } -}