Added calculator and fixed install/remove log
This commit is contained in:
parent
1ad97608ee
commit
b9f6cedace
|
@ -0,0 +1,39 @@
|
|||
package love.distributedrebirth.gdxapp4d.app.calculator;
|
||||
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Deactivate;
|
||||
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 CalculatorComponent {
|
||||
|
||||
@Reference
|
||||
private SystemGdxLog log;
|
||||
|
||||
@Reference
|
||||
private VrGem4DeskAppService deskAppService;
|
||||
|
||||
private final DeskAppLauncher launcher;
|
||||
|
||||
public CalculatorComponent() {
|
||||
launcher = new DeskAppLauncher("Calculator", () -> new CalculatorDeskApp());
|
||||
}
|
||||
|
||||
@Activate
|
||||
void open() {
|
||||
log.debug(this, SystemGdxLog.ACTIVATE);
|
||||
deskAppService.installDeskApp(DeskAppMenuSection.PROGRAMMING, launcher);
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
void close() {
|
||||
log.debug(this, SystemGdxLog.DEACTIVATE);
|
||||
deskAppService.installDeskApp(DeskAppMenuSection.PROGRAMMING, launcher);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
package love.distributedrebirth.gdxapp4d.app.calculator;
|
||||
|
||||
import imgui.ImGui;
|
||||
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 CalculatorDeskApp extends AbstractDeskApp implements DeskAppRenderer {
|
||||
|
||||
private String value = "";
|
||||
private String valueArg = "";
|
||||
private Operation operation = Operation.NONE;
|
||||
|
||||
public void create() {
|
||||
getContours().setTitle("Calculator");
|
||||
getContours().registrateContour(DeskAppContourSection.MAIN, this);
|
||||
}
|
||||
|
||||
enum Operation {
|
||||
NONE,
|
||||
PLUS,
|
||||
MINUS,
|
||||
MULTIPLY
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
ImGui.text("Value:");
|
||||
ImGui.sameLine();
|
||||
ImGui.text(value);
|
||||
ImGui.separator();
|
||||
|
||||
if (ImGui.button("0")) {
|
||||
value+="0";
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("1")) {
|
||||
value+="1";
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("2")) {
|
||||
value+="2";
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("3")) {
|
||||
value+="3";
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("4")) {
|
||||
value+="4";
|
||||
}
|
||||
|
||||
|
||||
if (ImGui.button("5")) {
|
||||
value+="5";
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("6")) {
|
||||
value+="6";
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("7")) {
|
||||
value+="7";
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("8")) {
|
||||
value+="8";
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("9")) {
|
||||
value+="9";
|
||||
}
|
||||
|
||||
|
||||
if (ImGui.button("C")) {
|
||||
value="";
|
||||
valueArg="";
|
||||
operation = Operation.NONE;
|
||||
}
|
||||
if (ImGui.button("+")) {
|
||||
valueArg=value;
|
||||
value="";
|
||||
operation = Operation.PLUS;
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("-")) {
|
||||
valueArg=value;
|
||||
value="";
|
||||
operation = Operation.MINUS;
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("*")) {
|
||||
valueArg=value;
|
||||
value="";
|
||||
operation = Operation.MULTIPLY;
|
||||
}
|
||||
if (ImGui.button("=")) {
|
||||
int v1 = Integer.parseInt(valueArg);
|
||||
int v2 = Integer.parseInt(value);
|
||||
int result = 0;
|
||||
switch (operation) {
|
||||
case PLUS:
|
||||
result = v1+v2;
|
||||
break;
|
||||
case MINUS:
|
||||
result = v1-v2;
|
||||
break;
|
||||
case MULTIPLY:
|
||||
result = v1*v2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
value = ""+result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,13 +19,21 @@ public class HeWalletComponent {
|
|||
@Reference
|
||||
private VrGem4DeskAppService deskAppService;
|
||||
|
||||
private final DeskAppLauncher launcher;
|
||||
|
||||
public HeWalletComponent() {
|
||||
launcher = new DeskAppLauncher("Hebrew Wallet", () -> new HeWalletDeskApp());
|
||||
}
|
||||
|
||||
@Activate
|
||||
void open() {
|
||||
log.info(this, "Activated HeWalletComponent");
|
||||
deskAppService.registrateDeskApp(DeskAppMenuSection.INTERNET, new DeskAppLauncher("Hebrew Wallet", () -> new HeWalletDeskApp()));
|
||||
log.debug(this, SystemGdxLog.ACTIVATE);
|
||||
deskAppService.installDeskApp(DeskAppMenuSection.INTERNET, launcher);
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
void close() {
|
||||
log.debug(this, SystemGdxLog.DEACTIVATE);
|
||||
deskAppService.installDeskApp(DeskAppMenuSection.INTERNET, launcher);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,13 +23,21 @@ public class TosAmpComponent {
|
|||
@Reference
|
||||
private SystemGdxBootArgs bootArgs;
|
||||
|
||||
private final DeskAppLauncher launcher;
|
||||
|
||||
public TosAmpComponent() {
|
||||
launcher = new DeskAppLauncher("TosAmp", () -> new TosAmpDeskApp(bootArgs.getFileChooser()));
|
||||
}
|
||||
|
||||
@Activate
|
||||
void open() {
|
||||
log.info(this, "Activated TosAmpComponent");
|
||||
deskAppService.registrateDeskApp(DeskAppMenuSection.MULTIMEDIA, new DeskAppLauncher("TosAmp", () -> new TosAmpDeskApp(bootArgs.getFileChooser())));
|
||||
log.debug(this, SystemGdxLog.ACTIVATE);
|
||||
deskAppService.installDeskApp(DeskAppMenuSection.MULTIMEDIA, launcher);
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
void close() {
|
||||
log.debug(this, SystemGdxLog.DEACTIVATE);
|
||||
deskAppService.installDeskApp(DeskAppMenuSection.MULTIMEDIA, launcher);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
<entry key="f8be3b29da5b6b2cb464f781469ceede6ccfd848d158293a4cdffbc2c41a410b">../gdxapp4d-chain-sys-ocean/src/chain</entry>
|
||||
<entry key="8833aa29da5b6b2cb464f781469ceede6ccfd848d158293a4cdffbc2c41b58de">../gdxapp4d-chain-dep-osgi-scr/src/chain</entry>
|
||||
|
||||
<entry key="7744aa29da5b6b2cb4b8f781469c33de688fd848d158293a4cdddbc2c41b12aa">../gdxapp4d-app-calculator/src/chain</entry>
|
||||
<entry key="7744aa29da5b6b2cb4b8f781469c33de688fd848d158293a4cdddbc2c41b12aa.gdxapp4d-app-calculator.jar">../gdxapp4d-app-calculator/target/classes</entry>
|
||||
|
||||
<entry key="6633aa29da5b6b2cb4bef781469cffde677fd848d158293a4cdffbc2c41b89fe">../gdxapp4d-app-hewallet/src/chain</entry>
|
||||
<entry key="6633aa29da5b6b2cb4bef781469cffde677fd848d158293a4cdffbc2c41b89fe.gdxapp4d-app-hewallet.jar">../gdxapp4d-app-hewallet/target/classes</entry>
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://wrap-sea.x4o.distributedrebirth.love/xml/ns/warp-sea-root http://warp-sea.x4o.distributedrebirth.love/xml/ns/warp-sea-root-1.0.xsd">
|
||||
<link:sea name="System Ocean" provider="gdxapp4d.system" author="willemtsade">
|
||||
<!-- Link app-calculator -->
|
||||
<link:chain key="7744aa29da5b6b2cb4b8f781469c33de688fd848d158293a4cdddbc2c41b12aa"/>
|
||||
<!-- Link app-hewallet -->
|
||||
<link:chain key="6633aa29da5b6b2cb4bef781469cffde677fd848d158293a4cdffbc2c41b89fe"/>
|
||||
<!-- Link app-tosamp -->
|
||||
|
|
|
@ -5,6 +5,9 @@ import love.distributedrebirth.bassboonyd.BãßBȍőnAuthorInfoʸᴰ;
|
|||
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
|
||||
public interface SystemGdxLog {
|
||||
|
||||
public static final String ACTIVATE = "Activate";
|
||||
public static final String DEACTIVATE = "Deactivate";
|
||||
|
||||
void infoTag(String tag, String message, Object...args);
|
||||
|
||||
void infoTag(String tag, String message, Throwable exception);
|
||||
|
|
|
@ -16,6 +16,7 @@ import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinOpenʸᴰ;
|
|||
import love.distributedrebirth.bassboonyd.jmx.DefaultEnumBaseᴶᴹˣ;
|
||||
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxBootArgs;
|
||||
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxFont;
|
||||
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxLog;
|
||||
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpShip;
|
||||
import love.distributedrebirth.gdxapp4d.tos4.service.SystemGdxTerminal;
|
||||
import love.distributedrebirth.gdxapp4d.tos4.service.SystemWarpSea;
|
||||
|
@ -48,12 +49,16 @@ public class GDXAppVrGem4Activator implements BundleActivator {
|
|||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
|
||||
ServiceReference<SystemGdxLog> loggerRef = context.getServiceReference(SystemGdxLog.class);
|
||||
SystemGdxLog logger = context.getService(loggerRef);
|
||||
|
||||
ServiceReference<SystemGdxTerminal> termRef = context.getServiceReference(SystemGdxTerminal.class);
|
||||
SystemGdxTerminal terminal = context.getService(termRef);
|
||||
|
||||
ServiceReference<SystemGdxFont> gdxFontRef = context.getServiceReference(SystemGdxFont.class);
|
||||
SystemGdxFont gdxFont = context.getService(gdxFontRef);
|
||||
|
||||
logger.info(this, "Booting");
|
||||
GDXAppVrGem4BootScreen bootScreen = new GDXAppVrGem4BootScreen(gdxFont.getFont());
|
||||
Gdx.app.postRunnable(new Runnable() {
|
||||
@Override
|
||||
|
@ -205,6 +210,7 @@ public class GDXAppVrGem4Activator implements BundleActivator {
|
|||
terminal.disposeScreen(bootScreen);
|
||||
}
|
||||
});
|
||||
logger.info(this, "Boot done");
|
||||
}
|
||||
|
||||
//TODO: add layer or ?? private <T extends BãßBȍőnCoffinStoreʸᴰ<?>,DefaultAuthorInfoʸᴰ> T[] storeInstances() {
|
||||
|
|
|
@ -23,7 +23,12 @@ public class VrGem4DeskAppServiceImpl implements VrGem4DeskAppService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void registrateDeskApp(DeskAppMenuSection section, DeskAppLauncher launcher) {
|
||||
public void installDeskApp(DeskAppMenuSection section, DeskAppLauncher launcher) {
|
||||
getMenuSection(section).add(launcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDeskApp(DeskAppMenuSection section, DeskAppLauncher launcher) {
|
||||
getMenuSection(section).remove(launcher);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,5 +5,7 @@ import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSectio
|
|||
|
||||
public interface VrGem4DeskAppService {
|
||||
|
||||
void registrateDeskApp(DeskAppMenuSection section, DeskAppLauncher launcher);
|
||||
void installDeskApp(DeskAppMenuSection section, DeskAppLauncher launcher);
|
||||
|
||||
void removeDeskApp(DeskAppMenuSection section, DeskAppLauncher launcher);
|
||||
}
|
||||
|
|
|
@ -19,13 +19,21 @@ public class BasicConsoleComponent {
|
|||
@Reference
|
||||
private VrGem4DeskAppService deskAppService;
|
||||
|
||||
private final DeskAppLauncher launcher;
|
||||
|
||||
public BasicConsoleComponent() {
|
||||
launcher = new DeskAppLauncher("Basic Console", () -> new BasicConsoleDeskApp());
|
||||
}
|
||||
|
||||
@Activate
|
||||
void open() {
|
||||
log.info(this, "Activate BasicConsoleComponent");
|
||||
deskAppService.registrateDeskApp(DeskAppMenuSection.PROGRAMMING, new DeskAppLauncher("Basic Console", () -> new BasicConsoleDeskApp()));
|
||||
log.debug(this, SystemGdxLog.ACTIVATE);
|
||||
deskAppService.installDeskApp(DeskAppMenuSection.SYSTEM, launcher);
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
void close() {
|
||||
log.debug(this, SystemGdxLog.DEACTIVATE);
|
||||
deskAppService.installDeskApp(DeskAppMenuSection.SYSTEM, launcher);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue