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.tos4.service.SystemGdxLog;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService; import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection;
@Component @Component
public class HeWalletComponent { public class HeWalletComponent {
@ -21,7 +22,7 @@ public class HeWalletComponent {
@Activate @Activate
void open() { void open() {
log.info(this, "Activated HeWalletComponent"); log.info(this, "Activated HeWalletComponent");
deskAppService.registrateDeskApp(new DeskAppLauncher("Hebrew Wallet", () -> new HeWalletDeskApp())); deskAppService.registrateDeskApp(DeskAppMenuSection.INTERNET, new DeskAppLauncher("Hebrew Wallet", () -> new HeWalletDeskApp()));
} }
@Deactivate @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.tos4.service.SystemGdxLog;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService; import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection;
@Component @Component
public class TosAmpComponent { public class TosAmpComponent {
@ -25,7 +26,7 @@ public class TosAmpComponent {
@Activate @Activate
void open() { void open() {
log.info(this, "Activated TosAmpComponent"); 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 @Deactivate

View file

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

View file

@ -13,6 +13,7 @@ import java.util.function.Consumer;
import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.x4o.xml.io.X4OConnectionException; 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.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpBase; 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.SystemGdxBootArgs;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxFont; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxFont;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog;
@ -195,7 +195,7 @@ public class GDXAppTos4Activator implements BundleActivator {
List<SystemWarpSea> registratedSeas = new ArrayList<>(); List<SystemWarpSea> registratedSeas = new ArrayList<>();
int result = 0; int result = 0;
try { 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
fireMessageEvent("ERROR: "+e.getMessage()); fireMessageEvent("ERROR: "+e.getMessage());
@ -210,27 +210,8 @@ public class GDXAppTos4Activator implements BundleActivator {
fireMessageEvent("tos4: chains resolved."); fireMessageEvent("tos4: chains resolved.");
try { try {
//ServiceReference<?>[] refs = context.getServiceReferences( SystemWarpSea.class.getName(), "(warp.sea.name=*)" ); systemWarpShip.loadBundles(context, registratedSeas);
for (SystemWarpSea service : registratedSeas) { } catch (BundleException e) {
//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) {
e.printStackTrace(); e.printStackTrace();
fireMessageEvent("ERROR: "+e.getMessage()); fireMessageEvent("ERROR: "+e.getMessage());
startError = true; startError = true;
@ -315,8 +296,8 @@ public class GDXAppTos4Activator implements BundleActivator {
} }
@Override @Override
public Properties getLocalOverrides() { public void shutdown() {
return localOverrides; Gdx.app.exit();
} }
} }
@ -328,7 +309,7 @@ public class GDXAppTos4Activator implements BundleActivator {
} }
@Override @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 { throws IOException, InterruptedException, X4OConnectionException, SAXException {
File waterHome; File waterHome;
String override = localOverrides.getProperty(key); String override = localOverrides.getProperty(key);
@ -381,7 +362,7 @@ public class GDXAppTos4Activator implements BundleActivator {
int result = 0; int result = 0;
for (WaterSeaChain chain: ocean.theWater().getSeaChains()) { for (WaterSeaChain chain: ocean.theWater().getSeaChains()) {
result += loadWaterOcean(context, chain.getKey(), logger, registratedSeas); result += loadWaterOcean(context, registratedSeas, chain.getKey(), logger);
} }
return result; return result;
} }
@ -401,6 +382,28 @@ public class GDXAppTos4Activator implements BundleActivator {
process.waitFor(); process.waitFor();
return buf.toString(); 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 { 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.File;
import java.io.IOException; import java.io.IOException;
@ -16,7 +16,7 @@ import org.osgi.framework.launch.FrameworkFactory;
import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天") @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class SystemGdxBootFactory { public class GDXAppTos4BootFactory {
public static void installAndStartBundles(BundleContext bundleContext, String... bundleLocations) throws BundleException { public static void installAndStartBundles(BundleContext bundleContext, String... bundleLocations) throws BundleException {
for (String location : bundleLocations) { for (String location : bundleLocations) {

View file

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

View file

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

View file

@ -17,5 +17,7 @@ public interface SystemWarpShip {
WaterDevice getWarpShip(); 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; package love.distributedrebirth.gdxapp4d.vrgem4;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.List; import java.util.List;
import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.ServiceReference; import org.osgi.framework.ServiceReference;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
@ -14,7 +14,6 @@ import com.badlogic.gdx.Gdx;
import imgui.type.ImBoolean; import imgui.type.ImBoolean;
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ;
import love.distributedrebirth.bassboonyd.jmx.DefaultEnumBaseᴶᴹˣ; 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.SystemGdxBootArgs;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxFont; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxFont;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpShip; 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.Base2Terminator;
import love.distributedrebirth.numberxd.base2t.part.warp.TOSWarpCore; import love.distributedrebirth.numberxd.base2t.part.warp.TOSWarpCore;
import love.distributedrebirth.numberxd.glyph.BaseGlyphSet; import love.distributedrebirth.numberxd.glyph.BaseGlyphSet;
import love.distributedrebirth.warpme.sea.WaterSeaMagic;
import love.distributedrebirth.warpme.ship.WaterShipOcean; import love.distributedrebirth.warpme.ship.WaterShipOcean;
public class GDXAppVrGem4Activator implements BundleActivator { public class GDXAppVrGem4Activator implements BundleActivator {
private static final int VIEW_SLEEP_TIME = 1234;
@Override @Override
public void stop(final BundleContext context) { public void stop(final BundleContext context) {
} }
@ -44,7 +44,7 @@ public class GDXAppVrGem4Activator implements BundleActivator {
@Override @Override
public void start(final BundleContext context) { public void start(final BundleContext context) {
try { try {
Thread.sleep(2000); Thread.sleep(VIEW_SLEEP_TIME);
} catch (InterruptedException ignored) { } catch (InterruptedException ignored) {
} }
@ -145,7 +145,7 @@ public class GDXAppVrGem4Activator implements BundleActivator {
GDXAppVrGem4.INSTANCE.init(terminal); GDXAppVrGem4.INSTANCE.init(terminal);
VrGem4DeskAppService deskAppService = new VrGem4DeskAppServiceImpl(); VrGem4DeskAppServiceImpl deskAppService = new VrGem4DeskAppServiceImpl();
context.registerService(VrGem4DeskAppService.class.getName(), deskAppService, new Hashtable<String, String>()); context.registerService(VrGem4DeskAppService.class.getName(), deskAppService, new Hashtable<String, String>());
bootScreen.bootLine("terminal: added screens"); bootScreen.bootLine("terminal: added screens");
@ -174,7 +174,7 @@ public class GDXAppVrGem4Activator implements BundleActivator {
int result = 0; int result = 0;
try { try {
for (WaterShipOcean ocean:systemWarpShip.getWarpShip().theShip().getShipOceans()) { 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -188,31 +188,14 @@ public class GDXAppVrGem4Activator implements BundleActivator {
bootScreen.bootLine("vrGEM4: chains resolved."); bootScreen.bootLine("vrGEM4: chains resolved.");
try { try {
for (SystemWarpSea service: registratedSeas) { systemWarpShip.loadBundles(context, registratedSeas);
String key = service.getWarpKey(); } catch (BundleException e) {
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) {
e.printStackTrace(); e.printStackTrace();
bootScreen.bootLine("ERROR: "+e.getMessage()); bootScreen.bootLine("ERROR: "+e.getMessage());
return; return;
} }
try { try {
Thread.sleep(2000); Thread.sleep(VIEW_SLEEP_TIME);
} catch (InterruptedException ignored) { } catch (InterruptedException ignored) {
} }
Gdx.app.postRunnable(new Runnable() { Gdx.app.postRunnable(new Runnable() {

View file

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

View file

@ -19,7 +19,7 @@ import imgui.flag.ImGuiWindowFlags;
import imgui.type.ImBoolean; import imgui.type.ImBoolean;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs;
import love.distributedrebirth.gdxapp4d.vrgem4.ImGuiSetup; 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.DeskApp;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppContourSection; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppContourSection;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppRenderer; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppRenderer;
@ -43,7 +43,7 @@ public abstract class AbstractScreenDesktop extends ScreenAdapter implements Des
private ModelBatch modelBatch; private ModelBatch modelBatch;
private Array<ModelInstance> modelInstances = new Array<ModelInstance>(); 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(); this.create();
screenMenu = new DeskTopScreenMenu(bootArgs, deskAppService); screenMenu = new DeskTopScreenMenu(bootArgs, deskAppService);
deskAppScreen = new DeskAppController(name); 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.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; 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 = "©Δ∞ 仙上主天") @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenDesktop1 extends AbstractScreenDesktop { public class ScreenDesktop1 extends AbstractScreenDesktop {
private Model grid; private Model grid;
public ScreenDesktop1(SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) { public ScreenDesktop1(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) {
super("Desktop1", bootArgs, deskAppService); super("Desktop1", bootArgs, deskAppService);
//backgroundImage = new Texture(Gdx.files.internal("background/terrydavis-front.png")); //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.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; 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 = "©Δ∞ 仙上主天") @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenDesktop2 extends AbstractScreenDesktop { public class ScreenDesktop2 extends AbstractScreenDesktop {
private Model grid; private Model grid;
public ScreenDesktop2(SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) { public ScreenDesktop2(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) {
super("Desktop2", bootArgs, deskAppService); super("Desktop2", bootArgs, deskAppService);
//backgroundImage = new Texture(Gdx.files.internal("background/terrydavis-nose.png")); //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.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; 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 = "©Δ∞ 仙上主天") @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenDesktop3 extends AbstractScreenDesktop { public class ScreenDesktop3 extends AbstractScreenDesktop {
private Model grid; private Model grid;
public ScreenDesktop3(SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) { public ScreenDesktop3(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) {
super("Desktop3", bootArgs, 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.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs; 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 = "©Δ∞ 仙上主天") @BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenDesktop4 extends AbstractScreenDesktop { public class ScreenDesktop4 extends AbstractScreenDesktop {
@ -37,7 +37,7 @@ public class ScreenDesktop4 extends AbstractScreenDesktop {
private float colorFade = 0f; private float colorFade = 0f;
private boolean colorPositive = true; private boolean colorPositive = true;
public ScreenDesktop4(SystemGdxBootArgs bootArgs, VrGem4DeskAppService deskAppService) { public ScreenDesktop4(SystemGdxBootArgs bootArgs, VrGem4DeskAppServiceImpl deskAppService) {
super("Desktop4", bootArgs, deskAppService); super("Desktop4", bootArgs, deskAppService);
shader = new UserColorShader(); shader = new UserColorShader();
shader.init(); shader.init();

View file

@ -1,14 +1,9 @@
package love.distributedrebirth.gdxapp4d.vrgem4.service; 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.DeskAppLauncher;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection;
public interface VrGem4DeskAppService { public interface VrGem4DeskAppService {
List<DeskAppLauncher> getLaunchers(); void registrateDeskApp(DeskAppMenuSection section, DeskAppLauncher launcher);
void registrateDeskApp(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.tos4.service.SystemGdxBootArgs;
import love.distributedrebirth.gdxapp4d.vrgem4.FontAwesomeIcons; import love.distributedrebirth.gdxapp4d.vrgem4.FontAwesomeIcons;
import love.distributedrebirth.gdxapp4d.vrgem4.GDXAppVrGem4; 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.ScreenCredits;
import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop1; import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop1;
import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop2; import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop2;
import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop3; import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop3;
import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop4; import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenDesktop4;
import love.distributedrebirth.gdxapp4d.vrgem4.screen.ScreenHelp; 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.DeskApp;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppContourSection; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppContourSection;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher; 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.service.deskapp.DeskAppRenderer;
import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.SystemBaseGlyphApp; import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.SystemBaseGlyphApp;
import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.SystemBasePartApp; import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.SystemBasePartApp;
@ -31,13 +32,13 @@ import love.distributedrebirth.gdxapp4d.vrgem4.view.apps.Unicode4DApp;
public class DeskTopScreenMenu { public class DeskTopScreenMenu {
private SystemGdxBootArgs bootArgs; private SystemGdxBootArgs bootArgs;
private VrGem4DeskAppService deskAppService; private VrGem4DeskAppServiceImpl deskAppService;
private List<DeskAppLauncher> apps; private List<DeskAppLauncher> apps;
private ImBoolean fileMinimizeSelected = new ImBoolean(false); private ImBoolean fileMinimizeSelected = new ImBoolean(false);
private ImBoolean fileCloseSelected = new ImBoolean(false); private ImBoolean fileCloseSelected = new ImBoolean(false);
private ImBoolean tosSelfSelected = 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.bootArgs = bootArgs;
this.deskAppService = deskAppService; this.deskAppService = deskAppService;
apps = new ArrayList<>(); apps = new ArrayList<>();
@ -221,11 +222,23 @@ public class DeskTopScreenMenu {
} }
} }
ImGui.separator(); ImGui.separator();
for (DeskAppLauncher launcher: deskAppService.getLaunchers()) { for (DeskAppMenuSection section: DeskAppMenuSection.values()) {
if (ImGui.menuItem(launcher.getName())) { if (section.isSystem()) {
DeskApp controller = launcher.getLauncher().get(); continue;
controller.create(); }
appScreen.getDeskAppController().addDeskApp(controller); 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();
appScreen.getDeskAppController().addDeskApp(controller);
}
}
ImGui.endMenu();
} }
} }
ImGui.endMenu(); ImGui.endMenu();
@ -244,6 +257,19 @@ public class DeskTopScreenMenu {
} }
ImGui.separator(); 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")) { if (ImGui.menuItem(FontAwesomeIcons.CreditCard + " Credits")) {
GDXAppVrGem4.INSTANCE.terminal.selectScreen(ScreenCredits.class); GDXAppVrGem4.INSTANCE.terminal.selectScreen(ScreenCredits.class);
} }
@ -255,8 +281,7 @@ public class DeskTopScreenMenu {
// GDXAppVrGem4.INSTANCE.showImGuiDemo.set(true); // GDXAppVrGem4.INSTANCE.showImGuiDemo.set(true);
} }
if (ImGui.menuItem(FontAwesomeIcons.PowerOff + " Shutdown")) { if (ImGui.menuItem(FontAwesomeIcons.PowerOff + " Shutdown")) {
// GDXAppVrGem4.INSTANCE.dispose(); bootArgs.shutdown();
System.exit(0);
} }
ImGui.endMenu(); 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.tos4.service.SystemGdxLog;
import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService; import love.distributedrebirth.gdxapp4d.vrgem4.service.VrGem4DeskAppService;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher; import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher;
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection;
@Component @Component
public class BasicConsoleComponent { public class BasicConsoleComponent {
@ -21,7 +22,7 @@ public class BasicConsoleComponent {
@Activate @Activate
void open() { void open() {
log.info(this, "Activate BasicConsoleComponent"); log.info(this, "Activate BasicConsoleComponent");
deskAppService.registrateDeskApp(new DeskAppLauncher("Basic Console", () -> new BasicConsoleDeskApp())); deskAppService.registrateDeskApp(DeskAppMenuSection.PROGRAMMING, new DeskAppLauncher("Basic Console", () -> new BasicConsoleDeskApp()));
} }
@Deactivate @Deactivate