From 9eab5167c508442a07290413b5b7f9d58ad9b305 Mon Sep 17 00:00:00 2001 From: Willem Date: Sun, 13 Feb 2022 13:24:02 +0100 Subject: [PATCH] Converted to deskapp single screen setup --- .../bassboonyd/BãßBȍőnCoffinOpenʸᴰ.java | 14 + .../base2t/part/warp/TOSWarpCore.java | 5 +- .../gdxapp/GDXAppLauncher.java | 24 ++ .../distributedrebirth/gdxapp/GDXAppMain.java | 243 ++++++++++-------- .../gdxapp/GDXAppScreen.java | 10 + .../gdxapp/ImGuiRenderer.java | 10 - .../gdxapp/ImGuiRendererMain.java | 13 - .../gdxapp/desktop/BasicConsoleDeskApp.java | 32 --- .../gdxapp/desktop/DefaultDeskApp.java | 29 +++ .../gdxapp/desktop/DeskApp.java | 6 +- .../gdxapp/desktop/DeskAppContour.java | 8 +- .../gdxapp/desktop/DeskAppScreen.java | 73 ++++++ .../gdxapp/desktop/DeskAppScreenListener.java | 6 + .../gdxapp/desktop/DesktopManager.java | 49 ---- .../gdxapp/desktop/DesktopScreen.java | 6 - .../desktop/FilteringInputProcessor.java | 93 +++++++ .../gdxapp/desktop/apps/BasicConsoleApp.java | 29 +++ .../gdxapp/desktop/apps/HebrewWalletApp.java | 55 ++++ .../gdxapp/desktop/apps/MusicPlayerApp.java | 119 +++++++++ .../desktop/apps/SystemBaseGlyphApp.java | 59 +++++ .../desktop/apps/SystemBasePartApp.java | 142 ++++++++++ .../gdxapp/desktop/apps/Unicode4DApp.java | 48 ++++ .../gdxapp/music/MusicPlayerRenderer.java | 120 --------- .../gdxapp/screen/AbstractScreenDesktop.java | 116 +++++++++ .../gdxapp/screen/BasicConsoleRenderer.java | 32 --- .../gdxapp/screen/HebrewWalletRenderer.java | 60 ----- .../gdxapp/screen/ScreenCredits.java | 2 +- ...ScreenDefault.java => ScreenDesktop0.java} | 13 +- .../gdxapp/screen/ScreenDesktop1.java | 40 +++ .../gdxapp/screen/ScreenDesktop2.java | 30 +++ .../ScreenDesktop3.java} | 232 ++++++----------- .../gdxapp/screen/ScreenHelp.java | 2 +- .../gdxapp/screen/ScreenIntroMission.java | 2 +- .../gdxapp/screen/ScreenUnicode4D.java | 56 ---- .../screen/SystemBaseGlyphRenderer.java | 66 ----- .../gdxapp/screen/SystemBasePartRenderer.java | 149 ----------- .../{matrix4d => screen}/UserColorShader.java | 2 +- 37 files changed, 1127 insertions(+), 868 deletions(-) create mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppLauncher.java create mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppScreen.java delete mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/ImGuiRenderer.java delete mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/ImGuiRendererMain.java delete mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/BasicConsoleDeskApp.java create mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DefaultDeskApp.java create mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskAppScreen.java create mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskAppScreenListener.java delete mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DesktopManager.java delete mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DesktopScreen.java create mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/FilteringInputProcessor.java create mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/BasicConsoleApp.java create mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/HebrewWalletApp.java create mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/MusicPlayerApp.java create mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/SystemBaseGlyphApp.java create mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/SystemBasePartApp.java create mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/Unicode4DApp.java delete mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/music/MusicPlayerRenderer.java create mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/AbstractScreenDesktop.java delete mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/BasicConsoleRenderer.java delete mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/HebrewWalletRenderer.java rename main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/{ScreenDefault.java => ScreenDesktop0.java} (65%) create mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDesktop1.java create mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDesktop2.java rename main-gdxapp/src/main/love/distributedrebirth/gdxapp/{matrix4d/ScreenMatrix4D.java => screen/ScreenDesktop3.java} (63%) delete mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenUnicode4D.java delete mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/SystemBaseGlyphRenderer.java delete mode 100644 main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/SystemBasePartRenderer.java rename main-gdxapp/src/main/love/distributedrebirth/gdxapp/{matrix4d => screen}/UserColorShader.java (97%) diff --git a/lib-bassboonyd/src/main/love/distributedrebirth/bassboonyd/BãßBȍőnCoffinOpenʸᴰ.java b/lib-bassboonyd/src/main/love/distributedrebirth/bassboonyd/BãßBȍőnCoffinOpenʸᴰ.java index b38a22c1..5867233a 100644 --- a/lib-bassboonyd/src/main/love/distributedrebirth/bassboonyd/BãßBȍőnCoffinOpenʸᴰ.java +++ b/lib-bassboonyd/src/main/love/distributedrebirth/bassboonyd/BãßBȍőnCoffinOpenʸᴰ.java @@ -2,6 +2,7 @@ package love.distributedrebirth.bassboonyd; import java.util.HashMap; import java.util.Map; +import java.util.function.Consumer; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") public interface BãßBȍőnCoffinOpenʸᴰ extends BãßBȍőnCoffinʸᴰ, DefaultInitMethodʸᴰ { @@ -18,6 +19,19 @@ public interface BãßBȍőnCoffinOpenʸᴰ()); } + static & BãßBȍőnCoffinStoreʸᴰ> void lockCoffin(T store) { + lockCoffin(store, v -> System.out.println(v)); + } + + static & BãßBȍőnCoffinStoreʸᴰ> void lockCoffin(T store, Consumer logHandler) { + logHandler.accept("Lock: "+store.BãßClassNaam()+" since: "+store.BãßAuthorCopyright()); + for (Object o:store.BãßInstances()) { + BãßBȍőnCoffinStoreʸᴰ coffin = BãßBȍőnCoffinStoreʸᴰ.class.cast(o); + BãßBȍőnCoffinOpenʸᴰ coffinOpen = BãßBȍőnCoffinOpenʸᴰ.class.cast(coffin.GET_BBC()); + coffinOpen.LOCK_COFFIN(); + } + } + static BãßBȍőnCoffinOpenʸᴰ newInstance() { return new BãßBȍőnCoffinOpenʸᴰ() { final Map initMap = new HashMap<>(); diff --git a/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/TOSWarpCore.java b/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/TOSWarpCore.java index 0e7876ef..739b6cfd 100644 --- a/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/TOSWarpCore.java +++ b/lib-numberxd/src/main/love/distributedrebirth/numberxd/base2t/part/warp/TOSWarpCore.java @@ -50,9 +50,8 @@ public enum TOSWarpCore implements DefaultEnumInstanceᴶᴹˣ part:Base2PartsFactory.INSTANCE.BãßBuildPartsByBase(base)) { - BãßBȍőnCoffinOpenʸᴰ.class.cast(part.GET_BBC()).LOCK_COFFIN(); - } + BãßBȍőnPartʸᴰ[] parts = Base2PartsFactory.INSTANCE.BãßBuildPartsByBase(base); + BãßBȍőnCoffinOpenʸᴰ.lockCoffin(parts[0]); } } diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppLauncher.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppLauncher.java new file mode 100644 index 00000000..05686f26 --- /dev/null +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppLauncher.java @@ -0,0 +1,24 @@ +package love.distributedrebirth.gdxapp; + +import java.util.function.Supplier; + +import love.distributedrebirth.gdxapp.desktop.DefaultDeskApp; + +public final class GDXAppLauncher { + + private final String name; + private final Supplier launcher; + + public GDXAppLauncher(String name, Supplier launcher) { + this.name = name; + this.launcher = launcher; + } + + public String getName() { + return name; + } + + public Supplier getLauncher() { + return launcher; + } +} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppMain.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppMain.java index 4c3743bc..4fa5c49f 100644 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppMain.java +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppMain.java @@ -1,5 +1,6 @@ package love.distributedrebirth.gdxapp; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -7,33 +8,37 @@ import java.util.Map; import com.badlogic.gdx.Game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; -import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.utils.ScreenUtils; import imgui.ImGui; +import imgui.flag.ImGuiCond; +import imgui.flag.ImGuiWindowFlags; import imgui.type.ImBoolean; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ; -import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinStoreʸᴰ; import love.distributedrebirth.bassboonyd.jmx.DefaultEnumBaseᴶᴹˣ; -import love.distributedrebirth.gdxapp.matrix4d.ScreenMatrix4D; +import love.distributedrebirth.gdxapp.desktop.DeskApp; +import love.distributedrebirth.gdxapp.desktop.DeskAppContourSection; +import love.distributedrebirth.gdxapp.desktop.DeskAppRenderer; +import love.distributedrebirth.gdxapp.desktop.apps.BasicConsoleApp; +import love.distributedrebirth.gdxapp.desktop.apps.HebrewWalletApp; +import love.distributedrebirth.gdxapp.desktop.apps.MusicPlayerApp; +import love.distributedrebirth.gdxapp.desktop.apps.SystemBaseGlyphApp; +import love.distributedrebirth.gdxapp.desktop.apps.SystemBasePartApp; import love.distributedrebirth.gdxapp.music.MusicManager; -import love.distributedrebirth.gdxapp.music.MusicPlayerRenderer; import love.distributedrebirth.gdxapp.music.MusicSongType; -import love.distributedrebirth.gdxapp.screen.SystemBasePartRenderer; -import love.distributedrebirth.gdxapp.screen.BasicConsoleRenderer; -import love.distributedrebirth.gdxapp.screen.HebrewWalletRenderer; import love.distributedrebirth.gdxapp.screen.ScreenCredits; -import love.distributedrebirth.gdxapp.screen.ScreenDefault; +import love.distributedrebirth.gdxapp.screen.ScreenDesktop0; +import love.distributedrebirth.gdxapp.screen.ScreenDesktop1; +import love.distributedrebirth.gdxapp.screen.ScreenDesktop2; +import love.distributedrebirth.gdxapp.screen.ScreenDesktop3; import love.distributedrebirth.gdxapp.screen.ScreenHelp; import love.distributedrebirth.gdxapp.screen.ScreenIntro; import love.distributedrebirth.gdxapp.screen.ScreenIntroMission; import love.distributedrebirth.gdxapp.screen.ScreenLoading; -import love.distributedrebirth.gdxapp.screen.ScreenUnicode4D; -import love.distributedrebirth.gdxapp.screen.SystemBaseGlyphRenderer; import love.distributedrebirth.numberxd.base2t.Base2PartsFactory; import love.distributedrebirth.numberxd.base2t.Base2Terminator; import love.distributedrebirth.numberxd.base2t.part.warp.TOSWarpCore; @@ -58,13 +63,9 @@ public class GDXAppMain extends Game { public MusicManager music; private Map,Screen> screens; - private Map,ImGuiRenderer> widgets; + private List apps; + private ImBoolean openWindowFlag = new ImBoolean(true); private ImBoolean showImGuiDemo = new ImBoolean(false); - private ImBoolean showMusicPlayer = new ImBoolean(false); - private ImBoolean showHebrewWallet = new ImBoolean(false); - private ImBoolean showSystemBasePart = new ImBoolean(false); - private ImBoolean showSystemGlyphPart = new ImBoolean(false); - private ImBoolean showBasicConsole = new ImBoolean(false); public GDXAppMain(List args, int viewWidth, int viewHeight, NativeFileChooser fileChooser) { this.args = args; @@ -84,15 +85,6 @@ public class GDXAppMain extends Game { }; } - private > void lockCoffin(T store) { - System.out.println(store.BãßClassNaam()+".authorCopyright: "+store.BãßAuthorCopyright()); - for (Object o:store.BãßInstances()) { - BãßBȍőnCoffinStoreʸᴰ coffin = BãßBȍőnCoffinStoreʸᴰ.class.cast(o); - BãßBȍőnCoffinOpenʸᴰ coffinOpen = BãßBȍőnCoffinOpenʸᴰ.class.cast(coffin.GET_BBC()); - coffinOpen.LOCK_COFFIN(); - } - } - private void lazyInit() { if (lazyIntCnt > 0) { lazyIntCnt--; @@ -103,7 +95,7 @@ public class GDXAppMain extends Game { // ref to init System.out.println("BãßBȍőnCoffinʸᴰ init......"); for (DefaultEnumBaseᴶᴹˣ coffin:coffinInstances()) { - lockCoffin(coffin); + BãßBȍőnCoffinOpenʸᴰ.lockCoffin(coffin); } System.out.println("BãßBȍőnCoffinʸᴰ init done."); @@ -122,6 +114,7 @@ public class GDXAppMain extends Game { throw new RuntimeException(e); } if (!args.contains("warpcore-nolock")) { + System.out.println("warpcore-lock: BãßLockWarpCipher"); TOSWarpCore.INSTANCE.BãßLockWarpCipher(); } else { System.out.println("warpcore-nolock: requested"); @@ -132,7 +125,7 @@ public class GDXAppMain extends Game { } if (args.contains("intro-skip")) { System.out.println("intro-skip: requested"); - selectScreen(ScreenDefault.class); + selectScreen(ScreenDesktop0.class); music.play(MusicSongType.BACKGROUND); } else { selectScreen(ScreenIntro.class); @@ -157,22 +150,22 @@ public class GDXAppMain extends Game { music.init(musicStop); screens = new HashMap<>(); - widgets = new HashMap<>(); - - putWidget(new MusicPlayerRenderer(this)); - putWidget(new HebrewWalletRenderer(this)); - putWidget(new SystemBasePartRenderer(this)); - putWidget(new SystemBaseGlyphRenderer(this)); - putWidget(new BasicConsoleRenderer(this)); + apps = new ArrayList<>(); + apps.add(new GDXAppLauncher("Basic Console", () -> new BasicConsoleApp())); + apps.add(new GDXAppLauncher("Base Glyphs", () -> new SystemBaseGlyphApp())); + apps.add(new GDXAppLauncher("Base Parts", () -> new SystemBasePartApp())); + apps.add(new GDXAppLauncher("Hebrew Wallet", () -> new HebrewWalletApp())); + apps.add(new GDXAppLauncher("Music Player", () -> new MusicPlayerApp(this))); putScreen(new ScreenLoading(this)); putScreen(new ScreenIntro(this)); putScreen(new ScreenIntroMission(this)); - putScreen(new ScreenDefault(this)); + putScreen(new ScreenDesktop0(this)); + putScreen(new ScreenDesktop1(this)); + putScreen(new ScreenDesktop2()); + putScreen(new ScreenDesktop3()); putScreen(new ScreenCredits(this)); putScreen(new ScreenHelp(this)); - putScreen(new ScreenMatrix4D(this)); - putScreen(new ScreenUnicode4D(this)); selectScreen(ScreenLoading.class); } @@ -192,10 +185,6 @@ public class GDXAppMain extends Game { screens.put(screen.getClass(), screen); } - private void putWidget(ImGuiRenderer widget) { - widgets.put(widget.getClass(), widget); - } - public void selectScreen(Class screenClass) { Screen screen = screens.get(screenClass); if (screen == null) { @@ -207,6 +196,9 @@ public class GDXAppMain extends Game { @Override public void render() { ScreenUtils.clear(0f, 0f, 0f, 1f, true); + if (screen == null) { + return; + } if (screen instanceof ScreenLoading) { screen.render(Gdx.graphics.getDeltaTime()); lazyInit(); @@ -214,38 +206,41 @@ public class GDXAppMain extends Game { } ImGuiSetup.imGuiImp.newFrame(); ImGui.newFrame(); - if (hasMainMenu()) { - renderMenu(); + + GDXAppScreen appScreen = null; + if (screen instanceof GDXAppScreen) { + appScreen = GDXAppScreen.class.cast(screen); + renderMenu(appScreen); } if (showImGuiDemo.get()) { ImGui.showDemoWindow(showImGuiDemo); } - if (showMusicPlayer.get()) { - widgets.get(MusicPlayerRenderer.class).render(showMusicPlayer); - } - if (showHebrewWallet.get()) { - widgets.get(HebrewWalletRenderer.class).render(showHebrewWallet); - } - if (showSystemBasePart.get()) { - widgets.get(SystemBasePartRenderer.class).render(showSystemBasePart); - } - if (showSystemGlyphPart.get()) { - widgets.get(SystemBaseGlyphRenderer.class).render(showSystemGlyphPart); - } - if (showBasicConsole.get()) { - widgets.get(BasicConsoleRenderer.class).render(showBasicConsole); + if (appScreen != null && appScreen.getDeskAppScreen().getCurrentDeskApp() != null) { + int sizeFlags = ImGuiCond.Always; + ImGui.setNextWindowPos(5, 30, sizeFlags); + ImGui.setNextWindowSize(Gdx.graphics.getWidth() - 10, Gdx.graphics.getHeight() - 35, sizeFlags); + int windowFlags = ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize; + if (ImGui.begin(appScreen.getDeskAppScreen().getCurrentDeskApp().getName(), openWindowFlag, windowFlags)) { + DeskAppRenderer renderer = appScreen.getDeskAppScreen().getCurrentDeskApp().getContours().getContour(DeskAppContourSection.MAIN); + if (renderer != null) { + renderer.render(); + } + } + if (openWindowFlag.get() == false) { + appScreen.getDeskAppScreen().setCurrentDeskApp(null); + openWindowFlag.set(true); + } + ImGui.end(); } if (screen != null) { screen.render(Gdx.graphics.getDeltaTime()); } - if (Gdx.input.isKeyPressed(Keys.ESCAPE)) { - selectScreen(ScreenDefault.class); - } ImGui.render(); ImGuiSetup.imGuiGlImp.renderDrawData(ImGui.getDrawData()); } - private void renderMenu() { + private void renderMenu(GDXAppScreen appScreen) { + DeskApp deskApp = appScreen.getDeskAppScreen().getCurrentDeskApp(); ImGui.beginMainMenuBar(); if (ImGui.beginMenu("Demo")) { if (Gdx.graphics.isFullscreen()) { @@ -257,12 +252,11 @@ public class GDXAppMain extends Game { Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); } } - ImGui.separator(); - if (ImGui.menuItem("Matrix4D")) { - selectScreen(ScreenMatrix4D.class); - } - if (ImGui.menuItem("Unicode4D")) { - selectScreen(ScreenUnicode4D.class); + if (ImGui.menuItem("Close")) { + if (deskApp != null) { + appScreen.getDeskAppScreen().removeDeskApp(deskApp); + appScreen.getDeskAppScreen().setCurrentDeskApp(null); + } } ImGui.separator(); if (ImGui.menuItem("Exit")) { @@ -271,60 +265,99 @@ public class GDXAppMain extends Game { } ImGui.endMenu(); } - if (ImGui.beginMenu("Widgets")) { - if (ImGui.menuItem("ImGui Demo")) { - showImGuiDemo.set(true); + + if (deskApp != null) { + renderEditMenu(deskApp); + } + if (ImGui.beginMenu("Desktop")) { + if (ImGui.beginMenu("Start")) { + for (GDXAppLauncher launcher: apps) { + if (ImGui.menuItem(launcher.getName())) { + appScreen.getDeskAppScreen().addDeskApp(launcher.getLauncher().get()); + } + } + ImGui.endMenu(); } ImGui.separator(); - if (ImGui.menuItem("Hebrew Wallet")) { - showHebrewWallet.set(true); - } - ImGui.separator(); - if (ImGui.menuItem("Base Part")) { - showSystemBasePart.set(true); - } - if (ImGui.menuItem("Base Glyph")) { - showSystemGlyphPart.set(true); - } - ImGui.separator(); - if (ImGui.menuItem("Basic Console")) { - showBasicConsole.set(true); - } - if (ImGui.menuItem("Music Player")) { - showMusicPlayer.set(true); + for (DeskApp app: appScreen.getDeskAppScreen().getDeskApps()) { + if (ImGui.menuItem(app.getName())) { + appScreen.getDeskAppScreen().setCurrentDeskApp(app); + } } ImGui.endMenu(); } - if (ImGui.beginMenu("Help")) { + if (ImGui.beginMenu("System")) { + if (ImGui.menuItem("Desktop0")) { + selectScreen(ScreenDesktop0.class); + } + if (ImGui.menuItem("Desktop1")) { + selectScreen(ScreenDesktop1.class); + } + if (ImGui.menuItem("Desktop2")) { + selectScreen(ScreenDesktop2.class); + } + if (ImGui.menuItem("Desktop3")) { + selectScreen(ScreenDesktop3.class); + } + ImGui.separator(); if (ImGui.menuItem("Credits")) { selectScreen(ScreenCredits.class); } - ImGui.separator(); if (ImGui.menuItem("Help")) { selectScreen(ScreenHelp.class); } + ImGui.separator(); + if (ImGui.menuItem("ImGui Demo")) { + showImGuiDemo.set(true); + } ImGui.endMenu(); } ImGui.endMainMenuBar(); } - private boolean hasMainMenu() { - Screen screen = getScreen(); - if (screen == null) { - return false; + private void renderEditMenu(DeskApp deskApp) { + DeskAppRenderer editUndo = deskApp.getContours().getContour(DeskAppContourSection.EDIT_UNDO); + DeskAppRenderer editCopy = deskApp.getContours().getContour(DeskAppContourSection.EDIT_COPY); + DeskAppRenderer editSelect = deskApp.getContours().getContour(DeskAppContourSection.EDIT_SELECT); + DeskAppRenderer editFind = deskApp.getContours().getContour(DeskAppContourSection.EDIT_FIND); + DeskAppRenderer editOption = deskApp.getContours().getContour(DeskAppContourSection.EDIT_OPTION); + if (editUndo != null || editCopy != null || editSelect != null || editFind != null || editOption != null) { + boolean first = false; + if (ImGui.beginMenu("Edit")) { + if (editUndo != null) { + editUndo.render(); + first = true; + } + if (editCopy != null) { + if (first) { + ImGui.separator(); + } + editCopy.render(); + first = true; + } + if (editSelect != null) { + if (first) { + ImGui.separator(); + } + editSelect.render(); + first = true; + } + if (editFind != null) { + if (first) { + ImGui.separator(); + } + editFind.render(); + first = true; + } + if (editOption != null) { + if (first) { + ImGui.separator(); + } + editOption.render(); + first = true; + } + ImGui.endMenu(); + } } - if (ScreenIntro.class.equals(screen.getClass())) { - return false; - } - if (ScreenIntroMission.class.equals(screen.getClass())) { - return false; - } - if (ScreenCredits.class.equals(screen.getClass())) { - return false; - } - if (ScreenHelp.class.equals(screen.getClass())) { - return false; - } - return true; } } diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppScreen.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppScreen.java new file mode 100644 index 00000000..be83c6ea --- /dev/null +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppScreen.java @@ -0,0 +1,10 @@ +package love.distributedrebirth.gdxapp; + +import com.badlogic.gdx.Screen; + +import love.distributedrebirth.gdxapp.desktop.DeskAppScreen; + +public interface GDXAppScreen extends Screen { + + DeskAppScreen getDeskAppScreen(); +} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/ImGuiRenderer.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/ImGuiRenderer.java deleted file mode 100644 index d32967fc..00000000 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/ImGuiRenderer.java +++ /dev/null @@ -1,10 +0,0 @@ -package love.distributedrebirth.gdxapp; - -import imgui.type.ImBoolean; -import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; - -@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -public interface ImGuiRenderer { - - void render(ImBoolean widgetOpen); -} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/ImGuiRendererMain.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/ImGuiRendererMain.java deleted file mode 100644 index 39808ba5..00000000 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/ImGuiRendererMain.java +++ /dev/null @@ -1,13 +0,0 @@ -package love.distributedrebirth.gdxapp; - -import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; - -@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -abstract public class ImGuiRendererMain implements ImGuiRenderer { - - protected final GDXAppMain main; - - public ImGuiRendererMain(GDXAppMain main) { - this.main = main; - } -} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/BasicConsoleDeskApp.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/BasicConsoleDeskApp.java deleted file mode 100644 index a3a602a8..00000000 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/BasicConsoleDeskApp.java +++ /dev/null @@ -1,32 +0,0 @@ -package love.distributedrebirth.gdxapp.desktop; - -import love.distributedrebirth.imxmi.lang.ImFrameˣᴹᴵ; -import love.distributedrebirth.imxmi.lang.ImTextˣᴹᴵ; - -public class BasicConsoleDeskApp implements DeskApp { - - @Override - public void create(DeskAppContour contour) { - ImFrameˣᴹᴵ frame = new ImFrameˣᴹᴵ(); - frame.setNextWindowPos(300, 300); - frame.setNextWindowSize(320, 240); - frame.setTitle("The BASIC Shahada of DUNE"); - frame.addComponent(new ImTextˣᴹᴵ("10 PRINT \"THERE IS NO GOD BUT @Ω仙⁴\"")); - frame.addComponent(new ImTextˣᴹᴵ("20 PRINT \"THERE IS NO RULE BUT CONSENT\"")); - frame.addComponent(new ImTextˣᴹᴵ("30 PRINT \"THERE IS NO FAILURE BUT DEATH\"")); - frame.addComponent(new ImTextˣᴹᴵ("40 PRINT \"TERRY A. DAVIS WAS THE PROPHET OF @Ω仙9⁴\"")); - frame.addComponent(new ImTextˣᴹᴵ("50 PRINT \"TERRY A. DAVIS WAS THE FIRST TRUE MENTAT\"")); - frame.addComponent(new ImTextˣᴹᴵ("60 PRINT \"TERRY A. DAVIS WAS THE BEST CODER ALIVE\"")); - frame.addComponent(new ImTextˣᴹᴵ("RUN")); - - contour.registrateContour(DeskAppContourSection.MAIN, new DeskAppRenderer() { - - @Override - public void render() { - frame.renderBegin(); - frame.renderComponent(); - frame.renderEnd(); - } - }); - } -} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DefaultDeskApp.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DefaultDeskApp.java new file mode 100644 index 00000000..47743305 --- /dev/null +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DefaultDeskApp.java @@ -0,0 +1,29 @@ +package love.distributedrebirth.gdxapp.desktop; + +public class DefaultDeskApp implements DeskApp { + + private final String name; + private final String icon; + private final DeskAppContour contours; + + public DefaultDeskApp(String name, String icon) { + this.name = name; + this.icon = icon; + this.contours = new DeskAppContour(); + } + + @Override + public String getName() { + return name; + } + + @Override + public String getIcon() { + return icon; + } + + @Override + public DeskAppContour getContours() { + return contours; + } +} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskApp.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskApp.java index 0855d414..978467ef 100644 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskApp.java +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskApp.java @@ -2,5 +2,9 @@ package love.distributedrebirth.gdxapp.desktop; public interface DeskApp { - void create(DeskAppContour contour); + String getName(); + + String getIcon(); + + DeskAppContour getContours(); } diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskAppContour.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskAppContour.java index 644aaa02..fcf6c91a 100644 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskAppContour.java +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskAppContour.java @@ -5,18 +5,12 @@ import java.util.Map; public class DeskAppContour { - private final String appName; private final Map renderers; - public DeskAppContour(String appName) { - this.appName = appName; + public DeskAppContour() { this.renderers = new HashMap<>(); } - public String getAppName() { - return appName; - } - public void registrateContour(DeskAppContourSection section, DeskAppRenderer renderer) { renderers.put(section, renderer); } diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskAppScreen.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskAppScreen.java new file mode 100644 index 00000000..211eb3f3 --- /dev/null +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskAppScreen.java @@ -0,0 +1,73 @@ +package love.distributedrebirth.gdxapp.desktop; + +import java.util.ArrayList; +import java.util.List; + +import imgui.ImGui; + +public class DeskAppScreen { + + private final String name; + private final List deskApps; + private DeskApp currentDeskApp; + private final List deskAppListeners; + + public DeskAppScreen(String name) { + this.name = name; + this.deskApps = new ArrayList<>(); + this.deskAppListeners = new ArrayList<>(); + } + + public String getName() { + return name; + } + + public void addDeskApp(DeskApp deskApp) { + deskApps.add(deskApp); + setCurrentDeskApp(deskApp); + } + + public void removeDeskApp(DeskApp deskApp) { + deskApps.remove(deskApp); + } + + public List getDeskApps() { + return deskApps; + } + + public DeskApp getCurrentDeskApp() { + return currentDeskApp; + } + + public void setCurrentDeskApp(DeskApp currentDeskApp) { + this.currentDeskApp = currentDeskApp; + for (DeskAppScreenListener listener: deskAppListeners) { + listener.selectDeskApp(currentDeskApp); + } + } + + public void addDeskAppListener(DeskAppScreenListener listener) { + deskAppListeners.add(listener); + } + + public final void renderMenu() { + for (DeskApp app: deskApps) { + if (ImGui.menuItem(app.getName())) { + //selectScreen(....class); + } + } + } + + public final void render(float delta) { + for (DeskApp app: deskApps) { + DeskAppRenderer appMain = app.getContours().getContour(DeskAppContourSection.MAIN); + if (appMain != null) { + appMain.render(); + } + } + renderBackground(); + } + + protected void renderBackground() { + } +} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskAppScreenListener.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskAppScreenListener.java new file mode 100644 index 00000000..c39bed22 --- /dev/null +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DeskAppScreenListener.java @@ -0,0 +1,6 @@ +package love.distributedrebirth.gdxapp.desktop; + +public interface DeskAppScreenListener { + + void selectDeskApp(DeskApp deskApp); +} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DesktopManager.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DesktopManager.java deleted file mode 100644 index 645e5358..00000000 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DesktopManager.java +++ /dev/null @@ -1,49 +0,0 @@ -package love.distributedrebirth.gdxapp.desktop; - -import java.util.ArrayList; -import java.util.List; - -import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; -import love.distributedrebirth.bassboonyd.BãßBȍőnClassInfoʸᴰ; -import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ; -import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinʸᴰ; -import love.distributedrebirth.bassboonyd.BãßBȍőnPackageInfoʸᴰ; -import love.distributedrebirth.bassboonyd.jmx.DefaultEnumInstanceᴶᴹˣ; -import love.distributedrebirth.bassboonyd.jmx.MBeanStoreKeyᴶᴹˣ; - -@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -@BãßBȍőnClassInfoʸᴰ(name = "BaseGlyphSet", purpose = "The encoded base scripts.") -@BãßBȍőnPackageInfoʸᴰ(name = "love.distributedrebirth.numberxd") -public enum DesktopManager implements DefaultEnumInstanceᴶᴹˣ { - - INSTANCE; - - private List screens = new ArrayList<>(); - private DesktopScreen currentScreen = null; - private final BãßBȍőnCoffinOpenʸᴰ BBC = BãßBȍőnCoffinOpenʸᴰ.newInstance(); - public BãßBȍőnCoffinʸᴰ GET_BBC() { return BBC; } - - public void BãßAddScreen(DesktopScreen screen) { - screens.add(screen); - } - - public int BãßScreensLength() { - return screens.size(); - } - - public DesktopScreen BãßScreenByIndex(int index) { - return screens.get(index); - } - - public void BãßSelectScreenByIndex(int index) { - BãßSelectScreen(BãßScreenByIndex(index)); - } - - public void BãßSelectScreen(DesktopScreen screen) { - currentScreen = screen; - } - - public DesktopScreen BãßCurrentScreen() { - return currentScreen; - } -} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DesktopScreen.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DesktopScreen.java deleted file mode 100644 index 4eedd600..00000000 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/DesktopScreen.java +++ /dev/null @@ -1,6 +0,0 @@ -package love.distributedrebirth.gdxapp.desktop; - -public interface DesktopScreen { - - public void render(float delta); -} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/FilteringInputProcessor.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/FilteringInputProcessor.java new file mode 100644 index 00000000..43d9a2a2 --- /dev/null +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/FilteringInputProcessor.java @@ -0,0 +1,93 @@ +package love.distributedrebirth.gdxapp.desktop; + +import com.badlogic.gdx.InputProcessor; + +public class FilteringInputProcessor implements InputProcessor { + + private final InputProcessor input; + private boolean filtering = false; + + public FilteringInputProcessor(InputProcessor input) { + this.input = input; + } + + public void setFiltering(boolean filtering) { + this.filtering = filtering; + } + + public boolean isFiltering() { + return filtering; + } + + @Override + public boolean keyDown(int keycode) { + if (filtering) { + return false; + } else { + return input.keyDown(keycode); + } + } + + @Override + public boolean keyUp(int keycode) { + if (filtering) { + return false; + } else { + return input.keyUp(keycode); + } + } + + @Override + public boolean keyTyped(char character) { + if (filtering) { + return false; + } else { + return input.keyTyped(character); + } + } + + @Override + public boolean touchDown(int screenX, int screenY, int pointer, int button) { + if (filtering) { + return false; + } else { + return input.touchDown(screenX, screenY, pointer, button); + } + } + + @Override + public boolean touchUp(int screenX, int screenY, int pointer, int button) { + if (filtering) { + return false; + } else { + return input.touchUp(screenX, screenY, pointer, button); + } + } + + @Override + public boolean touchDragged(int screenX, int screenY, int pointer) { + if (filtering) { + return false; + } else { + return input.touchDragged(screenX, screenY, pointer); + } + } + + @Override + public boolean mouseMoved(int screenX, int screenY) { + if (filtering) { + return false; + } else { + return input.mouseMoved(screenX, screenY); + } + } + + @Override + public boolean scrolled(float amountX, float amountY) { + if (filtering) { + return false; + } else { + return input.scrolled(amountX, amountY); + } + } +} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/BasicConsoleApp.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/BasicConsoleApp.java new file mode 100644 index 00000000..a8dfa905 --- /dev/null +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/BasicConsoleApp.java @@ -0,0 +1,29 @@ +package love.distributedrebirth.gdxapp.desktop.apps; + +import imgui.ImGui; +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; +import love.distributedrebirth.gdxapp.desktop.DefaultDeskApp; +import love.distributedrebirth.gdxapp.desktop.DeskAppContourSection; +import love.distributedrebirth.gdxapp.desktop.DeskAppRenderer; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class BasicConsoleApp extends DefaultDeskApp { + + public BasicConsoleApp() { + super("Basic Console", ""); + getContours().registrateContour(DeskAppContourSection.MAIN, new DeskAppRenderer() { + + @Override + public void render() { + ImGui.text("10 PRINT \"The BASIC Shahada of DUNE;\""); + ImGui.text("20 PRINT \"- THERE IS NO GOD BUT @Ω仙⁴\""); + ImGui.text("30 PRINT \"- THERE IS NO RULE BUT CONSENT\""); + ImGui.text("40 PRINT \"- THERE IS NO FAILURE BUT DEATH\""); + ImGui.text("50 PRINT \"- TERRY A. DAVIS WAS THE PROPHET OF @Ω仙9⁴\""); + ImGui.text("60 PRINT \"- TERRY A. DAVIS WAS THE FIRST TRUE MENTAT\""); + ImGui.text("70 PRINT \"- TERRY A. DAVIS WAS THE BEST CODER ALIVE\""); + ImGui.text("RUN"); + } + }); + } +} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/HebrewWalletApp.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/HebrewWalletApp.java new file mode 100644 index 00000000..0c065467 --- /dev/null +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/HebrewWalletApp.java @@ -0,0 +1,55 @@ +package love.distributedrebirth.gdxapp.desktop.apps; + +import imgui.ImGui; +import imgui.flag.ImGuiTableFlags; +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; +import love.distributedrebirth.gdxapp.desktop.DefaultDeskApp; +import love.distributedrebirth.gdxapp.desktop.DeskAppContourSection; +import love.distributedrebirth.gdxapp.desktop.DeskAppRenderer; +import love.distributedrebirth.numberxd.Gê̄ldGetậl; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class HebrewWalletApp extends DefaultDeskApp implements DeskAppRenderer { + + public HebrewWalletApp() { + super("Hebrew Wallet", ""); + getContours().registrateContour(DeskAppContourSection.MAIN, this); + } + + @Override + public void render() { + ImGui.text("Current amount:"); + ImGui.sameLine(); + ImGui.text("0000"); + ImGui.separator(); + if (ImGui.button("Pay")) { + } + int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV; + ImGui.beginTable("wallet", 4, flags); + ImGui.tableSetupColumn("In/Out"); + ImGui.tableSetupColumn("AmountRaw"); + ImGui.tableSetupColumn("AmountFix"); + ImGui.tableSetupColumn("Decimal"); + ImGui.tableHeadersRow(); + + String[] walletData = { + "ה","מ","מָ","ח","חֱ","חֱ‎מָא", + "א","בד","ב","ד","ץףן", + "הזפץ","מספר","צצצצ","ץאאא","דואר" + }; + for (String data:walletData) { + Gê̄ldGetậl geld = new Gê̄ldGetậl(data); + Gê̄ldGetậl geld2 = geld.toClone(); // unit test + ImGui.tableNextRow(); + ImGui.tableNextColumn(); + ImGui.text(data.length()==2||data.length()==3?"OUT":"IN"); + ImGui.tableNextColumn(); + ImGui.text(data); + ImGui.tableNextColumn(); + ImGui.text(geld2.toHebrewString(true)); // true=reverse for ImGui + ImGui.tableNextColumn(); + ImGui.text(Double.toString(geld.getTotalDecimalValue())); + } + ImGui.endTable(); + } +} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/MusicPlayerApp.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/MusicPlayerApp.java new file mode 100644 index 00000000..36e7596c --- /dev/null +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/MusicPlayerApp.java @@ -0,0 +1,119 @@ +package love.distributedrebirth.gdxapp.desktop.apps; + +import java.util.function.Consumer; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.files.FileHandle; + +import imgui.ImGui; +import imgui.flag.ImGuiSelectableFlags; +import imgui.flag.ImGuiTableColumnFlags; +import imgui.flag.ImGuiTableFlags; +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.gdxapp.music.MusicSong; +import net.spookygames.gdx.nativefilechooser.NativeFileChooserCallback; +import net.spookygames.gdx.nativefilechooser.NativeFileChooserConfiguration; + +/** + * The music player ui. + */ +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class MusicPlayerApp extends DefaultDeskApp implements DeskAppRenderer { + + private final GDXAppMain main; + private final NativeFileChooserConfiguration fileChooserConfig; + + public MusicPlayerApp(GDXAppMain main) { + super("Music Player", ""); + getContours().registrateContour(DeskAppContourSection.MAIN, this); + this.main = main; + fileChooserConfig = new NativeFileChooserConfiguration(); + fileChooserConfig.directory = Gdx.files.absolute(System.getProperty("user.home")); + fileChooserConfig.mimeFilter = "audio/*"; + fileChooserConfig.title = "Choose audio file"; + } + + @Override + public void render() { + ImGui.text("Current Song:"); + MusicSong currentSong = main.music.getCurrentSong(); + if (currentSong != null) { + ImGui.sameLine(); + ImGui.text(currentSong.getName()); + } + ImGui.separator(); + if (currentSong != null) { + if (ImGui.button("Play")) { + main.music.play(currentSong); + } + } else { + ImGui.text("Play"); + } + ImGui.sameLine(); + if (ImGui.button("<")) { + main.music.prev(); + } + ImGui.sameLine(); + if (ImGui.button(">")) { + main.music.next(); + } + ImGui.sameLine(); + if (ImGui.button("Stop")) { + main.music.stop(); + } + ImGui.sameLine(); + if (ImGui.button("Add")) { + main.fileChooser.chooseFile(fileChooserConfig, NativeFileChooserCallbackAdapter.onFileChosen(v -> main.music.addBackgroundMusic(v))); + } + int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV; + ImGui.beginTable("playlist", 3, flags); + ImGui.tableSetupColumn("#", ImGuiTableColumnFlags.NoHide); + ImGui.tableSetupColumn("Play"); + ImGui.tableSetupColumn("Name"); + ImGui.tableHeadersRow(); + int i=1; + for (MusicSong song:main.music.getBackgroundSongs()) { + ImGui.pushID(i); + ImGui.tableNextRow(); + ImGui.tableNextColumn(); + ImGui.selectable(""+i, song.isPlaying(), ImGuiSelectableFlags.None); + ImGui.tableNextColumn(); + if (ImGui.smallButton(">")) { + main.music.play(song); + } + ImGui.tableNextColumn(); + ImGui.selectable(song.getName(), song.isPlaying(), ImGuiSelectableFlags.None); + ImGui.popID(); + i++; + } + ImGui.endTable(); + } + + static class NativeFileChooserCallbackAdapter implements NativeFileChooserCallback { + + @Override + public void onFileChosen(FileHandle file) { + } + + @Override + public void onCancellation() { + } + + @Override + public void onError(Exception exception) { + } + + static NativeFileChooserCallbackAdapter onFileChosen(Consumer eater) { + return new NativeFileChooserCallbackAdapter() { + @Override + public void onFileChosen(FileHandle file) { + eater.accept(file); + } + }; + } + } +} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/SystemBaseGlyphApp.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/SystemBaseGlyphApp.java new file mode 100644 index 00000000..e170502f --- /dev/null +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/SystemBaseGlyphApp.java @@ -0,0 +1,59 @@ +package love.distributedrebirth.gdxapp.desktop.apps; + +import imgui.ImGui; +import imgui.flag.ImGuiTableFlags; +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; +import love.distributedrebirth.gdxapp.desktop.DefaultDeskApp; +import love.distributedrebirth.gdxapp.desktop.DeskAppContourSection; +import love.distributedrebirth.gdxapp.desktop.DeskAppRenderer; +import love.distributedrebirth.numberxd.glyph.BaseGlyphSet; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class SystemBaseGlyphApp extends DefaultDeskApp { + + public SystemBaseGlyphApp() { + super("Base Glyph Set", ""); + getContours().registrateContour(DeskAppContourSection.MAIN, new DeskAppRenderer() { + + @Override + public void render() { + int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV; + ImGui.beginTable("base-part", 3, flags); + ImGui.tableSetupColumn("Script"); + ImGui.tableSetupColumn("10Numbers"); + ImGui.tableSetupColumn("16Numbers"); + ImGui.tableHeadersRow(); + for (BaseGlyphSet set:BaseGlyphSet.values()) { + ImGui.tableNextRow(); + ImGui.tableNextColumn(); + ImGui.text(set.BȍőnNaam()); + ImGui.tableNextColumn(); + ImGui.text(print10Numbers(set)); + ImGui.tableNextColumn(); + ImGui.text(print16Numbers(set)); + } + ImGui.endTable(); + } + }); + } + + private String print10Numbers(BaseGlyphSet set) { + StringBuilder buf = new StringBuilder(); + for (int i=0;i<10;i++) { + buf.append(set.BȍőnNumber10().BȍőnCharFor(i)); + buf.append(set.BȍőnNumber10().BȍőnCharSeperator()); + } + return buf.toString(); + } + + private String print16Numbers(BaseGlyphSet set) { + StringBuilder buf = new StringBuilder(); + int x=240; + for (int i=0;i<16;i++) { + buf.append(set.BȍőnPrintNumber16(i + x, 99)); + buf.append(" "); + x = x - 16; + } + return buf.toString(); + } +} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/SystemBasePartApp.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/SystemBasePartApp.java new file mode 100644 index 00000000..b993216f --- /dev/null +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/SystemBasePartApp.java @@ -0,0 +1,142 @@ +package love.distributedrebirth.gdxapp.desktop.apps; + +import java.util.ArrayList; +import java.util.List; + +import imgui.ImGui; +import imgui.flag.ImGuiTableFlags; +import imgui.type.ImInt; +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; +import love.distributedrebirth.gdxapp.desktop.DefaultDeskApp; +import love.distributedrebirth.gdxapp.desktop.DeskAppContourSection; +import love.distributedrebirth.gdxapp.desktop.DeskAppRenderer; +import love.distributedrebirth.numberxd.base2t.Base2PartsFactory; +import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartAlt1ʸᴰ; +import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartAlt2ʸᴰ; +import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartAlt3ʸᴰ; +import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartAlt4ʸᴰ; +import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartʸᴰ; +import love.distributedrebirth.numberxd.glyph.BaseGlyphSet; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class SystemBasePartApp extends DefaultDeskApp implements DeskAppRenderer { + + private ImInt selectedBasePart = new ImInt(); + + public SystemBasePartApp() { + super("Base Parts", ""); + getContours().registrateContour(DeskAppContourSection.MAIN, this); + } + + @Override + public void render() { + List bases = new ArrayList<>(); + for (int base:Base2PartsFactory.INSTANCE.BãßBases()) { + bases.add(Integer.toString(base)); + } + String[] items = new String[bases.size()]; + items = bases.toArray(items); + String selectedItem = items[selectedBasePart.get()]; + Integer baseNumber = Integer.valueOf(selectedItem); + BãßBȍőnPartʸᴰ[] baseParts = Base2PartsFactory.INSTANCE.BãßBuildPartsByBase(baseNumber); + + ImGui.combo("Base", selectedBasePart, items); + + ImGui.text("Name:"); + ImGui.sameLine(); + ImGui.text(baseParts[0].BãßClassNaam()); + + ImGui.text("Purpose:"); + ImGui.sameLine(); + ImGui.text(baseParts[0].BãßClassPurpose()); + + int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV; + ImGui.beginTable("base-part", 21, flags); + ImGui.tableSetupColumn("BȍőnNaam"); + ImGui.tableSetupColumn("TelNul"); + ImGui.tableSetupColumn("TelEen"); + ImGui.tableSetupColumn("Tone"); + ImGui.tableSetupColumn("10Tone"); + ImGui.tableSetupColumn("10Kor"); + ImGui.tableSetupColumn("10DTMF"); + ImGui.tableSetupColumn("16Tone"); + ImGui.tableSetupColumn("16Kor"); + ImGui.tableSetupColumn("16LatB"); + ImGui.tableSetupColumn("36Tone"); + ImGui.tableSetupColumn("36Kor"); + ImGui.tableSetupColumn("36LatB"); + ImGui.tableSetupColumn("36Gre"); + ImGui.tableSetupColumn("36Heb"); + ImGui.tableSetupColumn("prcK"); + ImGui.tableSetupColumn("prcV"); + ImGui.tableSetupColumn("Alt1"); + ImGui.tableSetupColumn("Alt2"); + ImGui.tableSetupColumn("Alt3"); + ImGui.tableSetupColumn("Alt4"); + ImGui.tableHeadersRow(); + + for (BãßBȍőnPartʸᴰ part:baseParts) { + ImGui.tableNextRow(); + ImGui.tableNextColumn(); + ImGui.text(part.BȍőnNaam()); + ImGui.tableNextColumn(); + ImGui.text(Integer.toString(part.BȍőnRangTelNul())); + ImGui.tableNextColumn(); + ImGui.text(Integer.toString(part.BȍőnRangTelEen())); + ImGui.tableNextColumn(); + ImGui.text(part.BȍőnDialTone()); + ImGui.tableNextColumn(); + ImGui.text(part.BȍőnPrintGlyphSetNumber10(BaseGlyphSet.TONE_SCRIPT)); + ImGui.tableNextColumn(); + ImGui.text(part.BȍőnPrintGlyphSetNumber10(BaseGlyphSet.KOREAN)); + ImGui.tableNextColumn(); + ImGui.text(part.BȍőnPrintGlyphSetNumber10(BaseGlyphSet.LATIN_DTMF)); + ImGui.tableNextColumn(); + ImGui.text(part.BȍőnPrintGlyphSetNumber16(BaseGlyphSet.TONE_SCRIPT)); + ImGui.tableNextColumn(); + ImGui.text(part.BȍőnPrintGlyphSetNumber16(BaseGlyphSet.KOREAN)); + ImGui.tableNextColumn(); + ImGui.text(part.BȍőnPrintGlyphSetNumber16(BaseGlyphSet.LATIN_BASIC)); + ImGui.tableNextColumn(); + ImGui.text(part.BȍőnPrintGlyphSetNumber27(BaseGlyphSet.TONE_SCRIPT)); + ImGui.tableNextColumn(); + ImGui.text(part.BȍőnPrintGlyphSetNumber27(BaseGlyphSet.KOREAN)); + ImGui.tableNextColumn(); + ImGui.text(part.BȍőnPrintGlyphSetNumber27(BaseGlyphSet.LATIN_BASIC)); + ImGui.tableNextColumn(); + ImGui.text(part.BȍőnPrintGlyphSetNumber27(BaseGlyphSet.GREEK)); + ImGui.tableNextColumn(); + ImGui.text(part.BȍőnPrintGlyphSetNumber27(BaseGlyphSet.HEBREW)); + ImGui.tableNextColumn(); + ImGui.text(part.BȍőnChinaKey()); + ImGui.tableNextColumn(); + ImGui.text(part.BȍőnChinaValue()); + + ImGui.tableNextColumn(); + if (part instanceof BãßBȍőnPartAlt1ʸᴰ) { + ImGui.text(BãßBȍőnPartAlt1ʸᴰ.class.cast(part).BȍőnAlt1Value()); + } else { + ImGui.text(""); + } + ImGui.tableNextColumn(); + if (part instanceof BãßBȍőnPartAlt2ʸᴰ) { + ImGui.text(BãßBȍőnPartAlt2ʸᴰ.class.cast(part).BȍőnAlt2Value()); + } else { + ImGui.text(""); + } + ImGui.tableNextColumn(); + if (part instanceof BãßBȍőnPartAlt3ʸᴰ) { + ImGui.text(BãßBȍőnPartAlt3ʸᴰ.class.cast(part).BȍőnAlt3Value()); + } else { + ImGui.text(""); + } + ImGui.tableNextColumn(); + if (part instanceof BãßBȍőnPartAlt4ʸᴰ) { + ImGui.text(BãßBȍőnPartAlt4ʸᴰ.class.cast(part).BȍőnAlt4Value()); + } else { + ImGui.text(""); + } + } + ImGui.endTable(); + } +} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/Unicode4DApp.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/Unicode4DApp.java new file mode 100644 index 00000000..01697f22 --- /dev/null +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/Unicode4DApp.java @@ -0,0 +1,48 @@ +package love.distributedrebirth.gdxapp.desktop.apps; + +import imgui.ImColor; +import imgui.ImDrawList; +import imgui.ImGui; +import imgui.ImVec2; +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; +import love.distributedrebirth.gdxapp.desktop.DefaultDeskApp; +import love.distributedrebirth.gdxapp.desktop.DeskAppContourSection; +import love.distributedrebirth.gdxapp.desktop.DeskAppRenderer; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class Unicode4DApp extends DefaultDeskApp implements DeskAppRenderer { + + public Unicode4DApp() { + super("Unicode4D", ""); + getContours().registrateContour(DeskAppContourSection.MAIN, this); + } + + @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)); + + 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/main-gdxapp/src/main/love/distributedrebirth/gdxapp/music/MusicPlayerRenderer.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/music/MusicPlayerRenderer.java deleted file mode 100644 index 382ae213..00000000 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/music/MusicPlayerRenderer.java +++ /dev/null @@ -1,120 +0,0 @@ -package love.distributedrebirth.gdxapp.music; - -import java.util.function.Consumer; - -import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.files.FileHandle; - -import imgui.ImGui; -import imgui.flag.ImGuiCond; -import imgui.flag.ImGuiSelectableFlags; -import imgui.flag.ImGuiTableColumnFlags; -import imgui.flag.ImGuiTableFlags; -import imgui.type.ImBoolean; -import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; -import love.distributedrebirth.gdxapp.GDXAppMain; -import love.distributedrebirth.gdxapp.ImGuiRendererMain; -import net.spookygames.gdx.nativefilechooser.NativeFileChooserCallback; -import net.spookygames.gdx.nativefilechooser.NativeFileChooserConfiguration; - -/** - * The music player ui. - */ -@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -public class MusicPlayerRenderer extends ImGuiRendererMain { - - private final NativeFileChooserConfiguration fileChooserConfig; - - public MusicPlayerRenderer(GDXAppMain main) { - super(main); - fileChooserConfig = new NativeFileChooserConfiguration(); - fileChooserConfig.directory = Gdx.files.absolute(System.getProperty("user.home")); - fileChooserConfig.mimeFilter = "audio/*"; - fileChooserConfig.title = "Choose audio file"; - } - - @Override - public void render(ImBoolean widgetOpen) { - ImGui.setNextWindowPos(100, 100, ImGuiCond.FirstUseEver); - ImGui.setNextWindowSize(320, 240, ImGuiCond.FirstUseEver); - if (ImGui.begin("Music Player", widgetOpen)) { - ImGui.text("Current Song:"); - MusicSong currentSong = main.music.getCurrentSong(); - if (currentSong != null) { - ImGui.sameLine(); - ImGui.text(currentSong.getName()); - } - ImGui.separator(); - if (currentSong != null) { - if (ImGui.button("Play")) { - main.music.play(currentSong); - } - } else { - ImGui.text("Play"); - } - ImGui.sameLine(); - if (ImGui.button("<")) { - main.music.prev(); - } - ImGui.sameLine(); - if (ImGui.button(">")) { - main.music.next(); - } - ImGui.sameLine(); - if (ImGui.button("Stop")) { - main.music.stop(); - } - ImGui.sameLine(); - if (ImGui.button("Add")) { - main.fileChooser.chooseFile(fileChooserConfig, NativeFileChooserCallbackAdapter.onFileChosen(v -> main.music.addBackgroundMusic(v))); - } - int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV; - ImGui.beginTable("playlist", 3, flags); - ImGui.tableSetupColumn("#", ImGuiTableColumnFlags.NoHide); - ImGui.tableSetupColumn("Play"); - ImGui.tableSetupColumn("Name"); - ImGui.tableHeadersRow(); - int i=1; - for (MusicSong song:main.music.getBackgroundSongs()) { - ImGui.pushID(i); - ImGui.tableNextRow(); - ImGui.tableNextColumn(); - ImGui.selectable(""+i, song.isPlaying(), ImGuiSelectableFlags.None); - ImGui.tableNextColumn(); - if (ImGui.smallButton(">")) { - main.music.play(song); - } - ImGui.tableNextColumn(); - ImGui.selectable(song.getName(), song.isPlaying(), ImGuiSelectableFlags.None); - ImGui.popID(); - i++; - } - ImGui.endTable(); - } - ImGui.end(); - } - - static class NativeFileChooserCallbackAdapter implements NativeFileChooserCallback { - - @Override - public void onFileChosen(FileHandle file) { - } - - @Override - public void onCancellation() { - } - - @Override - public void onError(Exception exception) { - } - - static NativeFileChooserCallbackAdapter onFileChosen(Consumer eater) { - return new NativeFileChooserCallbackAdapter() { - @Override - public void onFileChosen(FileHandle file) { - eater.accept(file); - } - }; - } - } -} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/AbstractScreenDesktop.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/AbstractScreenDesktop.java new file mode 100644 index 00000000..cd36b07a --- /dev/null +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/AbstractScreenDesktop.java @@ -0,0 +1,116 @@ +package love.distributedrebirth.gdxapp.screen; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.ScreenAdapter; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.graphics.PerspectiveCamera; +import com.badlogic.gdx.graphics.g3d.ModelBatch; +import com.badlogic.gdx.graphics.g3d.ModelInstance; +import com.badlogic.gdx.graphics.g3d.utils.FirstPersonCameraController; +import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; +import com.badlogic.gdx.utils.Array; + +import love.distributedrebirth.gdxapp.GDXAppScreen; +import love.distributedrebirth.gdxapp.desktop.DeskApp; +import love.distributedrebirth.gdxapp.desktop.DeskAppScreen; +import love.distributedrebirth.gdxapp.desktop.DeskAppScreenListener; +import love.distributedrebirth.gdxapp.desktop.FilteringInputProcessor; + +public abstract class AbstractScreenDesktop extends ScreenAdapter implements GDXAppScreen { + + private final DeskAppScreen deskAppScreen; + private PerspectiveCamera cam; + private FirstPersonCameraController camController; + private FilteringInputProcessor inputFilter; + private ModelBatch modelBatch; + private Array modelInstances = new Array(); + + public AbstractScreenDesktop(String name) { + this.create(); + deskAppScreen = new DeskAppScreen(name); + deskAppScreen.addDeskAppListener(new DeskAppScreenListener() { + + @Override + public void selectDeskApp(DeskApp deskApp) { + if (deskApp == null) { + inputFilter.setFiltering(false); + } else { + inputFilter.setFiltering(true); + } + } + }); + } + + protected void createModel(ModelBuilder modelBuilder, Array modelInstances) { + + } + + private void create() { + modelBatch = new ModelBatch(); + + cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); + cam.position.set(10f, 10f, 10f); + cam.lookAt(0, 0, 0); + cam.near = 1f; + cam.far = 300f; + cam.update(); + + ModelBuilder modelBuilder = new ModelBuilder(); + createModel(modelBuilder, modelInstances); + + camController = new FirstPersonCameraController(cam); + //camController = new CameraInputController(cam); + + inputFilter = new FilteringInputProcessor(camController); + } + + @Override + public final void show() { + Gdx.input.setInputProcessor(inputFilter); + showDesktop(); + } + + protected void showDesktop() { + } + + @Override + public final void hide() { + Gdx.input.setInputProcessor(null); + hideDesktop(); + } + + protected void hideDesktop() { + } + + @Override + public final void dispose() { + modelBatch.dispose(); + disposeDesktop(); + } + + protected void disposeDesktop() { + } + + @Override + public final void render(float delta) { + camController.update(); + + Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight()); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); + + renderDesktop(delta, modelBatch, cam, modelInstances); + } + + protected void renderDesktop(float delta, ModelBatch modelBatch, PerspectiveCamera cam, Array modelInstances) { + modelBatch.begin(cam); + for (ModelInstance instance : modelInstances) { + modelBatch.render(instance); + } + modelBatch.end(); + } + + @Override + public DeskAppScreen getDeskAppScreen() { + return deskAppScreen; + } +} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/BasicConsoleRenderer.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/BasicConsoleRenderer.java deleted file mode 100644 index c840d66c..00000000 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/BasicConsoleRenderer.java +++ /dev/null @@ -1,32 +0,0 @@ -package love.distributedrebirth.gdxapp.screen; - -import imgui.ImGui; -import imgui.flag.ImGuiCond; -import imgui.type.ImBoolean; -import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; -import love.distributedrebirth.gdxapp.GDXAppMain; -import love.distributedrebirth.gdxapp.ImGuiRendererMain; - -@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -public class BasicConsoleRenderer extends ImGuiRendererMain { - - public BasicConsoleRenderer(GDXAppMain main) { - super(main); - } - - @Override - public void render(ImBoolean widgetOpen) { - ImGui.setNextWindowPos(300, 300, ImGuiCond.FirstUseEver); - ImGui.setNextWindowSize(320, 240, ImGuiCond.FirstUseEver); - if (ImGui.begin("The BASIC Shahada of DUNE", widgetOpen)) { - ImGui.text("10 PRINT \"THERE IS NO GOD BUT @Ω仙⁴\""); - ImGui.text("20 PRINT \"THERE IS NO RULE BUT CONSENT\""); - ImGui.text("30 PRINT \"THERE IS NO FAILURE BUT DEATH\""); - ImGui.text("40 PRINT \"TERRY A. DAVIS WAS THE PROPHET OF @Ω仙9⁴\""); - ImGui.text("50 PRINT \"TERRY A. DAVIS WAS THE FIRST TRUE MENTAT\""); - ImGui.text("60 PRINT \"TERRY A. DAVIS WAS THE BEST CODER ALIVE\""); - ImGui.text("RUN"); - } - ImGui.end(); - } -} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/HebrewWalletRenderer.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/HebrewWalletRenderer.java deleted file mode 100644 index 244560f8..00000000 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/HebrewWalletRenderer.java +++ /dev/null @@ -1,60 +0,0 @@ -package love.distributedrebirth.gdxapp.screen; - -import imgui.ImGui; -import imgui.flag.ImGuiCond; -import imgui.flag.ImGuiTableFlags; -import imgui.type.ImBoolean; -import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; -import love.distributedrebirth.gdxapp.GDXAppMain; -import love.distributedrebirth.gdxapp.ImGuiRendererMain; -import love.distributedrebirth.numberxd.Gê̄ldGetậl; - -@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -public class HebrewWalletRenderer extends ImGuiRendererMain { - - public HebrewWalletRenderer(GDXAppMain main) { - super(main); - } - - @Override - public void render(ImBoolean widgetOpen) { - ImGui.setNextWindowPos(200, 200, ImGuiCond.FirstUseEver); - ImGui.setNextWindowSize(640, 480, ImGuiCond.FirstUseEver); - if (ImGui.begin("Hebrew Wallet", widgetOpen)) { - ImGui.text("Current amount:"); - ImGui.sameLine(); - ImGui.text("0000"); - ImGui.separator(); - if (ImGui.button("Pay")) { - } - int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV; - ImGui.beginTable("wallet", 4, flags); - ImGui.tableSetupColumn("In/Out"); - ImGui.tableSetupColumn("AmountRaw"); - ImGui.tableSetupColumn("AmountFix"); - ImGui.tableSetupColumn("Decimal"); - ImGui.tableHeadersRow(); - - String[] walletData = { - "ה","מ","מָ","ח","חֱ","חֱ‎מָא", - "א","בד","ב","ד","ץףן", - "הזפץ","מספר","צצצצ","ץאאא","דואר" - }; - for (String data:walletData) { - Gê̄ldGetậl geld = new Gê̄ldGetậl(data); - Gê̄ldGetậl geld2 = geld.toClone(); // unit test - ImGui.tableNextRow(); - ImGui.tableNextColumn(); - ImGui.text(data.length()==2||data.length()==3?"OUT":"IN"); - ImGui.tableNextColumn(); - ImGui.text(data); - ImGui.tableNextColumn(); - ImGui.text(geld2.toHebrewString(true)); // true=reverse for ImGui - ImGui.tableNextColumn(); - ImGui.text(Double.toString(geld.getTotalDecimalValue())); - } - ImGui.endTable(); - } - ImGui.end(); - } -} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenCredits.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenCredits.java index 2dabc892..5fa5294a 100644 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenCredits.java +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenCredits.java @@ -74,7 +74,7 @@ public class ScreenCredits extends AbstractScrollScreen { @Override protected Class getNextScreen(GDXAppMain main) { - return ScreenDefault.class; + return ScreenDesktop0.class; } @Override diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDefault.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDesktop0.java similarity index 65% rename from main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDefault.java rename to main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDesktop0.java index 3a7fc481..8574816e 100644 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDefault.java +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDesktop0.java @@ -6,14 +6,18 @@ import com.badlogic.gdx.graphics.Texture; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.gdxapp.GDXAppMain; +import love.distributedrebirth.gdxapp.GDXAppScreen; +import love.distributedrebirth.gdxapp.desktop.DeskAppScreen; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -public class ScreenDefault extends ScreenAdapter { +public class ScreenDesktop0 extends ScreenAdapter implements GDXAppScreen { private final GDXAppMain main; + private DeskAppScreen deskAppScreen; private Texture backgroundImage; - public ScreenDefault(final GDXAppMain main) { + public ScreenDesktop0(final GDXAppMain main) { this.main = main; + deskAppScreen = new DeskAppScreen("Desktop0"); backgroundImage = new Texture(Gdx.files.internal("background/terrydavis-front.png")); } @@ -28,4 +32,9 @@ public class ScreenDefault extends ScreenAdapter { public void dispose() { backgroundImage.dispose(); } + + @Override + public DeskAppScreen getDeskAppScreen() { + return deskAppScreen; + } } diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDesktop1.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDesktop1.java new file mode 100644 index 00000000..84a83a9e --- /dev/null +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDesktop1.java @@ -0,0 +1,40 @@ +package love.distributedrebirth.gdxapp.screen; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.ScreenAdapter; +import com.badlogic.gdx.graphics.Texture; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; +import love.distributedrebirth.gdxapp.GDXAppMain; +import love.distributedrebirth.gdxapp.GDXAppScreen; +import love.distributedrebirth.gdxapp.desktop.DeskAppScreen; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class ScreenDesktop1 extends ScreenAdapter implements GDXAppScreen { + private final GDXAppMain main; + private DeskAppScreen deskAppScreen; + private Texture backgroundImage; + + public ScreenDesktop1(final GDXAppMain main) { + this.main = main; + deskAppScreen = new DeskAppScreen("Desktop1"); + backgroundImage = new Texture(Gdx.files.internal("background/terrydavis-nose.png")); + } + + @Override + public void render(float delta) { + main.batch.begin(); + main.batch.draw(backgroundImage, 0, 0, main.viewWidth, main.viewHeight); + main.batch.end(); + } + + @Override + public void dispose() { + backgroundImage.dispose(); + } + + @Override + public DeskAppScreen getDeskAppScreen() { + return deskAppScreen; + } +} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDesktop2.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDesktop2.java new file mode 100644 index 00000000..c2126ef0 --- /dev/null +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDesktop2.java @@ -0,0 +1,30 @@ +package love.distributedrebirth.gdxapp.screen; + +import com.badlogic.gdx.graphics.VertexAttributes.Usage; +import com.badlogic.gdx.graphics.g3d.Material; +import com.badlogic.gdx.graphics.g3d.Model; +import com.badlogic.gdx.graphics.g3d.ModelInstance; +import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; +import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; +import com.badlogic.gdx.utils.Array; + +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class ScreenDesktop2 extends AbstractScreenDesktop { + private Model grid; + + public ScreenDesktop2() { + super("Desktop2"); + } + + protected void createModel(ModelBuilder modelBuilder, Array modelInstances) { + grid = modelBuilder.createLineGrid(33, 33, 1f, 1f, new Material(ColorAttribute.createDiffuse(1f,1f,1f,.1f)), Usage.Position | Usage.Normal); + modelInstances.add(new ModelInstance(grid, 0, 0, 0)); + } + + @Override + protected void disposeDesktop() { + grid.dispose(); + } +} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/matrix4d/ScreenMatrix4D.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDesktop3.java similarity index 63% rename from main-gdxapp/src/main/love/distributedrebirth/gdxapp/matrix4d/ScreenMatrix4D.java rename to main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDesktop3.java index 6d298ce3..e188a8d2 100644 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/matrix4d/ScreenMatrix4D.java +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenDesktop3.java @@ -1,21 +1,17 @@ -package love.distributedrebirth.gdxapp.matrix4d; +package love.distributedrebirth.gdxapp.screen; import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.PerspectiveCamera; import com.badlogic.gdx.graphics.VertexAttributes.Usage; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.BitmapFontCache; import com.badlogic.gdx.graphics.g2d.SpriteBatch; -import com.badlogic.gdx.graphics.g3d.Environment; import com.badlogic.gdx.graphics.g3d.Material; import com.badlogic.gdx.graphics.g3d.Model; import com.badlogic.gdx.graphics.g3d.ModelBatch; import com.badlogic.gdx.graphics.g3d.ModelInstance; import com.badlogic.gdx.graphics.g3d.Shader; import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; -import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight; -import com.badlogic.gdx.graphics.g3d.utils.FirstPersonCameraController; import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; import com.badlogic.gdx.math.Matrix4; import com.badlogic.gdx.math.Vector3; @@ -23,160 +19,59 @@ import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.viewport.ScreenViewport; -import imgui.ImGui; -import imgui.flag.ImGuiCond; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; -import love.distributedrebirth.gdxapp.GDXAppMain; -import love.distributedrebirth.gdxapp.GDXAppMainAdapter; @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -public class ScreenMatrix4D extends GDXAppMainAdapter { - public Environment environment; - public PerspectiveCamera cam; - public FirstPersonCameraController camController; - public Shader shader; - public ModelBatch modelBatch; +public class ScreenDesktop3 extends AbstractScreenDesktop { + private final Shader shader; + private final BitmapFont font; + private final BitmapFontCache fontCache; + private final ScreenViewport uiViewport = new ScreenViewport(); + private final SpriteBatch spriteBatch; + private final Vector3 textPosition = new Vector3(6.5f, 10.5f, 5.5f); private Model grid; private Model model; - public Array modelInstances = new Array(); - //endregion - - //region Text rendering - public BitmapFont font; - public BitmapFontCache fontCache; - - public final ScreenViewport uiViewport = new ScreenViewport(); - public SpriteBatch spriteBatch; - - /** World-space position of the text. (Corner of the cube.) */ - public Vector3 textPosition = new Vector3(6.5f, 10.5f, 5.5f); - //endregion - private float colorDeltaTime = 0f; private float colorFade = 0f; private boolean colorPositive = true; - public ScreenMatrix4D(final GDXAppMain main) { - super(main); - this.create(); - } - - private void create() { - //region 3D Objects - environment = new Environment(); - environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f)); - environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f)); - - modelBatch = new ModelBatch(); - - cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); - cam.position.set(10f, 10f, 10f); - cam.lookAt(0, 0, 0); - cam.near = 1f; - cam.far = 300f; - cam.update(); - - ModelBuilder modelBuilder = new ModelBuilder(); - - grid = modelBuilder.createLineGrid(33, 33, 1f, 1f, new Material(ColorAttribute.createDiffuse(1f,1f,1f,.1f)), Usage.Position | Usage.Normal); - model = modelBuilder.createBox(.3f, .3f, .3f,new Material(ColorAttribute.createDiffuse(.1f,.1f,.1f,0f)), Usage.Position | Usage.Normal); - - for (int x = -4; x < 6; x++) { - for (int y = 1; y < 11; y++) { - for (int z = -4; z < 7; z++) { - ModelInstance instance = new ModelInstance(model, x, y, z); - modelInstances.add(instance); - } - } - } - - ModelInstance instance = new ModelInstance(grid, 0, 0, 0); - modelInstances.add(instance); - + public ScreenDesktop3() { + super("Desktop3"); shader = new UserColorShader(); shader.init(); - camController = new FirstPersonCameraController(cam); - //camController = new CameraInputController(cam); - Gdx.input.setInputProcessor(camController); - //endregion - - //region Text rendering font = new BitmapFont(); fontCache = new BitmapFontCache(font, false); spriteBatch = new SpriteBatch(); - //endregion } - /** - * Multiply 4x4 matrix {@code m} and 4D vector {$code (v, vW)} together. - * Store result {@code (x/w, y/w, z/w)} back in {@code v} and return {@code w}. - */ - private static float multiplyProjective(Matrix4 m, Vector3 v, float vW) { - final float[] mat = m.val; - final float x = v.x * mat[Matrix4.M00] + v.y * mat[Matrix4.M01] + v.z * mat[Matrix4.M02] + vW * mat[Matrix4.M03]; - final float y = v.x * mat[Matrix4.M10] + v.y * mat[Matrix4.M11] + v.z * mat[Matrix4.M12] + vW * mat[Matrix4.M13]; - final float z = v.x * mat[Matrix4.M20] + v.y * mat[Matrix4.M21] + v.z * mat[Matrix4.M22] + vW * mat[Matrix4.M23]; - final float w = v.x * mat[Matrix4.M30] + v.y * mat[Matrix4.M31] + v.z * mat[Matrix4.M32] + vW * mat[Matrix4.M33]; - final float iw = 1f / w; - v.set(x * iw, y * iw, z * iw); - return w; - } - - @Override - public void render(float delta) { - colorDeltaTime += delta; - if (colorDeltaTime > 0.04f) { - colorDeltaTime = 0f; - if (colorPositive) { - colorFade += delta; - } else { - colorFade -= delta; - } - if (colorFade > 1f) { - colorPositive = false; - } else if (colorFade < .5f) { - colorPositive = true; - } - } - - int i=0; + protected void createModel(ModelBuilder modelBuilder, Array modelInstances) { + model = modelBuilder.createBox(.3f, .3f, .3f,new Material(ColorAttribute.createDiffuse(.1f,.1f,.1f,0f)), Usage.Position | Usage.Normal); for (int x = -4; x < 6; x++) { for (int y = 1; y < 11; y++) { for (int z = -4; z < 7; z++) { - float red = .1f; - float green = (y+2f)/10f*colorFade; - float blue = .1f; - if (x == 3 || y == 1 || z == -1) { - red = (y+2f)/10f*colorFade; - green = 0f; - } - if (x == -1 || y == 10 || z == 5) { - green = 0f; - blue = (y+2f)/10f*colorFade; - } - - ModelInstance instance = modelInstances.get(i++); - ColorAttribute attr = ColorAttribute.createDiffuse(red, green, blue, 1f); - instance.materials.get(0).set(attr); + modelInstances.add(new ModelInstance(model, x, y, z)); } } } + grid = modelBuilder.createLineGrid(33, 33, 1f, 1f, new Material(ColorAttribute.createDiffuse(1f,1f,1f,.1f)), Usage.Position | Usage.Normal); + modelInstances.add(new ModelInstance(grid, 0, 0, 0)); + } + + @Override + protected void disposeDesktop() { + grid.dispose(); + model.dispose(); + } + + protected void renderDesktop(float delta, ModelBatch modelBatch, PerspectiveCamera cam, Array modelInstances) { + colorFade(delta, modelInstances); - //region 3D Objects - camController.update(); - - Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight()); - Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); - modelBatch.begin(cam); for (ModelInstance instance : modelInstances) { modelBatch.render(instance, shader); } modelBatch.end(); - //endregion - - //region Text rendering - + // Multiply vector with world-space position with 3D projection-view matrix final Vector3 clipSpacePos = new Vector3(textPosition); final float w = multiplyProjective(cam.combined, clipSpacePos, 1f); @@ -215,29 +110,60 @@ public class ScreenMatrix4D extends GDXAppMainAdapter { fontCache.draw(spriteBatch); spriteBatch.end(); } - //endregion - - - ImGui.setNextWindowPos(300, 300, ImGuiCond.FirstUseEver); - ImGui.setNextWindowSize(320, 240, ImGuiCond.FirstUseEver); - ImGui.begin("Legends"); - - ImGui.text("ComputerNode: XCV 330"); - ImGui.text("ComputerMatrix: 100 crew and 850 passengers"); - ImGui.separator(); - ImGui.textColored(255, 1, 1, 255, "Red is absolute line."); - ImGui.textColored(10, 1, 255, 255, "Blue is absolute line."); - ImGui.textColored(255, 1, 255, 255, "Pink is absolute node."); - ImGui.textColored(1, 255, 1, 255, "Green is relative node."); - ImGui.textColored(200, 200, 5, 255, "Yellow is I/O node."); - ImGui.textColored(1, 1, 1, 255, "White is dipavali route."); - ImGui.end(); } - @Override - public void dispose() { - shader.dispose(); - modelBatch.dispose(); - model.dispose(); + /** + * Multiply 4x4 matrix {@code m} and 4D vector {$code (v, vW)} together. + * Store result {@code (x/w, y/w, z/w)} back in {@code v} and return {@code w}. + */ + private static float multiplyProjective(Matrix4 m, Vector3 v, float vW) { + final float[] mat = m.val; + final float x = v.x * mat[Matrix4.M00] + v.y * mat[Matrix4.M01] + v.z * mat[Matrix4.M02] + vW * mat[Matrix4.M03]; + final float y = v.x * mat[Matrix4.M10] + v.y * mat[Matrix4.M11] + v.z * mat[Matrix4.M12] + vW * mat[Matrix4.M13]; + final float z = v.x * mat[Matrix4.M20] + v.y * mat[Matrix4.M21] + v.z * mat[Matrix4.M22] + vW * mat[Matrix4.M23]; + final float w = v.x * mat[Matrix4.M30] + v.y * mat[Matrix4.M31] + v.z * mat[Matrix4.M32] + vW * mat[Matrix4.M33]; + final float iw = 1f / w; + v.set(x * iw, y * iw, z * iw); + return w; + } + + private void colorFade(float delta, Array modelInstances) { + colorDeltaTime += delta; + if (colorDeltaTime > 0.04f) { + colorDeltaTime = 0f; + if (colorPositive) { + colorFade += delta; + } else { + colorFade -= delta; + } + if (colorFade > 1f) { + colorPositive = false; + } else if (colorFade < .5f) { + colorPositive = true; + } + } + + int i=0; + for (int x = -4; x < 6; x++) { + for (int y = 1; y < 11; y++) { + for (int z = -4; z < 7; z++) { + float red = .1f; + float green = (y+2f)/10f*colorFade; + float blue = .1f; + if (x == 3 || y == 1 || z == -1) { + red = (y+2f)/10f*colorFade; + green = 0f; + } + if (x == -1 || y == 10 || z == 5) { + green = 0f; + blue = (y+2f)/10f*colorFade; + } + + ModelInstance instance = modelInstances.get(i++); + ColorAttribute attr = ColorAttribute.createDiffuse(red, green, blue, 1f); + instance.materials.get(0).set(attr); + } + } + } } } diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenHelp.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenHelp.java index 8fcd27c7..58fd2804 100644 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenHelp.java +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenHelp.java @@ -57,7 +57,7 @@ public class ScreenHelp extends AbstractScrollScreen { @Override protected Class getNextScreen(GDXAppMain main) { - return ScreenDefault.class; + return ScreenDesktop0.class; } @Override diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenIntroMission.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenIntroMission.java index 227679d6..7dd01a16 100644 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenIntroMission.java +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenIntroMission.java @@ -67,7 +67,7 @@ public class ScreenIntroMission extends AbstractScrollScreen { @Override protected Class getNextScreen(GDXAppMain main) { - return ScreenDefault.class; + return ScreenDesktop0.class; } @Override diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenUnicode4D.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenUnicode4D.java deleted file mode 100644 index 5ea86176..00000000 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/ScreenUnicode4D.java +++ /dev/null @@ -1,56 +0,0 @@ -package love.distributedrebirth.gdxapp.screen; - -import imgui.ImColor; -import imgui.ImDrawList; -import imgui.ImGui; -import imgui.ImVec2; -import imgui.flag.ImGuiCond; -import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; -import love.distributedrebirth.gdxapp.GDXAppMain; -import love.distributedrebirth.gdxapp.GDXAppMainAdapter; - -@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -public class ScreenUnicode4D extends GDXAppMainAdapter { - - public ScreenUnicode4D(final GDXAppMain main) { - super(main); - } - - @Override - public void render(float delta) { - main.batch.begin(); - main.font.draw(main.batch, "Tap anywhere to begin!", main.viewWidth/2 - 73, 33); - main.batch.end(); - - ImGui.setNextWindowPos(400, 200, ImGuiCond.FirstUseEver); - ImGui.setNextWindowSize(320, 240, ImGuiCond.FirstUseEver); - if (ImGui.begin("Unicode4D test")) { - 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)); - - drawList.popClipRect(); - } - ImGui.end(); - - //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/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/SystemBaseGlyphRenderer.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/SystemBaseGlyphRenderer.java deleted file mode 100644 index b3f2cf2b..00000000 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/SystemBaseGlyphRenderer.java +++ /dev/null @@ -1,66 +0,0 @@ -package love.distributedrebirth.gdxapp.screen; - -import imgui.ImGui; -import imgui.flag.ImGuiCond; -import imgui.flag.ImGuiTableFlags; -import imgui.type.ImBoolean; -import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; -import love.distributedrebirth.gdxapp.GDXAppMain; -import love.distributedrebirth.gdxapp.ImGuiRendererMain; -import love.distributedrebirth.numberxd.glyph.BaseGlyphSet; - -@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -public class SystemBaseGlyphRenderer extends ImGuiRendererMain { - - public SystemBaseGlyphRenderer(GDXAppMain main) { - super(main); - } - - @Override - public void render(ImBoolean widgetOpen) { - ImGui.setNextWindowPos(200, 200, ImGuiCond.FirstUseEver); - ImGui.setNextWindowSize(640, 480, ImGuiCond.FirstUseEver); - if (ImGui.begin("Base Glyph Set", widgetOpen)) { - - int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV; - ImGui.beginTable("base-part", 3, flags); - ImGui.tableSetupColumn("Script"); - ImGui.tableSetupColumn("10Numbers"); - ImGui.tableSetupColumn("16Numbers"); - ImGui.tableHeadersRow(); - - for (BaseGlyphSet set:BaseGlyphSet.values()) { - ImGui.tableNextRow(); - ImGui.tableNextColumn(); - ImGui.text(set.BȍőnNaam()); - ImGui.tableNextColumn(); - ImGui.text(print10Numbers(set)); - ImGui.tableNextColumn(); - ImGui.text(print16Numbers(set)); - } - - ImGui.endTable(); - } - ImGui.end(); - } - - private String print10Numbers(BaseGlyphSet set) { - StringBuilder buf = new StringBuilder(); - for (int i=0;i<10;i++) { - buf.append(set.BȍőnNumber10().BȍőnCharFor(i)); - buf.append(set.BȍőnNumber10().BȍőnCharSeperator()); - } - return buf.toString(); - } - - private String print16Numbers(BaseGlyphSet set) { - StringBuilder buf = new StringBuilder(); - int x=240; - for (int i=0;i<16;i++) { - buf.append(set.BȍőnPrintNumber16(i + x, 99)); - buf.append(" "); - x = x - 16; - } - return buf.toString(); - } -} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/SystemBasePartRenderer.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/SystemBasePartRenderer.java deleted file mode 100644 index eec4254d..00000000 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/SystemBasePartRenderer.java +++ /dev/null @@ -1,149 +0,0 @@ -package love.distributedrebirth.gdxapp.screen; - -import java.util.ArrayList; -import java.util.List; - -import imgui.ImGui; -import imgui.flag.ImGuiCond; -import imgui.flag.ImGuiTableFlags; -import imgui.type.ImBoolean; -import imgui.type.ImInt; -import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; -import love.distributedrebirth.gdxapp.GDXAppMain; -import love.distributedrebirth.gdxapp.ImGuiRendererMain; -import love.distributedrebirth.numberxd.base2t.Base2PartsFactory; -import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartAlt1ʸᴰ; -import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartAlt2ʸᴰ; -import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartAlt3ʸᴰ; -import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartAlt4ʸᴰ; -import love.distributedrebirth.numberxd.base2t.part.BãßBȍőnPartʸᴰ; -import love.distributedrebirth.numberxd.glyph.BaseGlyphSet; - -@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") -public class SystemBasePartRenderer extends ImGuiRendererMain { - - private ImInt selectedBasePart = new ImInt(); - - public SystemBasePartRenderer(GDXAppMain main) { - super(main); - } - - @Override - public void render(ImBoolean widgetOpen) { - ImGui.setNextWindowPos(200, 200, ImGuiCond.FirstUseEver); - ImGui.setNextWindowSize(640, 480, ImGuiCond.FirstUseEver); - if (ImGui.begin("Base part", widgetOpen)) { - - List bases = new ArrayList<>(); - for (int base:Base2PartsFactory.INSTANCE.BãßBases()) { - bases.add(Integer.toString(base)); - } - String[] items = new String[bases.size()]; - items = bases.toArray(items); - String selectedItem = items[selectedBasePart.get()]; - Integer baseNumber = Integer.valueOf(selectedItem); - BãßBȍőnPartʸᴰ[] baseParts = Base2PartsFactory.INSTANCE.BãßBuildPartsByBase(baseNumber); - - ImGui.combo("Base", selectedBasePart, items); - - ImGui.text("Name:"); - ImGui.sameLine(); - ImGui.text(baseParts[0].BãßClassNaam()); - - ImGui.text("Purpose:"); - ImGui.sameLine(); - ImGui.text(baseParts[0].BãßClassPurpose()); - - int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV; - ImGui.beginTable("base-part", 21, flags); - ImGui.tableSetupColumn("BȍőnNaam"); - ImGui.tableSetupColumn("TelNul"); - ImGui.tableSetupColumn("TelEen"); - ImGui.tableSetupColumn("Tone"); - ImGui.tableSetupColumn("10Tone"); - ImGui.tableSetupColumn("10Kor"); - ImGui.tableSetupColumn("10DTMF"); - ImGui.tableSetupColumn("16Tone"); - ImGui.tableSetupColumn("16Kor"); - ImGui.tableSetupColumn("16LatB"); - ImGui.tableSetupColumn("36Tone"); - ImGui.tableSetupColumn("36Kor"); - ImGui.tableSetupColumn("36LatB"); - ImGui.tableSetupColumn("36Gre"); - ImGui.tableSetupColumn("36Heb"); - ImGui.tableSetupColumn("prcK"); - ImGui.tableSetupColumn("prcV"); - ImGui.tableSetupColumn("Alt1"); - ImGui.tableSetupColumn("Alt2"); - ImGui.tableSetupColumn("Alt3"); - ImGui.tableSetupColumn("Alt4"); - ImGui.tableHeadersRow(); - - for (BãßBȍőnPartʸᴰ part:baseParts) { - ImGui.tableNextRow(); - ImGui.tableNextColumn(); - ImGui.text(part.BȍőnNaam()); - ImGui.tableNextColumn(); - ImGui.text(Integer.toString(part.BȍőnRangTelNul())); - ImGui.tableNextColumn(); - ImGui.text(Integer.toString(part.BȍőnRangTelEen())); - ImGui.tableNextColumn(); - ImGui.text(part.BȍőnDialTone()); - ImGui.tableNextColumn(); - ImGui.text(part.BȍőnPrintGlyphSetNumber10(BaseGlyphSet.TONE_SCRIPT)); - ImGui.tableNextColumn(); - ImGui.text(part.BȍőnPrintGlyphSetNumber10(BaseGlyphSet.KOREAN)); - ImGui.tableNextColumn(); - ImGui.text(part.BȍőnPrintGlyphSetNumber10(BaseGlyphSet.LATIN_DTMF)); - ImGui.tableNextColumn(); - ImGui.text(part.BȍőnPrintGlyphSetNumber16(BaseGlyphSet.TONE_SCRIPT)); - ImGui.tableNextColumn(); - ImGui.text(part.BȍőnPrintGlyphSetNumber16(BaseGlyphSet.KOREAN)); - ImGui.tableNextColumn(); - ImGui.text(part.BȍőnPrintGlyphSetNumber16(BaseGlyphSet.LATIN_BASIC)); - ImGui.tableNextColumn(); - ImGui.text(part.BȍőnPrintGlyphSetNumber27(BaseGlyphSet.TONE_SCRIPT)); - ImGui.tableNextColumn(); - ImGui.text(part.BȍőnPrintGlyphSetNumber27(BaseGlyphSet.KOREAN)); - ImGui.tableNextColumn(); - ImGui.text(part.BȍőnPrintGlyphSetNumber27(BaseGlyphSet.LATIN_BASIC)); - ImGui.tableNextColumn(); - ImGui.text(part.BȍőnPrintGlyphSetNumber27(BaseGlyphSet.GREEK)); - ImGui.tableNextColumn(); - ImGui.text(part.BȍőnPrintGlyphSetNumber27(BaseGlyphSet.HEBREW)); - ImGui.tableNextColumn(); - ImGui.text(part.BȍőnChinaKey()); - ImGui.tableNextColumn(); - ImGui.text(part.BȍőnChinaValue()); - - ImGui.tableNextColumn(); - if (part instanceof BãßBȍőnPartAlt1ʸᴰ) { - ImGui.text(BãßBȍőnPartAlt1ʸᴰ.class.cast(part).BȍőnAlt1Value()); - } else { - ImGui.text(""); - } - ImGui.tableNextColumn(); - if (part instanceof BãßBȍőnPartAlt2ʸᴰ) { - ImGui.text(BãßBȍőnPartAlt2ʸᴰ.class.cast(part).BȍőnAlt2Value()); - } else { - ImGui.text(""); - } - ImGui.tableNextColumn(); - if (part instanceof BãßBȍőnPartAlt3ʸᴰ) { - ImGui.text(BãßBȍőnPartAlt3ʸᴰ.class.cast(part).BȍőnAlt3Value()); - } else { - ImGui.text(""); - } - ImGui.tableNextColumn(); - if (part instanceof BãßBȍőnPartAlt4ʸᴰ) { - ImGui.text(BãßBȍőnPartAlt4ʸᴰ.class.cast(part).BȍőnAlt4Value()); - } else { - ImGui.text(""); - } - } - - ImGui.endTable(); - } - ImGui.end(); - } -} diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/matrix4d/UserColorShader.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/UserColorShader.java similarity index 97% rename from main-gdxapp/src/main/love/distributedrebirth/gdxapp/matrix4d/UserColorShader.java rename to main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/UserColorShader.java index f4c13216..6e80d8b4 100644 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/matrix4d/UserColorShader.java +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/screen/UserColorShader.java @@ -1,4 +1,4 @@ -package love.distributedrebirth.gdxapp.matrix4d; +package love.distributedrebirth.gdxapp.screen; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Camera;