First poc unicode4d encoded chars created

This commit is contained in:
Willem Cazander 2022-02-19 16:40:47 +01:00
parent 3e40820a58
commit 9008ea2f22
21 changed files with 1145 additions and 111 deletions

View file

@ -43,6 +43,8 @@ import love.distributedrebirth.numberxd.base2t.Base2PartsFactory;
import love.distributedrebirth.numberxd.base2t.Base2Terminator;
import love.distributedrebirth.numberxd.base2t.part.warp.TOSWarpCore;
import love.distributedrebirth.numberxd.glyph.BaseGlyphSet;
import love.distributedrebirth.unicode4d.base.UnicodePlane;
import love.distributedrebirth.unicode4d.base.UnicodePlaneDriver;
import love.distributedrebirth.warpme.TOSWarpCoreDriver;
import love.distributedrebirth.warpme.core.WaterBucket;
import net.spookygames.gdx.nativefilechooser.NativeFileChooser;
@ -64,6 +66,7 @@ public enum GDXAppMain implements DefaultEnumInstanceᴶᴹˣ<GDXAppMain,GDXAppM
public int viewWidth;
public int viewHeight;
public MusicManager music;
public UnicodePlane basePlane;
public ImBoolean showImGuiDemo = new ImBoolean(false);
private Map<Class<? extends Screen>,Screen> screens;
private DeskTopScreenMenu screenMenu;
@ -111,6 +114,9 @@ public enum GDXAppMain implements DefaultEnumInstanceᴶᴹˣ<GDXAppMain,GDXAppM
System.out.println("BãßBȍőnCoffinʸᴰ init done.");
try {
basePlane = UnicodePlaneDriver.newInstance().createReader().readString(Gdx.files.internal("font/unicode4d.xml").readString());
if (args.contains("warpcore-load")) {
System.out.println("warpcore-load: requested");
WaterBucket bucket = TOSWarpCoreDriver.newInstance().createReader().readFile("./warpcore.xml");

View file

@ -8,6 +8,7 @@ import com.badlogic.gdx.Gdx;
import imgui.ImGui;
import imgui.type.ImBoolean;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp.FontAwesomeIcons;
import love.distributedrebirth.gdxapp.GDXAppLauncher;
import love.distributedrebirth.gdxapp.GDXAppMain;
import love.distributedrebirth.gdxapp.desktop.apps.BasicConsoleApp;
@ -65,14 +66,14 @@ public class DeskTopScreenMenu {
}
private void renderSelfMenu(DeskTopScreen appScreen, DeskApp deskApp) {
if (ImGui.beginMenu(deskApp.getTitle())) {
if (ImGui.menuItem("Minimize", "", fileMinimizeSelected, deskApp != null )) {
if (ImGui.beginMenu(deskApp.getTitle())) {;
if (ImGui.menuItem(FontAwesomeIcons.FolderMinus + " Minimize", "", fileMinimizeSelected, deskApp != null )) {
fileMinimizeSelected.set(false);
if (deskApp != null) {
appScreen.getDeskAppScreen().setCurrentDeskApp(null);
}
}
if (ImGui.menuItem("Exit", "", fileCloseSelected, deskApp != null)) {
if (ImGui.menuItem(FontAwesomeIcons.WindowClose + " Exit", "", fileCloseSelected, deskApp != null)) {
fileCloseSelected.set(false);
if (deskApp != null) {
appScreen.getDeskAppScreen().removeDeskApp(deskApp);
@ -92,7 +93,7 @@ public class DeskTopScreenMenu {
if (fileNew == null && fileClose == null && fileSave == null && fileOption == null && filePrint == null) {
return;
}
if (ImGui.beginMenu("File")) {
if (ImGui.beginMenu(FontAwesomeIcons.File + " File")) {
if (fileNew != null) {
fileNew.render();
ImGui.separator();
@ -163,25 +164,25 @@ public class DeskTopScreenMenu {
}
private void renderVRGEM4Menu(DeskTopScreen appScreen) {
if (ImGui.beginMenu("vrGEM⁴")) {
if (ImGui.beginMenu(FontAwesomeIcons.Star + " vrGEM⁴")) {
String infix1 = "";
String infix2 = "";
String infix3 = "";
String infix4 = "";
if (appScreen instanceof ScreenDesktop1) {
infix1 = "=> ";
infix1 = FontAwesomeIcons.Wrench + " ";
}
if (appScreen instanceof ScreenDesktop2) {
infix2 = "=> ";
infix2 = FontAwesomeIcons.Wrench + " ";
}
if (appScreen instanceof ScreenDesktop3) {
infix3 = "=> ";
infix3 = FontAwesomeIcons.Wrench + " ";
}
if (appScreen instanceof ScreenDesktop4) {
infix4 = "=> ";
infix4 = FontAwesomeIcons.Wrench + " ";
}
if (ImGui.beginMenu(infix1+"Desktop1")) {
if (ImGui.menuItem("Main reality")) {
if (ImGui.menuItem(FontAwesomeIcons.Camera + " Main reality")) {
GDXAppMain.INSTANCE.selectScreen(ScreenDesktop1.class);
desktop1.getDeskAppScreen().setCurrentDeskApp(null);
}
@ -194,7 +195,7 @@ public class DeskTopScreenMenu {
ImGui.endMenu();
}
if (ImGui.beginMenu(infix2+"Desktop2")) {
if (ImGui.menuItem("Main reality")) {
if (ImGui.menuItem(FontAwesomeIcons.Camera + " Main reality")) {
GDXAppMain.INSTANCE.selectScreen(ScreenDesktop2.class);
desktop2.getDeskAppScreen().setCurrentDeskApp(null);
}
@ -207,7 +208,7 @@ public class DeskTopScreenMenu {
ImGui.endMenu();
}
if (ImGui.beginMenu(infix3+"Desktop3")) {
if (ImGui.menuItem("Main reality")) {
if (ImGui.menuItem(FontAwesomeIcons.Camera + " Main reality")) {
GDXAppMain.INSTANCE.selectScreen(ScreenDesktop3.class);
desktop3.getDeskAppScreen().setCurrentDeskApp(null);
}
@ -220,7 +221,7 @@ public class DeskTopScreenMenu {
ImGui.endMenu();
}
if (ImGui.beginMenu(infix4+"Desktop4")) {
if (ImGui.menuItem("Main reality")) {
if (ImGui.menuItem(FontAwesomeIcons.Camera + " Main reality")) {
GDXAppMain.INSTANCE.selectScreen(ScreenDesktop4.class);
desktop4.getDeskAppScreen().setCurrentDeskApp(null);
}
@ -233,7 +234,7 @@ public class DeskTopScreenMenu {
ImGui.endMenu();
}
ImGui.separator();
if (ImGui.beginMenu("Start App")) {
if (ImGui.beginMenu(FontAwesomeIcons.Plus + " Start App")) {
for (GDXAppLauncher launcher: apps) {
if (ImGui.menuItem(launcher.getName())) {
appScreen.getDeskAppScreen().addDeskApp(launcher.getLauncher().get());
@ -241,30 +242,31 @@ public class DeskTopScreenMenu {
}
ImGui.endMenu();
}
if (ImGui.menuItem("Run App")) {
if (ImGui.menuItem(FontAwesomeIcons.Terminal + " Run App")) {
}
ImGui.separator();
if (Gdx.graphics.isFullscreen()) {
if (ImGui.menuItem("Window Mode")) {
if (ImGui.menuItem(FontAwesomeIcons.Wheelchair + " Window Mode")) {
Gdx.graphics.setWindowedMode(GDXAppMain.INSTANCE.viewWidth, GDXAppMain.INSTANCE.viewHeight);
}
} else {
if (ImGui.menuItem("Full Screen")) {
if (ImGui.menuItem(FontAwesomeIcons.FighterJet + " Full Screen")) {
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
}
}
ImGui.separator();
if (ImGui.menuItem("Credits")) {
if (ImGui.menuItem(FontAwesomeIcons.CreditCard + " Credits")) {
GDXAppMain.INSTANCE.selectScreen(ScreenCredits.class);
}
if (ImGui.menuItem("Help")) {
if (ImGui.menuItem(FontAwesomeIcons.HandsHelping + " Help")) {
GDXAppMain.INSTANCE.selectScreen(ScreenHelp.class);
}
ImGui.separator();
if (ImGui.menuItem("ImGui Demo")) {
if (ImGui.menuItem(FontAwesomeIcons.Trademark + " ImGui Demo")) {
GDXAppMain.INSTANCE.showImGuiDemo.set(true);
}
if (ImGui.menuItem("Shutdown")) {
if (ImGui.menuItem(FontAwesomeIcons.PowerOff + " Shutdown")) {
GDXAppMain.INSTANCE.dispose();
System.exit(0);
}

View file

@ -5,9 +5,12 @@ import imgui.ImDrawList;
import imgui.ImGui;
import imgui.ImVec2;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp.GDXAppMain;
import love.distributedrebirth.gdxapp.desktop.DefaultDeskApp;
import love.distributedrebirth.gdxapp.desktop.DeskAppContourSection;
import love.distributedrebirth.gdxapp.desktop.DeskAppRenderer;
import love.distributedrebirth.unicode4d.base.UnicodePlaneBase;
import love.distributedrebirth.unicode4d.base.UnicodePlaneBaseGlyph;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class Unicode4DApp extends DefaultDeskApp implements DeskAppRenderer {
@ -20,29 +23,47 @@ public class Unicode4DApp extends DefaultDeskApp implements DeskAppRenderer {
@Override
public void render() {
ImGui.text("There is unicode and unicode4D");
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));
UnicodePlaneBase plane = GDXAppMain.INSTANCE.basePlane.getPlaneByName("MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A");
UnicodePlaneBaseGlyph glyph = plane.getBaseGlyphByUnicode("27d6");
drawList.popClipRect();
ImCharacter c = new ImCharacter(glyph);
c.render();
}
class ImCharacter {
private final UnicodePlaneBaseGlyph glyph;
public ImCharacter(UnicodePlaneBaseGlyph glyph) {
this.glyph = glyph;
}
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);
//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)
// );
// }
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)
// );
// }
}
}
}