Redone menu and app/desktop switching
This commit is contained in:
parent
7d5cc14564
commit
f0d78f3f4d
|
@ -28,6 +28,7 @@ import love.distributedrebirth.gdxapp.desktop.apps.HebrewWalletApp;
|
||||||
import love.distributedrebirth.gdxapp.desktop.apps.MusicPlayerApp;
|
import love.distributedrebirth.gdxapp.desktop.apps.MusicPlayerApp;
|
||||||
import love.distributedrebirth.gdxapp.desktop.apps.SystemBaseGlyphApp;
|
import love.distributedrebirth.gdxapp.desktop.apps.SystemBaseGlyphApp;
|
||||||
import love.distributedrebirth.gdxapp.desktop.apps.SystemBasePartApp;
|
import love.distributedrebirth.gdxapp.desktop.apps.SystemBasePartApp;
|
||||||
|
import love.distributedrebirth.gdxapp.desktop.apps.Unicode4DApp;
|
||||||
import love.distributedrebirth.gdxapp.music.MusicManager;
|
import love.distributedrebirth.gdxapp.music.MusicManager;
|
||||||
import love.distributedrebirth.gdxapp.music.MusicSongType;
|
import love.distributedrebirth.gdxapp.music.MusicSongType;
|
||||||
import love.distributedrebirth.gdxapp.screen.ScreenCredits;
|
import love.distributedrebirth.gdxapp.screen.ScreenCredits;
|
||||||
|
@ -64,6 +65,10 @@ public class GDXAppMain extends Game {
|
||||||
|
|
||||||
private Map<Class<? extends Screen>,Screen> screens;
|
private Map<Class<? extends Screen>,Screen> screens;
|
||||||
private List<GDXAppLauncher> apps;
|
private List<GDXAppLauncher> apps;
|
||||||
|
private GDXAppScreen desktop0;
|
||||||
|
private GDXAppScreen desktop1;
|
||||||
|
private GDXAppScreen desktop2;
|
||||||
|
private GDXAppScreen desktop3;
|
||||||
private ImBoolean openWindowFlag = new ImBoolean(true);
|
private ImBoolean openWindowFlag = new ImBoolean(true);
|
||||||
private ImBoolean showImGuiDemo = new ImBoolean(false);
|
private ImBoolean showImGuiDemo = new ImBoolean(false);
|
||||||
|
|
||||||
|
@ -155,15 +160,21 @@ public class GDXAppMain extends Game {
|
||||||
apps.add(new GDXAppLauncher("Base Glyphs", () -> new SystemBaseGlyphApp()));
|
apps.add(new GDXAppLauncher("Base Glyphs", () -> new SystemBaseGlyphApp()));
|
||||||
apps.add(new GDXAppLauncher("Base Parts", () -> new SystemBasePartApp()));
|
apps.add(new GDXAppLauncher("Base Parts", () -> new SystemBasePartApp()));
|
||||||
apps.add(new GDXAppLauncher("Hebrew Wallet", () -> new HebrewWalletApp()));
|
apps.add(new GDXAppLauncher("Hebrew Wallet", () -> new HebrewWalletApp()));
|
||||||
|
apps.add(new GDXAppLauncher("Unicode4D", () -> new Unicode4DApp()));
|
||||||
apps.add(new GDXAppLauncher("Music Player", () -> new MusicPlayerApp(this)));
|
apps.add(new GDXAppLauncher("Music Player", () -> new MusicPlayerApp(this)));
|
||||||
|
|
||||||
|
desktop0 = new ScreenDesktop0(this);
|
||||||
|
desktop1 = new ScreenDesktop1(this);
|
||||||
|
desktop2 = new ScreenDesktop2();
|
||||||
|
desktop3 = new ScreenDesktop3();
|
||||||
|
|
||||||
putScreen(new ScreenLoading(this));
|
putScreen(new ScreenLoading(this));
|
||||||
putScreen(new ScreenIntro(this));
|
putScreen(new ScreenIntro(this));
|
||||||
putScreen(new ScreenIntroMission(this));
|
putScreen(new ScreenIntroMission(this));
|
||||||
putScreen(new ScreenDesktop0(this));
|
putScreen(desktop0);
|
||||||
putScreen(new ScreenDesktop1(this));
|
putScreen(desktop1);
|
||||||
putScreen(new ScreenDesktop2());
|
putScreen(desktop2);
|
||||||
putScreen(new ScreenDesktop3());
|
putScreen(desktop3);
|
||||||
putScreen(new ScreenCredits(this));
|
putScreen(new ScreenCredits(this));
|
||||||
putScreen(new ScreenHelp(this));
|
putScreen(new ScreenHelp(this));
|
||||||
|
|
||||||
|
@ -239,37 +250,58 @@ public class GDXAppMain extends Game {
|
||||||
ImGuiSetup.imGuiGlImp.renderDrawData(ImGui.getDrawData());
|
ImGuiSetup.imGuiGlImp.renderDrawData(ImGui.getDrawData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ImBoolean fileMinimizeSelected = new ImBoolean(false);
|
||||||
|
private ImBoolean fileCloseSelected = new ImBoolean(false);
|
||||||
|
|
||||||
private void renderMenu(GDXAppScreen appScreen) {
|
private void renderMenu(GDXAppScreen appScreen) {
|
||||||
DeskApp deskApp = appScreen.getDeskAppScreen().getCurrentDeskApp();
|
DeskApp deskApp = appScreen.getDeskAppScreen().getCurrentDeskApp();
|
||||||
ImGui.beginMainMenuBar();
|
ImGui.beginMainMenuBar();
|
||||||
if (ImGui.beginMenu("Demo")) {
|
if (ImGui.beginMenu("File")) {
|
||||||
if (Gdx.graphics.isFullscreen()) {
|
if (deskApp != null) {
|
||||||
if (ImGui.menuItem("Window Mode")) {
|
DeskAppRenderer fileNew = deskApp.getContours().getContour(DeskAppContourSection.FILE_NEW);
|
||||||
Gdx.graphics.setWindowedMode(viewWidth, viewHeight);
|
DeskAppRenderer fileClose = deskApp.getContours().getContour(DeskAppContourSection.FILE_CLOSE);
|
||||||
|
DeskAppRenderer fileSave = deskApp.getContours().getContour(DeskAppContourSection.FILE_SAVE);
|
||||||
|
DeskAppRenderer fileOption = deskApp.getContours().getContour(DeskAppContourSection.FILE_OPTION);
|
||||||
|
DeskAppRenderer filePrint = deskApp.getContours().getContour(DeskAppContourSection.FILE_PRINT);
|
||||||
|
if (fileNew != null) {
|
||||||
|
fileNew.render();
|
||||||
|
ImGui.separator();
|
||||||
}
|
}
|
||||||
} else {
|
if (fileClose != null) {
|
||||||
if (ImGui.menuItem("Full Screen")) {
|
fileClose.render();
|
||||||
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
|
ImGui.separator();
|
||||||
|
}
|
||||||
|
if (fileSave != null) {
|
||||||
|
fileSave.render();
|
||||||
|
ImGui.separator();
|
||||||
|
}
|
||||||
|
if (fileOption != null) {
|
||||||
|
fileOption.render();
|
||||||
|
ImGui.separator();
|
||||||
|
}
|
||||||
|
if (filePrint != null) {
|
||||||
|
filePrint.render();
|
||||||
|
ImGui.separator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ImGui.menuItem("Close")) {
|
if (ImGui.menuItem("Minimize", "", fileMinimizeSelected, deskApp != null )) {
|
||||||
|
if (deskApp != null) {
|
||||||
|
appScreen.getDeskAppScreen().setCurrentDeskApp(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ImGui.menuItem("Exit", "", fileCloseSelected, deskApp != null)) {
|
||||||
if (deskApp != null) {
|
if (deskApp != null) {
|
||||||
appScreen.getDeskAppScreen().removeDeskApp(deskApp);
|
appScreen.getDeskAppScreen().removeDeskApp(deskApp);
|
||||||
appScreen.getDeskAppScreen().setCurrentDeskApp(null);
|
appScreen.getDeskAppScreen().setCurrentDeskApp(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui.separator();
|
|
||||||
if (ImGui.menuItem("Exit")) {
|
|
||||||
dispose();
|
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
ImGui.endMenu();
|
ImGui.endMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deskApp != null) {
|
if (deskApp != null) {
|
||||||
renderEditMenu(deskApp);
|
renderEditMenu(deskApp);
|
||||||
}
|
}
|
||||||
if (ImGui.beginMenu("Desktop")) {
|
if (ImGui.beginMenu("vrGEM⁴")) {
|
||||||
if (ImGui.beginMenu("Start")) {
|
if (ImGui.beginMenu("Start")) {
|
||||||
for (GDXAppLauncher launcher: apps) {
|
for (GDXAppLauncher launcher: apps) {
|
||||||
if (ImGui.menuItem(launcher.getName())) {
|
if (ImGui.menuItem(launcher.getName())) {
|
||||||
|
@ -279,25 +311,84 @@ public class GDXAppMain extends Game {
|
||||||
ImGui.endMenu();
|
ImGui.endMenu();
|
||||||
}
|
}
|
||||||
ImGui.separator();
|
ImGui.separator();
|
||||||
for (DeskApp app: appScreen.getDeskAppScreen().getDeskApps()) {
|
|
||||||
|
String infix0 = "";
|
||||||
|
String infix1 = "";
|
||||||
|
String infix2 = "";
|
||||||
|
String infix3 = "";
|
||||||
|
if (appScreen instanceof ScreenDesktop0) {
|
||||||
|
infix0 = "=> ";
|
||||||
|
}
|
||||||
|
if (appScreen instanceof ScreenDesktop1) {
|
||||||
|
infix1 = "=> ";
|
||||||
|
}
|
||||||
|
if (appScreen instanceof ScreenDesktop2) {
|
||||||
|
infix2 = "=> ";
|
||||||
|
}
|
||||||
|
if (appScreen instanceof ScreenDesktop3) {
|
||||||
|
infix3 = "=> ";
|
||||||
|
}
|
||||||
|
if (ImGui.beginMenu(infix0+"Desktop0")) {
|
||||||
|
if (ImGui.menuItem("Main reality")) {
|
||||||
|
selectScreen(ScreenDesktop0.class);
|
||||||
|
desktop0.getDeskAppScreen().setCurrentDeskApp(null);
|
||||||
|
}
|
||||||
|
for (DeskApp app: desktop0.getDeskAppScreen().getDeskApps()) {
|
||||||
if (ImGui.menuItem(app.getName())) {
|
if (ImGui.menuItem(app.getName())) {
|
||||||
appScreen.getDeskAppScreen().setCurrentDeskApp(app);
|
selectScreen(ScreenDesktop0.class);
|
||||||
|
desktop0.getDeskAppScreen().setCurrentDeskApp(app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui.endMenu();
|
ImGui.endMenu();
|
||||||
}
|
}
|
||||||
if (ImGui.beginMenu("System")) {
|
if (ImGui.beginMenu(infix1+"Desktop1")) {
|
||||||
if (ImGui.menuItem("Desktop0")) {
|
if (ImGui.menuItem("Main reality")) {
|
||||||
selectScreen(ScreenDesktop0.class);
|
|
||||||
}
|
|
||||||
if (ImGui.menuItem("Desktop1")) {
|
|
||||||
selectScreen(ScreenDesktop1.class);
|
selectScreen(ScreenDesktop1.class);
|
||||||
|
desktop1.getDeskAppScreen().setCurrentDeskApp(null);
|
||||||
}
|
}
|
||||||
if (ImGui.menuItem("Desktop2")) {
|
for (DeskApp app: desktop1.getDeskAppScreen().getDeskApps()) {
|
||||||
|
if (ImGui.menuItem(app.getName())) {
|
||||||
|
selectScreen(ScreenDesktop1.class);
|
||||||
|
desktop1.getDeskAppScreen().setCurrentDeskApp(app);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui.endMenu();
|
||||||
|
}
|
||||||
|
if (ImGui.beginMenu(infix2+"Desktop2")) {
|
||||||
|
if (ImGui.menuItem("Main reality")) {
|
||||||
selectScreen(ScreenDesktop2.class);
|
selectScreen(ScreenDesktop2.class);
|
||||||
|
desktop2.getDeskAppScreen().setCurrentDeskApp(null);
|
||||||
}
|
}
|
||||||
if (ImGui.menuItem("Desktop3")) {
|
for (DeskApp app: desktop2.getDeskAppScreen().getDeskApps()) {
|
||||||
|
if (ImGui.menuItem(app.getName())) {
|
||||||
|
selectScreen(ScreenDesktop2.class);
|
||||||
|
desktop2.getDeskAppScreen().setCurrentDeskApp(app);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui.endMenu();
|
||||||
|
}
|
||||||
|
if (ImGui.beginMenu(infix3+"Desktop3")) {
|
||||||
|
if (ImGui.menuItem("Main reality")) {
|
||||||
selectScreen(ScreenDesktop3.class);
|
selectScreen(ScreenDesktop3.class);
|
||||||
|
desktop3.getDeskAppScreen().setCurrentDeskApp(null);
|
||||||
|
}
|
||||||
|
for (DeskApp app: desktop3.getDeskAppScreen().getDeskApps()) {
|
||||||
|
if (ImGui.menuItem(app.getName())) {
|
||||||
|
selectScreen(ScreenDesktop3.class);
|
||||||
|
desktop3.getDeskAppScreen().setCurrentDeskApp(app);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui.endMenu();
|
||||||
|
}
|
||||||
|
ImGui.separator();
|
||||||
|
if (Gdx.graphics.isFullscreen()) {
|
||||||
|
if (ImGui.menuItem("Window Mode")) {
|
||||||
|
Gdx.graphics.setWindowedMode(viewWidth, viewHeight);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ImGui.menuItem("Full Screen")) {
|
||||||
|
Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ImGui.separator();
|
ImGui.separator();
|
||||||
if (ImGui.menuItem("Credits")) {
|
if (ImGui.menuItem("Credits")) {
|
||||||
|
@ -310,6 +401,10 @@ public class GDXAppMain extends Game {
|
||||||
if (ImGui.menuItem("ImGui Demo")) {
|
if (ImGui.menuItem("ImGui Demo")) {
|
||||||
showImGuiDemo.set(true);
|
showImGuiDemo.set(true);
|
||||||
}
|
}
|
||||||
|
if (ImGui.menuItem("Exit")) {
|
||||||
|
dispose();
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
ImGui.endMenu();
|
ImGui.endMenu();
|
||||||
}
|
}
|
||||||
ImGui.endMainMenuBar();
|
ImGui.endMainMenuBar();
|
||||||
|
|
|
@ -30,6 +30,16 @@ public class MusicPlayerApp extends DefaultDeskApp implements DeskAppRenderer {
|
||||||
public MusicPlayerApp(GDXAppMain main) {
|
public MusicPlayerApp(GDXAppMain main) {
|
||||||
super("Music Player", "");
|
super("Music Player", "");
|
||||||
getContours().registrateContour(DeskAppContourSection.MAIN, this);
|
getContours().registrateContour(DeskAppContourSection.MAIN, this);
|
||||||
|
getContours().registrateContour(DeskAppContourSection.FILE_NEW, new DeskAppRenderer() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render() {
|
||||||
|
if (ImGui.menuItem("Add")) {
|
||||||
|
main.fileChooser.chooseFile(fileChooserConfig, NativeFileChooserCallbackAdapter.onFileChosen(v -> main.music.addBackgroundMusic(v)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
this.main = main;
|
this.main = main;
|
||||||
fileChooserConfig = new NativeFileChooserConfiguration();
|
fileChooserConfig = new NativeFileChooserConfiguration();
|
||||||
fileChooserConfig.directory = Gdx.files.absolute(System.getProperty("user.home"));
|
fileChooserConfig.directory = Gdx.files.absolute(System.getProperty("user.home"));
|
||||||
|
@ -65,10 +75,6 @@ public class MusicPlayerApp extends DefaultDeskApp implements DeskAppRenderer {
|
||||||
if (ImGui.button("Stop")) {
|
if (ImGui.button("Stop")) {
|
||||||
main.music.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;
|
int flags = ImGuiTableFlags.ScrollX | ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersOuter | ImGuiTableFlags.BordersV;
|
||||||
ImGui.beginTable("playlist", 3, flags);
|
ImGui.beginTable("playlist", 3, flags);
|
||||||
ImGui.tableSetupColumn("#", ImGuiTableColumnFlags.NoHide);
|
ImGui.tableSetupColumn("#", ImGuiTableColumnFlags.NoHide);
|
||||||
|
|
Loading…
Reference in a new issue