wip bug hunt

This commit is contained in:
Willem Cazander 2022-03-12 20:59:21 +01:00
parent c6c5c0fa8f
commit c60f7cca65
18 changed files with 290 additions and 97 deletions

View file

@ -7,6 +7,7 @@ import org.osgi.service.component.annotations.Reference;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService; 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.DeskAppLauncher;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection;
@ -19,6 +20,9 @@ public class NotepadComponent {
@Reference @Reference
private VrGem4DeskAppService deskAppService; private VrGem4DeskAppService deskAppService;
@Reference
private VrGem4Unicode4DService unicode4DService;
private final DeskAppLauncher launcher; private final DeskAppLauncher launcher;
public NotepadComponent() { public NotepadComponent() {

View file

@ -1,10 +1,14 @@
package love.distributedrebirth.gdxapp4d.app.notepad; package love.distributedrebirth.gdxapp4d.app.notepad;
import imgui.ImColor;
import imgui.ImDrawList;
import imgui.ImGui; import imgui.ImGui;
import imgui.ImVec2;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.AbstractDeskApp; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.AbstractDeskApp;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppContourSection; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppContourSection;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppRenderer; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppRenderer;
import love.distributedrebirth.unicode4d.atlas.FontAtlasStoreGlyph;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class NotepadDeskApp extends AbstractDeskApp implements DeskAppRenderer { public class NotepadDeskApp extends AbstractDeskApp implements DeskAppRenderer {
@ -20,5 +24,50 @@ public class NotepadDeskApp extends AbstractDeskApp implements DeskAppRenderer {
public void render() { public void render() {
ImGui.text("Value:"); ImGui.text("Value:");
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<V072Tong> 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)
// );
// }
}
} }
} }

View file

@ -7,7 +7,7 @@ import love.distributedrebirth.bassboonyd.BãßBȍőnClassInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
@BãßBȍőnClassInfoʸᴰ(name = "T08PartOctal", purpose = "The distribution by 8 (human part).") @BãßBȍőnClassInfoʸᴰ(name = "T08PartOctal", purpose = "The distribution by 8 (human part).")
public enum T08PartOctal implements BãßBȍőnPartʸᴰ<T08PartOctal>,BãßBȍőnPartShiftBitsʸᴰ<T08PartOctal> { public enum T08PartOctal implements BãßBȍőnPartShiftBitsʸᴰ<T08PartOctal> {
PART_1("˥","","heart",0), PART_1("˥","","heart",0),
PART_2("˩","","head", 3), PART_2("˩","","head", 3),

View file

@ -36,16 +36,16 @@ public enum CodePointᶻᴰ {
public int getArgumentUnicode(V036Teger teger) { public int getArgumentUnicode(V036Teger teger) {
int unicode = 0; int unicode = 0;
unicode += teger.getValue(T02PartBinary.PART_1).getValueNumber(); unicode += getArgument(teger, T02PartBinary.PART_1);
unicode += teger.getValue(T02PartBinary.PART_2).getValueNumber() << 18; unicode += getArgument(teger, T02PartBinary.PART_2) << 15;
return unicode; return unicode;
} }
public void setArgumentUnicode(V036Teger teger, int unicode) { public void setArgumentUnicode(V036Teger teger, int unicode) {
teger.getValue(T02PartBinary.PART_1).setValueNumber(unicode); setArgument(teger, T02PartBinary.PART_1, unicode);
teger.getValue(T02PartBinary.PART_2).setValueNumber(unicode >> 18); setArgument(teger, T02PartBinary.PART_2, unicode >> 15);
} }
/*
public long getArgumentNumber(V036Teger teger) { public long getArgumentNumber(V036Teger teger) {
return teger.getValueNumber(); return teger.getValueNumber();
} }
@ -53,11 +53,11 @@ public enum CodePointᶻᴰ {
public void setArgumentNumber(V036Teger teger, long number) { public void setArgumentNumber(V036Teger teger, long number) {
teger.setValueNumber(number); teger.setValueNumber(number);
} }
*/
public CodePointCommandᶻᴰ getCommand(V036Teger teger) { public CodePointCommandᶻᴰ getCommand(V036Teger teger) {
int mode = 0; int mode = 0;
mode += ((teger.getValue(T02PartBinary.PART_1).getValueNumber() >> 15) & 0b111) << 0; mode += (teger.getValue(T02PartBinary.PART_1).getValueNumber() >> 15) << 0;
mode += ((teger.getValue(T02PartBinary.PART_2).getValueNumber() >> 15) & 0b111) << 3; mode += (teger.getValue(T02PartBinary.PART_2).getValueNumber() >> 15) << 3;
return CodePointCommandᶻᴰ.values()[mode]; return CodePointCommandᶻᴰ.values()[mode];
} }

View file

@ -2,7 +2,6 @@ package love.distributedrebirth.unicode4d.atlas;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@ -23,7 +22,7 @@ public class FontAtlas {
return stores.values(); return stores.values();
} }
public void setStores(List<FontAtlasStore> planes) { public void setStores(Collection<FontAtlasStore> planes) {
for (FontAtlasStore plane:planes) { for (FontAtlasStore plane:planes) {
addStore(plane); addStore(plane);
} }

View file

@ -9,6 +9,9 @@ import java.util.List;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.numberxd.base2t.Base2Terminator; 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; import love.distributedrebirth.numberxd.base2t.type.V072Tong;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
@ -30,6 +33,45 @@ public class FontAtlasStoreGlyph {
public void addTong(V072Tong glyph) { public void addTong(V072Tong glyph) {
this.tongs.add(glyph); this.tongs.add(glyph);
} }
public List<T08PartOctal> getOct64() {
List<T08PartOctal> result = new ArrayList<>();
BaseAppenderOctal appender = new BaseAppenderOctal(result);
for (V072Tong tong: tongs) {
tong.fillOctalsByClone(appender);
}
return result;
}
public void setOct64(List<T08PartOctal> data) {
BaseIteratorOctalAdapter adapter = new BaseIteratorOctalAdapter(data.iterator());
List<V072Tong> 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<V072Tong> result = new ArrayList<>();
Base2Terminator.INSTANCE.Bãß2ReadTong(bais, result);
tongs = result;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String getBase64() { public String getBase64() {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();

View file

@ -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("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")); 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) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
@ -141,6 +142,15 @@ public class TestConvFont {
baseGlyph.setTongs(tongs); baseGlyph.setTongs(tongs);
fontStore.addGlyph(baseGlyph); 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)) { } else if ("contour".equals(qName)) {
} }

View file

@ -32,6 +32,7 @@ import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFont
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpBase; import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpBase;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; 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.SystemGdxFont;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpSea; import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpSea;
@ -62,6 +63,7 @@ public class GDXAppTos4Activator implements BundleActivator {
private WaterDevice warpshipDevice; private WaterDevice warpshipDevice;
private SystemGdxTerminal systemGdxTerminal; private SystemGdxTerminal systemGdxTerminal;
private GDXAppTos4BootListener bootScreen; private GDXAppTos4BootListener bootScreen;
private List<SystemGdxBootReadyListener> bootReadyListeners = new ArrayList<>();
private static final String SYSTEM_USER_HOME = "user.home"; private static final String SYSTEM_USER_HOME = "user.home";
private static final String HYPERDRIVE_HOME = "Hyperdrive"; private static final String HYPERDRIVE_HOME = "Hyperdrive";
@ -83,6 +85,12 @@ public class GDXAppTos4Activator implements BundleActivator {
this.bootScreen = bootScreen; this.bootScreen = bootScreen;
} }
public void fireBootCompleted() {
for (SystemGdxBootReadyListener listener: bootReadyListeners) {
listener.bootCompleted();
}
}
public boolean hasStartError() { public boolean hasStartError() {
return startError; return startError;
} }
@ -294,6 +302,11 @@ public class GDXAppTos4Activator implements BundleActivator {
public void shutdown() { public void shutdown() {
Gdx.app.exit(); Gdx.app.exit();
} }
@Override
public void addBootReadyListener(SystemGdxBootReadyListener listener) {
bootReadyListeners.add(listener);
}
} }
public class SystemWarpShipImpl implements SystemWarpShip { public class SystemWarpShipImpl implements SystemWarpShip {

View file

@ -98,6 +98,26 @@ public class GDXAppTos4BootFactory {
"imgui.gl3,"+ "imgui.gl3,"+
"imgui.type,"+ "imgui.type,"+
"net.spookygames.gdx.nativefilechooser,"+ "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,"+
"love.distributedrebirth.bassboonyd.jmx,"+ "love.distributedrebirth.bassboonyd.jmx,"+
"love.distributedrebirth.numberxd,"+ "love.distributedrebirth.numberxd,"+

View file

@ -35,6 +35,7 @@ public class GDXAppTos4Startup {
LOG.debug("Release boot-screen"); LOG.debug("Release boot-screen");
systemActivator.setBootListener(null); systemActivator.setBootListener(null);
tos4.disposeScreen(bootScreen); tos4.disposeScreen(bootScreen);
systemActivator.fireBootCompleted();
}); });
} }
} catch (Exception e) { } catch (Exception e) {

View file

@ -15,4 +15,6 @@ public interface SystemGdxBootArgs {
NativeFileChooser getFileChooser(); NativeFileChooser getFileChooser();
void shutdown(); void shutdown();
void addBootReadyListener(SystemGdxBootReadyListener listener);
} }

View file

@ -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();
}

View file

@ -89,6 +89,26 @@
imgui.gl3, imgui.gl3,
imgui.type, imgui.type,
net.spookygames.gdx.nativefilechooser, 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,
love.distributedrebirth.bassboonyd.jmx, love.distributedrebirth.bassboonyd.jmx,
love.distributedrebirth.numberxd, love.distributedrebirth.numberxd,

View file

@ -16,6 +16,7 @@ import imgui.type.ImBoolean;
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ;
import love.distributedrebirth.bassboonyd.jmx.DefaultEnumBaseᴶᴹˣ; import love.distributedrebirth.bassboonyd.jmx.DefaultEnumBaseᴶᴹˣ;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; 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.SystemGdxFont;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpShip; import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpShip;
@ -199,7 +200,6 @@ public class GDXAppVrGem4Activator implements BundleActivator {
return; return;
} }
bootScreen.bootLine("vrGEM4: chains resolved."); bootScreen.bootLine("vrGEM4: chains resolved.");
try { try {
systemWarpShip.loadBundles(context, registratedSeas); systemWarpShip.loadBundles(context, registratedSeas);
} catch (BundleException e) { } catch (BundleException e) {
@ -207,18 +207,25 @@ public class GDXAppVrGem4Activator implements BundleActivator {
bootScreen.bootLine("ERROR: "+e.getMessage()); bootScreen.bootLine("ERROR: "+e.getMessage());
return; 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 { try {
Thread.sleep(VIEW_SLEEP_TIME); Thread.sleep(VIEW_SLEEP_TIME);
} catch (InterruptedException ignored) { } catch (InterruptedException ignored) {
} }
Gdx.app.postRunnable(new Runnable() { bootScreen.bootLine("vrGEM4: Init bundles...");
@Override
public void run() {
terminal.selectScreen(ScreenDesktop1.class);
terminal.disposeScreen(bootScreen);
}
});
logger.info(this, "Boot done");
} }
//TODO: add layer or ?? private <T extends BãßBȍőnCoffinStoreʸᴰ<?>,DefaultAuthorInfoʸᴰ> T[] storeInstances() { //TODO: add layer or ?? private <T extends BãßBȍőnCoffinStoreʸᴰ<?>,DefaultAuthorInfoʸᴰ> T[] storeInstances() {

View file

@ -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<Character, FontAtlasStoreGlyph> 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<File> 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);
}
}

View file

@ -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);
}

View file

@ -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.service.deskapp.DeskAppRenderer;
import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.SystemBaseGlyphApp; import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.SystemBaseGlyphApp;
import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.SystemBasePartApp; import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.SystemBasePartApp;
import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.Unicode4DApp;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class DeskTopScreenMenu { public class DeskTopScreenMenu {
@ -45,8 +44,6 @@ public class DeskTopScreenMenu {
apps = new ArrayList<>(); apps = new ArrayList<>();
apps.add(new DeskAppLauncher(DeskAppMenuSection.PROGRAMMING, "Sys Glyph Set", () -> new SystemBaseGlyphApp())); 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, "Sys Number Parts", () -> new SystemBasePartApp()));
apps.add(new DeskAppLauncher(DeskAppMenuSection.PROGRAMMING, "Unicode4D", () -> new Unicode4DApp()));
} }
public void renderMenu(DeskTopScreen appScreen) { public void renderMenu(DeskTopScreen appScreen) {

View file

@ -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<V072Tong> 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)
// );
// }
}
}
}