Added menu sections and moved loader

This commit is contained in:
Willem Cazander 2022-03-05 16:31:35 +01:00
parent a3186867c1
commit e60ef51400
19 changed files with 146 additions and 101 deletions

View file

@ -8,6 +8,7 @@ import org.osgi.service.component.annotations.Reference;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection;
@Component
public class HeWalletComponent {
@ -21,7 +22,7 @@ public class HeWalletComponent {
@Activate
void open() {
log.info(this, "Activated HeWalletComponent");
deskAppService.registrateDeskApp(new DeskAppLauncher("Hebrew Wallet", () -> new HeWalletDeskApp()));
deskAppService.registrateDeskApp(DeskAppMenuSection.INTERNET, new DeskAppLauncher("Hebrew Wallet", () -> new HeWalletDeskApp()));
}
@Deactivate

View file

@ -9,6 +9,7 @@ import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection;
@Component
public class TosAmpComponent {
@ -25,7 +26,7 @@ public class TosAmpComponent {
@Activate
void open() {
log.info(this, "Activated TosAmpComponent");
deskAppService.registrateDeskApp(new DeskAppLauncher("TosAmp", () -> new TosAmpDeskApp(bootArgs.getFileChooser())));
deskAppService.registrateDeskApp(DeskAppMenuSection.MULTIMEDIA, new DeskAppLauncher("TosAmp", () -> new TosAmpDeskApp(bootArgs.getFileChooser())));
}
@Deactivate

View file

@ -56,27 +56,36 @@ public enum GDXAppTos4 implements DefaultEnumInstanceᴶᴹˣ<GDXAppTos4,GDXAppT
@Override
public void resize(int width, int height) {
if (screen != null) {
screen.resize(width, height);
}
}
@Override
public void render() {
ScreenUtils.clear(0f, 0f, 0f, 1f, true);
if (screen != null) {
screen.render(Gdx.graphics.getDeltaTime());
}
}
@Override
public void pause() {
if (screen != null) {
screen.pause();
}
}
@Override
public void resume() {
if (screen != null) {
screen.resume();
}
}
@Override
public void dispose() {
this.screen = null;
for (Screen screen:screens.values()) {
screen.dispose();
}

View file

@ -13,6 +13,7 @@ import java.util.function.Consumer;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.x4o.xml.io.X4OConnectionException;
@ -27,7 +28,6 @@ import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFont
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpBase;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootFactory;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxFont;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog;
@ -195,7 +195,7 @@ public class GDXAppTos4Activator implements BundleActivator {
List<SystemWarpSea> registratedSeas = new ArrayList<>();
int result = 0;
try {
result = systemWarpShip.loadWaterOcean(context, warpshipDevice.theShip().getEngine(), v -> fireMessageEvent(v), registratedSeas);
result = systemWarpShip.loadWaterOcean(context, registratedSeas, warpshipDevice.theShip().getEngine(), v -> fireMessageEvent(v));
} catch (Exception e) {
e.printStackTrace();
fireMessageEvent("ERROR: "+e.getMessage());
@ -210,27 +210,8 @@ public class GDXAppTos4Activator implements BundleActivator {
fireMessageEvent("tos4: chains resolved.");
try {
//ServiceReference<?>[] refs = context.getServiceReferences( SystemWarpSea.class.getName(), "(warp.sea.name=*)" );
for (SystemWarpSea service : registratedSeas) {
//SystemWarpSea service = (SystemWarpSea) context.getService( refs[i] );
String key = service.getWarpKey();
File waterHome = service.getWarpHome();
for (WaterSeaMagic magic:service.getWarpSea().theWater().getSeaMagics()) {
if ("application/vnd.osgi.bundle".equals(magic.getMime())) {
magic.setMime("application/vnd.osgi.bundle.loaded"); // TODO: HACK for now to not load again
String overrideBundleKey = key + "." + magic.getFile();
String overrideBundle = localOverrides.getProperty(overrideBundleKey);
if (overrideBundle == null) {
LOG.debug("installAndStartBundles reference:file:"+waterHome.getAbsolutePath()+"/"+magic.getFile());
SystemGdxBootFactory.installAndStartBundles(context, "reference:file:"+waterHome.getAbsolutePath()+"/"+magic.getFile());
} else {
LOG.debug("installAndStartBundles reference:file:"+overrideBundle);
SystemGdxBootFactory.installAndStartBundles(context, "reference:file:"+overrideBundle);
}
}
}
}
} catch (Exception e) {
systemWarpShip.loadBundles(context, registratedSeas);
} catch (BundleException e) {
e.printStackTrace();
fireMessageEvent("ERROR: "+e.getMessage());
startError = true;
@ -315,8 +296,8 @@ public class GDXAppTos4Activator implements BundleActivator {
}
@Override
public Properties getLocalOverrides() {
return localOverrides;
public void shutdown() {
Gdx.app.exit();
}
}
@ -328,7 +309,7 @@ public class GDXAppTos4Activator implements BundleActivator {
}
@Override
public int loadWaterOcean(BundleContext context, String key, Consumer<String> logger, List<SystemWarpSea> registratedSeas)
public int loadWaterOcean(BundleContext context,List<SystemWarpSea> registratedSeas, String key, Consumer<String> logger)
throws IOException, InterruptedException, X4OConnectionException, SAXException {
File waterHome;
String override = localOverrides.getProperty(key);
@ -381,7 +362,7 @@ public class GDXAppTos4Activator implements BundleActivator {
int result = 0;
for (WaterSeaChain chain: ocean.theWater().getSeaChains()) {
result += loadWaterOcean(context, chain.getKey(), logger, registratedSeas);
result += loadWaterOcean(context, registratedSeas, chain.getKey(), logger);
}
return result;
}
@ -401,6 +382,28 @@ public class GDXAppTos4Activator implements BundleActivator {
process.waitFor();
return buf.toString();
}
@Override
public void loadBundles(BundleContext context, List<SystemWarpSea> registratedSeas) throws BundleException {
for (SystemWarpSea service : registratedSeas) {
String key = service.getWarpKey();
File waterHome = service.getWarpHome();
for (WaterSeaMagic magic:service.getWarpSea().theWater().getSeaMagics()) {
if ("application/vnd.osgi.bundle".equals(magic.getMime())) {
magic.setMime("application/vnd.osgi.bundle.loaded"); // TODO: HACK for now to not load again
String overrideBundleKey = key + "." + magic.getFile();
String overrideBundle = localOverrides.getProperty(overrideBundleKey);
if (overrideBundle == null) {
LOG.debug("loadBundles: "+waterHome.getAbsolutePath()+"/"+magic.getFile());
GDXAppTos4BootFactory.installAndStartBundles(context, "reference:file:"+waterHome.getAbsolutePath()+"/"+magic.getFile());
} else {
LOG.debug("loadBundles: "+overrideBundle);
GDXAppTos4BootFactory.installAndStartBundles(context, "reference:file:"+overrideBundle);
}
}
}
}
}
}
public static class SystemGdxLogImpl implements SystemGdxLog, ApplicationLogger {

View file

@ -1,4 +1,4 @@
package love.distributedrebirth.gdxapp4d.tos4.service;
package love.distributedrebirth.gdxapp4d.tos4;
import java.io.File;
import java.io.IOException;
@ -16,7 +16,7 @@ import org.osgi.framework.launch.FrameworkFactory;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class SystemGdxBootFactory {
public class GDXAppTos4BootFactory {
public static void installAndStartBundles(BundleContext bundleContext, String... bundleLocations) throws BundleException {
for (String location : bundleLocations) {

View file

@ -8,7 +8,6 @@ import org.slf4j.LoggerFactory;
import com.badlogic.gdx.Gdx;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootFactory;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class GDXAppTos4Startup {
@ -17,7 +16,7 @@ public class GDXAppTos4Startup {
public static Framework init(GDXAppTos4 tos4, GDXAppTos4Activator systemActivator) {
LOG.info("Startup framework");
final Framework systemBundle = SystemGdxBootFactory.createFramework();
final Framework systemBundle = GDXAppTos4BootFactory.createFramework();
final GDXAppTos4BootScreen bootScreen = new GDXAppTos4BootScreen();
systemActivator.addBootListener(bootScreen);

View file

@ -1,7 +1,5 @@
package love.distributedrebirth.gdxapp4d.tos4.service;
import java.util.Properties;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import net.spookygames.gdx.nativefilechooser.NativeFileChooser;
@ -16,5 +14,5 @@ public interface SystemGdxBootArgs {
NativeFileChooser getFileChooser();
Properties getLocalOverrides();
void shutdown();
}

View file

@ -17,5 +17,7 @@ public interface SystemWarpShip {
WaterDevice getWarpShip();
int loadWaterOcean(BundleContext context, String key, Consumer<String> logger, List<SystemWarpSea> registratedSeas) throws IOException, InterruptedException, X4OConnectionException, SAXException, BundleException;
int loadWaterOcean(BundleContext context, List<SystemWarpSea> registratedSeas, String key, Consumer<String> logger) throws IOException, InterruptedException, X4OConnectionException, SAXException, BundleException;
void loadBundles(BundleContext context, List<SystemWarpSea> registratedSeas) throws BundleException;
}

View file

@ -1,12 +1,12 @@
package love.distributedrebirth.gdxapp4d.vrgem4;
import java.io.File;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.ServiceReference;
import com.badlogic.gdx.Gdx;
@ -14,7 +14,6 @@ import com.badlogic.gdx.Gdx;
import imgui.type.ImBoolean;
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ;
import love.distributedrebirth.bassboonyd.jmx.DefaultEnumBaseᴶᴹˣ;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootFactory;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxFont;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpShip;
@ -32,11 +31,12 @@ import love.distributedrebirth.numberxd.base2t.Base2PartsFactory;
import love.distributedrebirth.numberxd.base2t.Base2Terminator;
import love.distributedrebirth.numberxd.base2t.part.warp.TOSWarpCore;
import love.distributedrebirth.numberxd.glyph.BaseGlyphSet;
import love.distributedrebirth.warpme.sea.WaterSeaMagic;
import love.distributedrebirth.warpme.ship.WaterShipOcean;
public class GDXAppVrGem4Activator implements BundleActivator {
private static final int VIEW_SLEEP_TIME = 1234;
@Override
public void stop(final BundleContext context) {
}
@ -44,7 +44,7 @@ public class GDXAppVrGem4Activator implements BundleActivator {
@Override
public void start(final BundleContext context) {
try {
Thread.sleep(2000);
Thread.sleep(VIEW_SLEEP_TIME);
} catch (InterruptedException ignored) {
}
@ -145,7 +145,7 @@ public class GDXAppVrGem4Activator implements BundleActivator {
GDXAppVrGem4.INSTANCE.init(terminal);
VrGem4DeskAppService deskAppService = new VrGem4DeskAppServiceImpl();
VrGem4DeskAppServiceImpl deskAppService = new VrGem4DeskAppServiceImpl();
context.registerService(VrGem4DeskAppService.class.getName(), deskAppService, new Hashtable<String, String>());
bootScreen.bootLine("terminal: added screens");
@ -174,7 +174,7 @@ public class GDXAppVrGem4Activator implements BundleActivator {
int result = 0;
try {
for (WaterShipOcean ocean:systemWarpShip.getWarpShip().theShip().getShipOceans()) {
result = systemWarpShip.loadWaterOcean(context, ocean.getSea(), v -> bootScreen.bootLine(v), registratedSeas);
result = systemWarpShip.loadWaterOcean(context, registratedSeas, ocean.getSea(), v -> bootScreen.bootLine(v));
}
} catch (Exception e) {
e.printStackTrace();
@ -188,31 +188,14 @@ public class GDXAppVrGem4Activator implements BundleActivator {
bootScreen.bootLine("vrGEM4: chains resolved.");
try {
for (SystemWarpSea service: registratedSeas) {
String key = service.getWarpKey();
File waterHome = service.getWarpHome();
for (WaterSeaMagic magic:service.getWarpSea().theWater().getSeaMagics()) {
if ("application/vnd.osgi.bundle".equals(magic.getMime())) {
magic.setMime("application/vnd.osgi.bundle.loaded"); // TODO: HACK for now to not load again
String overrideBundleKey = key + "." + magic.getFile();
String overrideBundle = bootArgs.getLocalOverrides().getProperty(overrideBundleKey);
if (overrideBundle == null) {
SystemGdxBootFactory.installAndStartBundles(context, "reference:file:"+waterHome.getAbsolutePath()+"/"+magic.getFile());
} else {
SystemGdxBootFactory.installAndStartBundles(context, "reference:file:"+overrideBundle);
}
}
}
}
} catch (Exception e) {
systemWarpShip.loadBundles(context, registratedSeas);
} catch (BundleException e) {
e.printStackTrace();
bootScreen.bootLine("ERROR: "+e.getMessage());
return;
}
try {
Thread.sleep(2000);
Thread.sleep(VIEW_SLEEP_TIME);
} catch (InterruptedException ignored) {
}
Gdx.app.postRunnable(new Runnable() {

View file

@ -1,22 +1,29 @@
package love.distributedrebirth.gdxapp4d.vrgem4;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection;
public class VrGem4DeskAppServiceImpl implements VrGem4DeskAppService {
private List<DeskAppLauncher> launchers = new ArrayList<>();
private Map<DeskAppMenuSection, List<DeskAppLauncher>> menu = new HashMap<>();
@Override
public List<DeskAppLauncher> getLaunchers() {
return launchers;
public List<DeskAppLauncher> getMenuSection(DeskAppMenuSection section) {
List<DeskAppLauncher> result = menu.get(section);
if (result == null) {
result = new ArrayList<>();
menu.put(section, result);
}
return result;
}
@Override
public void registrateDeskApp(DeskAppLauncher launcher) {
launchers.add(launcher);
public void registrateDeskApp(DeskAppMenuSection section, DeskAppLauncher launcher) {
getMenuSection(section).add(launcher);
}
}

View file

@ -19,7 +19,7 @@ import imgui.flag.ImGuiWindowFlags;
import imgui.type.ImBoolean;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs;
import love.distributedrebirth.gdxapp4d.vrgem4.ImGuiSetup;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService;
import love.distributedrebirth.gdxapp4d.vrgem4.VrGem4DeskAppServiceImpl;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskApp;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppContourSection;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppRenderer;
@ -43,7 +43,7 @@ public abstract class AbstractScreenDesktop extends ScreenAdapter implements Des
private ModelBatch modelBatch;
private Array<ModelInstance> modelInstances = new Array<ModelInstance>();
public AbstractScreenDesktop(String name, SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) {
public AbstractScreenDesktop(String name, SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) {
this.create();
screenMenu = new DeskTopScreenMenu(bootArgs, deskAppService);
deskAppScreen = new DeskAppController(name);

View file

@ -10,13 +10,13 @@ import com.badlogic.gdx.utils.Array;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService;
import love.distributedrebirth.gdxapp4d.vrgem4.VrGem4DeskAppServiceImpl;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenDesktop1 extends AbstractScreenDesktop {
private Model grid;
public ScreenDesktop1(SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) {
public ScreenDesktop1(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) {
super("Desktop1", bootArgs, deskAppService);
//backgroundImage = new Texture(Gdx.files.internal("background/terrydavis-front.png"));
}

View file

@ -10,13 +10,13 @@ import com.badlogic.gdx.utils.Array;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService;
import love.distributedrebirth.gdxapp4d.vrgem4.VrGem4DeskAppServiceImpl;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenDesktop2 extends AbstractScreenDesktop {
private Model grid;
public ScreenDesktop2(SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) {
public ScreenDesktop2(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) {
super("Desktop2", bootArgs, deskAppService);
//backgroundImage = new Texture(Gdx.files.internal("background/terrydavis-nose.png"));
}

View file

@ -10,13 +10,13 @@ import com.badlogic.gdx.utils.Array;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService;
import love.distributedrebirth.gdxapp4d.vrgem4.VrGem4DeskAppServiceImpl;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenDesktop3 extends AbstractScreenDesktop {
private Model grid;
public ScreenDesktop3(SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) {
public ScreenDesktop3(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) {
super("Desktop3", bootArgs, deskAppService);
}

View file

@ -21,7 +21,7 @@ import com.badlogic.gdx.utils.viewport.ScreenViewport;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService;
import love.distributedrebirth.gdxapp4d.vrgem4.VrGem4DeskAppServiceImpl;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenDesktop4 extends AbstractScreenDesktop {
@ -37,7 +37,7 @@ public class ScreenDesktop4 extends AbstractScreenDesktop {
private float colorFade = 0f;
private boolean colorPositive = true;
public ScreenDesktop4(SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) {
public ScreenDesktop4(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) {
super("Desktop4", bootArgs, deskAppService);
shader = new UserColorShader();
shader.init();

View file

@ -1,14 +1,9 @@
package love.distributedrebirth.gdxapp4d.vrgem4.service;
import java.util.List;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection;
public interface VrGem4DeskAppService {
List<DeskAppLauncher> getLaunchers();
void registrateDeskApp(DeskAppLauncher launcher);
void registrateDeskApp(DeskAppMenuSection section, DeskAppLauncher launcher);
}

View file

@ -0,0 +1,21 @@
package love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp;
public enum DeskAppMenuSection {
EDITORS,
EDUCATION,
INTERNET,
MULTIMEDIA,
PROGRAMMING,
SCIENCE,
SHELLS,
SYSTEM,
;
private DeskAppMenuSection() {
}
public boolean isSystem() {
return this == SYSTEM;
}
}

View file

@ -11,16 +11,17 @@ import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs;
import love.distributedrebirth.gdxapp4d.vrgem4.FontAwesomeIcons;
import love.distributedrebirth.gdxapp4d.vrgem4.GDXAppVrGem4;
import love.distributedrebirth.gdxapp4d.vrgem4.VrGem4DeskAppServiceImpl;
import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenCredits;
import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop1;
import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop2;
import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop3;
import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop4;
import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenHelp;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskApp;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppContourSection;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppRenderer;
import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.SystemBaseGlyphApp;
import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.SystemBasePartApp;
@ -31,13 +32,13 @@ import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.Unicode4DApp;
public class DeskTopScreenMenu {
private SystemGdxBootArgs bootArgs;
private VrGem4DeskAppService deskAppService;
private VrGem4DeskAppServiceImpl deskAppService;
private List<DeskAppLauncher> apps;
private ImBoolean fileMinimizeSelected = new ImBoolean(false);
private ImBoolean fileCloseSelected = new ImBoolean(false);
private ImBoolean tosSelfSelected = new ImBoolean(false);
public DeskTopScreenMenu(SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) {
public DeskTopScreenMenu(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) {
this.bootArgs = bootArgs;
this.deskAppService = deskAppService;
apps = new ArrayList<>();
@ -221,7 +222,16 @@ public class DeskTopScreenMenu {
}
}
ImGui.separator();
for (DeskAppLauncher launcher: deskAppService.getLaunchers()) {
for (DeskAppMenuSection section: DeskAppMenuSection.values()) {
if (section.isSystem()) {
continue;
}
List<DeskAppLauncher> menu = deskAppService.getMenuSection(section);
if (menu.isEmpty()) {
continue;
}
if (ImGui.beginMenu(section.name())) {
for (DeskAppLauncher launcher: menu) {
if (ImGui.menuItem(launcher.getName())) {
DeskApp controller = launcher.getLauncher().get();
controller.create();
@ -230,6 +240,9 @@ public class DeskTopScreenMenu {
}
ImGui.endMenu();
}
}
ImGui.endMenu();
}
if (ImGui.menuItem(FontAwesomeIcons.Terminal + " Run App")) {
}
ImGui.separator();
@ -244,6 +257,19 @@ public class DeskTopScreenMenu {
}
ImGui.separator();
List<DeskAppLauncher> menu = deskAppService.getMenuSection(DeskAppMenuSection.SYSTEM);
if (!menu.isEmpty()) {
if (ImGui.beginMenu(DeskAppMenuSection.SYSTEM.name())) {
for (DeskAppLauncher launcher: menu) {
if (ImGui.menuItem(launcher.getName())) {
DeskApp controller = launcher.getLauncher().get();
controller.create();
appScreen.getDeskAppController().addDeskApp(controller);
}
}
ImGui.endMenu();
}
}
if (ImGui.menuItem(FontAwesomeIcons.CreditCard + " Credits")) {
GDXAppVrGem4.INSTANCE.terminal.selectScreen(ScreenCredits.class);
}
@ -255,8 +281,7 @@ public class DeskTopScreenMenu {
// GDXAppVrGem4.INSTANCE.showImGuiDemo.set(true);
}
if (ImGui.menuItem(FontAwesomeIcons.PowerOff + " Shutdown")) {
// GDXAppVrGem4.INSTANCE.dispose();
System.exit(0);
bootArgs.shutdown();
}
ImGui.endMenu();
}

View file

@ -8,6 +8,7 @@ import org.osgi.service.component.annotations.Reference;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection;
@Component
public class BasicConsoleComponent {
@ -21,7 +22,7 @@ public class BasicConsoleComponent {
@Activate
void open() {
log.info(this, "Activate BasicConsoleComponent");
deskAppService.registrateDeskApp(new DeskAppLauncher("Basic Console", () -> new BasicConsoleDeskApp()));
deskAppService.registrateDeskApp(DeskAppMenuSection.PROGRAMMING, new DeskAppLauncher("Basic Console", () -> new BasicConsoleDeskApp()));
}
@Deactivate