From cb03208ac15707e4957240c144ba908ab416df36 Mon Sep 17 00:00:00 2001 From: Willem Cazander Date: Thu, 10 Mar 2022 01:31:31 +0100 Subject: [PATCH] Fixed imgui demo screen --- .../app/calculator/CalculatorComponent.java | 2 +- .../app/hewallet/HeWalletComponent.java | 2 +- .../gdxapp4d/app/tosamp/TosAmpComponent.java | 2 +- .../vrgem4/screen/AbstractScreenDesktop.java | 5 ---- .../vrgem4/view/DeskTopScreenMenu.java | 3 -- .../gdxapp4d/vrsys5/VrSys5Component.java | 9 ++++-- .../gdxapp4d/vrsys5/apps/ImGuiDeskApp.java | 30 +++++++++++++++++++ 7 files changed, 40 insertions(+), 13 deletions(-) create mode 100644 gdxapp4d-vrsys5/src/main/java/love/distributedrebirth/gdxapp4d/vrsys5/apps/ImGuiDeskApp.java diff --git a/gdxapp4d-app-calculator/src/main/java/love/distributedrebirth/gdxapp4d/app/calculator/CalculatorComponent.java b/gdxapp4d-app-calculator/src/main/java/love/distributedrebirth/gdxapp4d/app/calculator/CalculatorComponent.java index 01452293..a87485d5 100644 --- a/gdxapp4d-app-calculator/src/main/java/love/distributedrebirth/gdxapp4d/app/calculator/CalculatorComponent.java +++ b/gdxapp4d-app-calculator/src/main/java/love/distributedrebirth/gdxapp4d/app/calculator/CalculatorComponent.java @@ -34,6 +34,6 @@ public class CalculatorComponent { @Deactivate void close() { log.debug(this, SystemGdxLog.DEACTIVATE); - deskAppService.installDeskApp(DeskAppMenuSection.PROGRAMMING, launcher); + deskAppService.removeDeskApp(DeskAppMenuSection.PROGRAMMING, launcher); } } diff --git a/gdxapp4d-app-hewallet/src/main/java/love/distributedrebirth/gdxapp4d/app/hewallet/HeWalletComponent.java b/gdxapp4d-app-hewallet/src/main/java/love/distributedrebirth/gdxapp4d/app/hewallet/HeWalletComponent.java index 5eb4b70a..c4e27133 100644 --- a/gdxapp4d-app-hewallet/src/main/java/love/distributedrebirth/gdxapp4d/app/hewallet/HeWalletComponent.java +++ b/gdxapp4d-app-hewallet/src/main/java/love/distributedrebirth/gdxapp4d/app/hewallet/HeWalletComponent.java @@ -34,6 +34,6 @@ public class HeWalletComponent { @Deactivate void close() { log.debug(this, SystemGdxLog.DEACTIVATE); - deskAppService.installDeskApp(DeskAppMenuSection.INTERNET, launcher); + deskAppService.removeDeskApp(DeskAppMenuSection.INTERNET, launcher); } } diff --git a/gdxapp4d-app-tosamp/src/main/java/love/distributedrebirth/gdxapp4d/app/tosamp/TosAmpComponent.java b/gdxapp4d-app-tosamp/src/main/java/love/distributedrebirth/gdxapp4d/app/tosamp/TosAmpComponent.java index 0dd89dde..9b23e0a4 100644 --- a/gdxapp4d-app-tosamp/src/main/java/love/distributedrebirth/gdxapp4d/app/tosamp/TosAmpComponent.java +++ b/gdxapp4d-app-tosamp/src/main/java/love/distributedrebirth/gdxapp4d/app/tosamp/TosAmpComponent.java @@ -38,6 +38,6 @@ public class TosAmpComponent { @Deactivate void close() { log.debug(this, SystemGdxLog.DEACTIVATE); - deskAppService.installDeskApp(DeskAppMenuSection.MULTIMEDIA, launcher); + deskAppService.removeDeskApp(DeskAppMenuSection.MULTIMEDIA, launcher); } } diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/AbstractScreenDesktop.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/AbstractScreenDesktop.java index c3400b3d..55adc2e4 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/AbstractScreenDesktop.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/screen/AbstractScreenDesktop.java @@ -16,7 +16,6 @@ import com.badlogic.gdx.utils.ScreenUtils; import imgui.ImGui; import imgui.flag.ImGuiCond; import imgui.flag.ImGuiWindowFlags; -import imgui.type.ImBoolean; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxTerminal; import love.distributedrebirth.gdxapp4d.vrgem4.ImGuiSetup; @@ -35,7 +34,6 @@ public abstract class AbstractScreenDesktop extends ScreenAdapter implements Des protected SpriteBatch batch; protected BitmapFont font; protected OrthographicCamera camera; - protected ImBoolean showImGuiDemo = new ImBoolean(false); private final DeskTopScreenMenu screenMenu; private final DeskAppController deskAppScreen; private PerspectiveCamera cam; @@ -128,9 +126,6 @@ public abstract class AbstractScreenDesktop extends ScreenAdapter implements Des DeskTopScreen appScreen = this; screenMenu.renderMenu(appScreen); - if (showImGuiDemo.get()) { - ImGui.showDemoWindow(showImGuiDemo); - } if (appScreen != null && appScreen.getDeskAppController().getCurrentDeskApp() != null) { int sizeFlags = ImGuiCond.Always; ImGui.setNextWindowPos(0, 28, sizeFlags); diff --git a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/DeskTopScreenMenu.java b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/DeskTopScreenMenu.java index 6431231e..85273178 100644 --- a/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/DeskTopScreenMenu.java +++ b/gdxapp4d-vrgem4/src/main/java/love/distributedrebirth/gdxapp4d/vrgem4/view/DeskTopScreenMenu.java @@ -277,9 +277,6 @@ public class DeskTopScreenMenu { terminal.selectScreen(ScreenHelp.class); } ImGui.separator(); - if (ImGui.menuItem(FontAwesomeIcons.Trademark + " ImGui Demo")) { -// GDXAppVrGem4.INSTANCE.showImGuiDemo.set(true); - } if (ImGui.menuItem(FontAwesomeIcons.PowerOff + " Shutdown")) { bootArgs.shutdown(); } diff --git a/gdxapp4d-vrsys5/src/main/java/love/distributedrebirth/gdxapp4d/vrsys5/VrSys5Component.java b/gdxapp4d-vrsys5/src/main/java/love/distributedrebirth/gdxapp4d/vrsys5/VrSys5Component.java index 260aed06..98736eb3 100644 --- a/gdxapp4d-vrsys5/src/main/java/love/distributedrebirth/gdxapp4d/vrsys5/VrSys5Component.java +++ b/gdxapp4d-vrsys5/src/main/java/love/distributedrebirth/gdxapp4d/vrsys5/VrSys5Component.java @@ -12,6 +12,7 @@ import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection; import love.distributedrebirth.gdxapp4d.vrsys5.apps.BaseUnicodePlaneDeskApp; import love.distributedrebirth.gdxapp4d.vrsys5.apps.BasicConsoleDeskApp; +import love.distributedrebirth.gdxapp4d.vrsys5.apps.ImGuiDeskApp; @Component public class VrSys5Component { @@ -27,10 +28,12 @@ public class VrSys5Component { private final DeskAppLauncher basicLauncher; private final DeskAppLauncher unicodeLauncher; + private final DeskAppLauncher imguiLauncher; public VrSys5Component() { basicLauncher = new DeskAppLauncher("Basic Console", () -> new BasicConsoleDeskApp()); unicodeLauncher = new DeskAppLauncher("Base Unicode Plane", () -> new BaseUnicodePlaneDeskApp(localeService)); + imguiLauncher = new DeskAppLauncher("ImGui Demo", () -> new ImGuiDeskApp()); } @Activate @@ -38,12 +41,14 @@ public class VrSys5Component { log.debug(this, SystemGdxLog.ACTIVATE); deskAppService.installDeskApp(DeskAppMenuSection.SYSTEM, basicLauncher); deskAppService.installDeskApp(DeskAppMenuSection.SYSTEM, unicodeLauncher); + deskAppService.installDeskApp(DeskAppMenuSection.PROGRAMMING, imguiLauncher); } @Deactivate void close() { log.debug(this, SystemGdxLog.DEACTIVATE); - deskAppService.installDeskApp(DeskAppMenuSection.SYSTEM, basicLauncher); - deskAppService.installDeskApp(DeskAppMenuSection.SYSTEM, unicodeLauncher); + deskAppService.removeDeskApp(DeskAppMenuSection.SYSTEM, basicLauncher); + deskAppService.removeDeskApp(DeskAppMenuSection.SYSTEM, unicodeLauncher); + deskAppService.removeDeskApp(DeskAppMenuSection.PROGRAMMING, imguiLauncher); } } diff --git a/gdxapp4d-vrsys5/src/main/java/love/distributedrebirth/gdxapp4d/vrsys5/apps/ImGuiDeskApp.java b/gdxapp4d-vrsys5/src/main/java/love/distributedrebirth/gdxapp4d/vrsys5/apps/ImGuiDeskApp.java new file mode 100644 index 00000000..6ac37856 --- /dev/null +++ b/gdxapp4d-vrsys5/src/main/java/love/distributedrebirth/gdxapp4d/vrsys5/apps/ImGuiDeskApp.java @@ -0,0 +1,30 @@ +package love.distributedrebirth.gdxapp4d.vrsys5.apps; + +import imgui.ImGui; +import imgui.type.ImBoolean; +import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; +import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.AbstractDeskApp; +import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppContourSection; +import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppRenderer; + +@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") +public class ImGuiDeskApp extends AbstractDeskApp implements DeskAppRenderer { + + protected ImBoolean showImGuiDemo = new ImBoolean(false); + + public void create() { + getContours().setTitle("ImGui Demo"); + getContours().registrateContour(DeskAppContourSection.MAIN, this); + } + + @Override + public void render() { + ImGui.text("Display the ImGui demo window;"); + if (ImGui.button("Show")) { + showImGuiDemo.set(true); + } + if (showImGuiDemo.get()) { + ImGui.showDemoWindow(showImGuiDemo); + } + } +}