diff --git a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppMain.java b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppMain.java index 73b2d231..e21f98a0 100644 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppMain.java +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/GDXAppMain.java @@ -184,7 +184,7 @@ public enum GDXAppMain implements DefaultEnumInstanceᴶᴹˣ new SystemBasePartApp())); apps.add(new GDXAppLauncher("Hebrew Wallet", () -> new HebrewWalletApp())); apps.add(new GDXAppLauncher("Unicode4D", () -> new Unicode4DApp())); - apps.add(new GDXAppLauncher("Music Player", () -> new MusicPlayerApp(main))); + apps.add(new GDXAppLauncher("Music Player", () -> new MusicPlayerApp())); } public void renderMenu(DeskTopScreen appScreen) { @@ -184,12 +182,12 @@ public class DeskTopScreenMenu { } if (ImGui.beginMenu(infix1+"Desktop1")) { if (ImGui.menuItem("Main reality")) { - main.selectScreen(ScreenDesktop1.class); + GDXAppMain.INSTANCE.selectScreen(ScreenDesktop1.class); desktop1.getDeskAppScreen().setCurrentDeskApp(null); } for (DeskApp app: desktop1.getDeskAppScreen().getDeskApps()) { if (ImGui.menuItem(app.getTitle())) { - main.selectScreen(ScreenDesktop1.class); + GDXAppMain.INSTANCE.selectScreen(ScreenDesktop1.class); desktop1.getDeskAppScreen().setCurrentDeskApp(app); } } @@ -197,12 +195,12 @@ public class DeskTopScreenMenu { } if (ImGui.beginMenu(infix2+"Desktop2")) { if (ImGui.menuItem("Main reality")) { - main.selectScreen(ScreenDesktop2.class); + GDXAppMain.INSTANCE.selectScreen(ScreenDesktop2.class); desktop2.getDeskAppScreen().setCurrentDeskApp(null); } for (DeskApp app: desktop2.getDeskAppScreen().getDeskApps()) { if (ImGui.menuItem(app.getTitle())) { - main.selectScreen(ScreenDesktop2.class); + GDXAppMain.INSTANCE.selectScreen(ScreenDesktop2.class); desktop2.getDeskAppScreen().setCurrentDeskApp(app); } } @@ -210,12 +208,12 @@ public class DeskTopScreenMenu { } if (ImGui.beginMenu(infix3+"Desktop3")) { if (ImGui.menuItem("Main reality")) { - main.selectScreen(ScreenDesktop3.class); + GDXAppMain.INSTANCE.selectScreen(ScreenDesktop3.class); desktop3.getDeskAppScreen().setCurrentDeskApp(null); } for (DeskApp app: desktop3.getDeskAppScreen().getDeskApps()) { if (ImGui.menuItem(app.getTitle())) { - main.selectScreen(ScreenDesktop3.class); + GDXAppMain.INSTANCE.selectScreen(ScreenDesktop3.class); desktop3.getDeskAppScreen().setCurrentDeskApp(app); } } @@ -223,12 +221,12 @@ public class DeskTopScreenMenu { } if (ImGui.beginMenu(infix4+"Desktop4")) { if (ImGui.menuItem("Main reality")) { - main.selectScreen(ScreenDesktop4.class); + GDXAppMain.INSTANCE.selectScreen(ScreenDesktop4.class); desktop4.getDeskAppScreen().setCurrentDeskApp(null); } for (DeskApp app: desktop4.getDeskAppScreen().getDeskApps()) { if (ImGui.menuItem(app.getTitle())) { - main.selectScreen(ScreenDesktop4.class); + GDXAppMain.INSTANCE.selectScreen(ScreenDesktop4.class); desktop4.getDeskAppScreen().setCurrentDeskApp(app); } } @@ -248,7 +246,7 @@ public class DeskTopScreenMenu { ImGui.separator(); if (Gdx.graphics.isFullscreen()) { if (ImGui.menuItem("Window Mode")) { - Gdx.graphics.setWindowedMode(main.viewWidth, main.viewHeight); + Gdx.graphics.setWindowedMode(GDXAppMain.INSTANCE.viewWidth, GDXAppMain.INSTANCE.viewHeight); } } else { if (ImGui.menuItem("Full Screen")) { @@ -257,17 +255,17 @@ public class DeskTopScreenMenu { } ImGui.separator(); if (ImGui.menuItem("Credits")) { - main.selectScreen(ScreenCredits.class); + GDXAppMain.INSTANCE.selectScreen(ScreenCredits.class); } if (ImGui.menuItem("Help")) { - main.selectScreen(ScreenHelp.class); + GDXAppMain.INSTANCE.selectScreen(ScreenHelp.class); } ImGui.separator(); if (ImGui.menuItem("ImGui Demo")) { - main.showImGuiDemo.set(true); + GDXAppMain.INSTANCE.showImGuiDemo.set(true); } if (ImGui.menuItem("Shutdown")) { - main.dispose(); + GDXAppMain.INSTANCE.dispose(); System.exit(0); } ImGui.endMenu(); 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 index eee0fbf4..4cf24e16 100644 --- a/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/MusicPlayerApp.java +++ b/main-gdxapp/src/main/love/distributedrebirth/gdxapp/desktop/apps/MusicPlayerApp.java @@ -24,10 +24,9 @@ import net.spookygames.gdx.nativefilechooser.NativeFileChooserConfiguration; @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) { + public MusicPlayerApp() { setTitle("Music Player"); getContours().registrateContour(DeskAppContourSection.MAIN, this); getContours().registrateContour(DeskAppContourSection.FILE_NEW, new DeskAppRenderer() { @@ -35,12 +34,12 @@ public class MusicPlayerApp extends DefaultDeskApp implements DeskAppRenderer { @Override public void render() { if (ImGui.menuItem("Add")) { - main.fileChooser.chooseFile(fileChooserConfig, NativeFileChooserCallbackAdapter.onFileChosen(v -> main.music.addBackgroundMusic(v))); + GDXAppMain.INSTANCE.fileChooser.chooseFile(fileChooserConfig, + NativeFileChooserCallbackAdapter.onFileChosen(v -> GDXAppMain.INSTANCE.music.addBackgroundMusic(v))); } } }); - this.main = main; fileChooserConfig = new NativeFileChooserConfiguration(); fileChooserConfig.directory = Gdx.files.absolute(System.getProperty("user.home")); fileChooserConfig.mimeFilter = "audio/*"; @@ -50,7 +49,7 @@ public class MusicPlayerApp extends DefaultDeskApp implements DeskAppRenderer { @Override public void render() { ImGui.text("Current Song:"); - MusicSong currentSong = main.music.getCurrentSong(); + MusicSong currentSong = GDXAppMain.INSTANCE.music.getCurrentSong(); if (currentSong != null) { ImGui.sameLine(); ImGui.text(currentSong.getName()); @@ -58,22 +57,22 @@ public class MusicPlayerApp extends DefaultDeskApp implements DeskAppRenderer { ImGui.separator(); if (currentSong != null) { if (ImGui.button("Play")) { - main.music.play(currentSong); + GDXAppMain.INSTANCE.music.play(currentSong); } } else { ImGui.text("Play"); } ImGui.sameLine(); if (ImGui.button("<")) { - main.music.prev(); + GDXAppMain.INSTANCE.music.prev(); } ImGui.sameLine(); if (ImGui.button(">")) { - main.music.next(); + GDXAppMain.INSTANCE.music.next(); } ImGui.sameLine(); if (ImGui.button("Stop")) { - main.music.stop(); + GDXAppMain.INSTANCE.music.stop(); } int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV; ImGui.beginTable("playlist", 3, flags); @@ -82,14 +81,14 @@ public class MusicPlayerApp extends DefaultDeskApp implements DeskAppRenderer { ImGui.tableSetupColumn("Name"); ImGui.tableHeadersRow(); int i=1; - for (MusicSong song:main.music.getBackgroundSongs()) { + for (MusicSong song:GDXAppMain.INSTANCE.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); + GDXAppMain.INSTANCE.music.play(song); } ImGui.tableNextColumn(); ImGui.selectable(song.getName(), song.isPlaying(), ImGuiSelectableFlags.None);