Easter cleaning git
This commit is contained in:
commit
d0529bfadf
500 changed files with 116670 additions and 0 deletions
42
gdxapp4d-app-calculator/pom.xml
Normal file
42
gdxapp4d-app-calculator/pom.xml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>love.distributedrebirth.gdxapp4d</groupId>
|
||||
<artifactId>gdxapp4d</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>gdxapp4d-app-calculator</artifactId>
|
||||
<name>GDXApp⁴ᴰ-App-計算器</name>
|
||||
<packaging>bundle</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>love.distributedrebirth.gdxapp4d</groupId>
|
||||
<artifactId>gdxapp4d-vrgem4</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<exportScr>true</exportScr>
|
||||
<niceManifest>true</niceManifest>
|
||||
<instructions>
|
||||
<_donotcopy>(.git)</_donotcopy>
|
||||
<_dsannotations>*</_dsannotations>
|
||||
<_metatypeannotations>*</_metatypeannotations>
|
||||
<Import-Package>
|
||||
${tos4.packages},
|
||||
${vrgem4.packages}
|
||||
</Import-Package>
|
||||
<Bundle-Vendor>distributedrebirth.love</Bundle-Vendor>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.gdxapp4d.app.calculator;
|
||||
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
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.VrGem4LocaleService;
|
||||
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppLauncher;
|
||||
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppMenuSection;
|
||||
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
|
||||
|
||||
@Component
|
||||
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||
public class CalculatorComponent {
|
||||
|
||||
@Reference
|
||||
private SystemGdxLog log;
|
||||
|
||||
@Reference
|
||||
private VrGem4DeskAppService deskAppService;
|
||||
|
||||
@Reference
|
||||
private VrGem4LocaleService localeService;
|
||||
|
||||
private final static String I18N_BUNDLE = "love.distributedrebirth.gdxapp4d.app.calculator.Messages";
|
||||
private final DeskAppLauncher launcher;
|
||||
|
||||
public CalculatorComponent() {
|
||||
launcher = new DeskAppLauncher(DeskAppMenuSection.SCIENCE, "Calculator", () -> new CalculatorDeskApp(createBundle()));
|
||||
}
|
||||
|
||||
private ResourceBundle createBundle() {
|
||||
return ResourceBundle.getBundle(I18N_BUNDLE, localeService.getTextLocale());
|
||||
}
|
||||
|
||||
@Activate
|
||||
void open() {
|
||||
log.debug(this, SystemGdxLog.ACTIVATE);
|
||||
deskAppService.installDeskApp(launcher);
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
void close() {
|
||||
log.debug(this, SystemGdxLog.DEACTIVATE);
|
||||
deskAppService.removeDeskApp(launcher);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,232 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.gdxapp4d.app.calculator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import imgui.ImGui;
|
||||
import imgui.type.ImInt;
|
||||
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.AbstractDeskApp;
|
||||
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppContourSection;
|
||||
import love.distributedrebirth.gdxapp4d.vrgem4.service.deskapp.DeskAppRenderer;
|
||||
import ᒢᐩᐩ.ᒡᒢᑊᒻᒻᓫᔿ.ᐪᓫᕽᐪ.ᓑᣕᣳᒼᐤᒄᓫ.BaseGlyphSet;
|
||||
import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;
|
||||
|
||||
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||
public class CalculatorDeskApp extends AbstractDeskApp implements DeskAppRenderer {
|
||||
|
||||
private ResourceBundle bundle;
|
||||
private int valueNum = 0;
|
||||
private String value = "";
|
||||
private String valueLoc = "";
|
||||
private String valueArg = "";
|
||||
private Operation operation = Operation.NONE;
|
||||
private ImInt selectedNumberGlyph = new ImInt();
|
||||
private float buttonSize = 64f;
|
||||
|
||||
public CalculatorDeskApp(ResourceBundle bundle) {
|
||||
this.bundle = bundle;
|
||||
}
|
||||
|
||||
private String getTxt(String key) {
|
||||
return bundle.getString(CalculatorDeskApp.class.getSimpleName()+"."+key);
|
||||
}
|
||||
|
||||
public void create() {
|
||||
getContours().setTitle(getTxt("title"));
|
||||
getContours().registrateContour(DeskAppContourSection.MAIN, this);
|
||||
}
|
||||
|
||||
enum Operation {
|
||||
NONE,
|
||||
PLUS,
|
||||
MINUS,
|
||||
MULTIPLY,
|
||||
DIVIDE
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
|
||||
List<String> bases = new ArrayList<>();
|
||||
for (BaseGlyphSet base:BaseGlyphSet.values()) {
|
||||
bases.add(base.name());
|
||||
}
|
||||
String[] items = new String[bases.size()];
|
||||
items = bases.toArray(items);
|
||||
boolean changedLoc = ImGui.combo(getTxt("selectedNumberGlyph"), selectedNumberGlyph, items);
|
||||
String selectedItem = items[selectedNumberGlyph.get()];
|
||||
BaseGlyphSet baseNumber = BaseGlyphSet.valueOf(selectedItem);
|
||||
if (changedLoc) {
|
||||
valueLoc = baseNumber.BȍőnPrintNumber10(valueNum);
|
||||
}
|
||||
|
||||
ImGui.text("Value:");
|
||||
ImGui.sameLine();
|
||||
ImGui.text(valueLoc);
|
||||
ImGui.separator();
|
||||
|
||||
if (value.length() > 8) {
|
||||
value = "0"; // dirty limit for parseInt
|
||||
valueLoc = baseNumber.BȍőnPrintNumber10(Integer.parseInt(value));
|
||||
}
|
||||
|
||||
if (ImGui.button(baseNumber.BȍőnNumber10().BȍőnCharFor(7), buttonSize, buttonSize)) {
|
||||
value+="7";
|
||||
valueNum = Integer.parseInt(value);
|
||||
valueLoc+=baseNumber.BȍőnNumber10().BȍőnCharFor(7);
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button(baseNumber.BȍőnNumber10().BȍőnCharFor(8), buttonSize, buttonSize)) {
|
||||
value+="8";
|
||||
valueNum = Integer.parseInt(value);
|
||||
valueLoc+=baseNumber.BȍőnNumber10().BȍőnCharFor(8);
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button(baseNumber.BȍőnNumber10().BȍőnCharFor(9), buttonSize, buttonSize)) {
|
||||
value+="9";
|
||||
valueNum = Integer.parseInt(value);
|
||||
valueLoc+=baseNumber.BȍőnNumber10().BȍőnCharFor(9);
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("/", buttonSize, buttonSize)) {
|
||||
valueArg=value;
|
||||
value="";
|
||||
valueLoc="";
|
||||
operation = Operation.DIVIDE;
|
||||
}
|
||||
|
||||
if (ImGui.button(baseNumber.BȍőnNumber10().BȍőnCharFor(4), buttonSize, buttonSize)) {
|
||||
value+="4";
|
||||
valueNum = Integer.parseInt(value);
|
||||
valueLoc+=baseNumber.BȍőnNumber10().BȍőnCharFor(4);
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button(baseNumber.BȍőnNumber10().BȍőnCharFor(5), buttonSize, buttonSize)) {
|
||||
value+="5";
|
||||
valueNum = Integer.parseInt(value);
|
||||
valueLoc+=baseNumber.BȍőnNumber10().BȍőnCharFor(5);
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button(baseNumber.BȍőnNumber10().BȍőnCharFor(6), buttonSize, buttonSize)) {
|
||||
value+="6";
|
||||
valueNum = Integer.parseInt(value);
|
||||
valueLoc+=baseNumber.BȍőnNumber10().BȍőnCharFor(6);
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("*", buttonSize, buttonSize)) {
|
||||
valueArg=value;
|
||||
value="";
|
||||
valueLoc="";
|
||||
operation = Operation.MULTIPLY;
|
||||
}
|
||||
|
||||
if (ImGui.button(baseNumber.BȍőnNumber10().BȍőnCharFor(1), buttonSize, buttonSize)) {
|
||||
value+="1";
|
||||
valueNum = Integer.parseInt(value);
|
||||
valueLoc+=baseNumber.BȍőnNumber10().BȍőnCharFor(1);
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button(baseNumber.BȍőnNumber10().BȍőnCharFor(2), buttonSize, buttonSize)) {
|
||||
value+="2";
|
||||
valueNum = Integer.parseInt(value);
|
||||
valueLoc+=baseNumber.BȍőnNumber10().BȍőnCharFor(2);
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button(baseNumber.BȍőnNumber10().BȍőnCharFor(3), buttonSize, buttonSize)) {
|
||||
value+="3";
|
||||
valueNum = Integer.parseInt(value);
|
||||
valueLoc+=baseNumber.BȍőnNumber10().BȍőnCharFor(3);
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("-", buttonSize, buttonSize)) {
|
||||
valueArg=value;
|
||||
value="";
|
||||
valueLoc="";
|
||||
operation = Operation.MINUS;
|
||||
}
|
||||
|
||||
if (ImGui.button(baseNumber.BȍőnNumber10().BȍőnCharFor(0), buttonSize, buttonSize)) {
|
||||
value+="0";
|
||||
valueNum = Integer.parseInt(value);
|
||||
valueLoc+=baseNumber.BȍőnNumber10().BȍőnCharFor(0);
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("C", buttonSize, buttonSize)) {
|
||||
valueNum = 0;
|
||||
value="";
|
||||
valueLoc="";
|
||||
valueArg="";
|
||||
operation = Operation.NONE;
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("+", buttonSize, buttonSize)) {
|
||||
valueArg=value;
|
||||
value="";
|
||||
valueLoc="";
|
||||
operation = Operation.PLUS;
|
||||
}
|
||||
ImGui.sameLine();
|
||||
if (ImGui.button("=", buttonSize, buttonSize)) {
|
||||
if (value.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
int v2 = Integer.parseInt(value);
|
||||
if (valueArg.isEmpty()) {
|
||||
valueLoc = baseNumber.BȍőnPrintNumber10(v2);
|
||||
return;
|
||||
}
|
||||
int v1 = Integer.parseInt(valueArg);
|
||||
|
||||
int result = 0;
|
||||
switch (operation) {
|
||||
case PLUS:
|
||||
result = v1+v2;
|
||||
break;
|
||||
case MINUS:
|
||||
result = v1-v2;
|
||||
break;
|
||||
case MULTIPLY:
|
||||
result = v1*v2;
|
||||
break;
|
||||
case DIVIDE:
|
||||
if (v2 != 0) {
|
||||
result = v1/v2;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
valueNum = result;
|
||||
value = "" + valueNum;
|
||||
valueLoc = baseNumber.BȍőnPrintNumber10(valueNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
CalculatorDeskApp.title=Calculator
|
||||
CalculatorDeskApp.selectedNumberGlyph=Language
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
CalculatorDeskApp.title=\u8BA1\u7B97\u5668
|
||||
CalculatorDeskApp.selectedNumberGlyph=\u8BED\u8A00
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
CalculatorDeskApp.title=Calculator
|
||||
CalculatorDeskApp.selectedNumberGlyph=Language
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
CalculatorDeskApp.title=Rekenmachine
|
||||
CalculatorDeskApp.selectedNumberGlyph=Taal
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
CalculatorDeskApp.title=\u16B2\u16A8\u16DA\u16B2\u16A2\u16DA\u16A8\u16CF\u16DF\u16B1
|
||||
CalculatorDeskApp.selectedNumberGlyph=\u16DA\u16A8\u16BE\u16B7\u16A2\u16A8\u16B7\u16D6
|
||||
Loading…
Add table
Add a link
Reference in a new issue