partial commit
This commit is contained in:
parent
91e79b1c03
commit
1374c5598e
2
Flow
2
Flow
@ -1 +1 @@
|
|||||||
Subproject commit e1597fb7442120bf4722f5a412b1c5eb84ba2966
|
Subproject commit c58460e49af4036df9eecb8cac7be38717cbb29e
|
@ -18,9 +18,8 @@
|
|||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-10">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="module" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
@ -1,2 +1,5 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
encoding//src/main/java=UTF-8
|
||||||
|
encoding//src/main/resources=UTF-8
|
||||||
|
encoding//src/test/java=UTF-8
|
||||||
encoding/<project>=UTF-8
|
encoding/<project>=UTF-8
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>warppi-core</artifactId>
|
<artifactId>warppi-core</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>WarpPI Calculator Core</name>
|
<name>WarpPI Calculator Core</name>
|
||||||
<description>WarpPI Calculator core project</description>
|
<description>WarpPI Calculator core project</description>
|
||||||
|
@ -133,7 +133,9 @@ public interface Platform {
|
|||||||
@Deprecated()
|
@Deprecated()
|
||||||
File getResource(String string) throws IOException, URISyntaxException;
|
File getResource(String string) throws IOException, URISyntaxException;
|
||||||
|
|
||||||
InputStream getResourceStream(String string) throws IOException, URISyntaxException;
|
boolean doesResourceExist(String string) throws IOException;
|
||||||
|
|
||||||
|
InputStream getResourceStream(String string) throws IOException;
|
||||||
|
|
||||||
List<String> readAllLines(File file) throws IOException;
|
List<String> readAllLines(File file) throws IOException;
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ public final class DisplayManager implements RenderingLoop {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void load_skin() throws IOException {
|
private void load_skin() throws IOException {
|
||||||
guiSkin = engine.loadSkin("skin.png");
|
guiSkin = engine.loadSkin("/skin.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void load_fonts() throws IOException {
|
private void load_fonts() throws IOException {
|
||||||
|
@ -29,27 +29,21 @@ public abstract class PngSkin implements Skin {
|
|||||||
if (!file.startsWith("/")) {
|
if (!file.startsWith("/")) {
|
||||||
file = "/" + file;
|
file = "/" + file;
|
||||||
}
|
}
|
||||||
try {
|
if (!file.endsWith(".png")) {
|
||||||
if (!file.endsWith(".png")) {
|
final File f = File.createTempFile("picalculator-png", ".png");
|
||||||
final File f = File.createTempFile("picalculator-png", ".png");
|
f.deleteOnExit();
|
||||||
f.deleteOnExit();
|
final BufferedImage img = ImageIO.read(Engine.getPlatform().getStorageUtils().getResourceStream(file));
|
||||||
final BufferedImage img = ImageIO.read(Engine.getPlatform().getStorageUtils().getResourceStream(file));
|
ImageIO.write(img, "PNG", f);
|
||||||
ImageIO.write(img, "PNG", f);
|
file = f.toString();
|
||||||
file = f.toString();
|
}
|
||||||
}
|
final PngReader r = Engine.getPlatform().getPngUtils().load(Engine.getPlatform().getStorageUtils().getResourceStream(file));
|
||||||
final PngReader r = Engine.getPlatform().getPngUtils().load(Engine.getPlatform().getStorageUtils().getResourceStream(file));
|
if (r == null) {
|
||||||
if (r == null) {
|
skinData = new int[0];
|
||||||
skinData = new int[0];
|
skinSize = new int[] { 0, 0 };
|
||||||
skinSize = new int[] { 0, 0 };
|
System.err.println("ERROR WHILE LOADING SKIN " + file);
|
||||||
System.err.println("ERROR WHILE LOADING SKIN " + file);
|
} else {
|
||||||
} else {
|
skinData = r.getImageMatrix();
|
||||||
skinData = r.getImageMatrix();
|
skinSize = r.getSize();
|
||||||
skinSize = r.getSize();
|
|
||||||
}
|
|
||||||
} catch (final URISyntaxException e) {
|
|
||||||
final IOException ex = new IOException();
|
|
||||||
ex.initCause(e);
|
|
||||||
throw ex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,17 +102,10 @@ public abstract class RFTFont implements BinaryFont {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadFont(String string) throws IOException {
|
private void loadFont(String string) throws IOException {
|
||||||
InputStream res;
|
if (!string.startsWith("/")) {
|
||||||
try {
|
string = "/" + string;
|
||||||
if (!string.startsWith("/")) {
|
|
||||||
string = "/" + string;
|
|
||||||
}
|
|
||||||
res = Engine.getPlatform().getStorageUtils().getResourceStream(string);
|
|
||||||
} catch (final URISyntaxException e) {
|
|
||||||
final IOException ex = new IOException();
|
|
||||||
ex.initCause(e);
|
|
||||||
throw ex;
|
|
||||||
}
|
}
|
||||||
|
InputStream res = Engine.getPlatform().getStorageUtils().getResourceStream(string);
|
||||||
final int[] file = Utils.realBytes(Utils.convertStreamToByteArray(res, res.available()));
|
final int[] file = Utils.realBytes(Utils.convertStreamToByteArray(res, res.available()));
|
||||||
final int filelength = file.length;
|
final int filelength = file.length;
|
||||||
if (filelength >= 16) {
|
if (filelength >= 16) {
|
||||||
|
@ -45,19 +45,19 @@ public class MarioScreen extends Screen {
|
|||||||
public void initialized() {
|
public void initialized() {
|
||||||
try {
|
try {
|
||||||
if (MarioScreen.skin == null) {
|
if (MarioScreen.skin == null) {
|
||||||
MarioScreen.skin = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.loadSkin("marioskin.png");
|
MarioScreen.skin = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.loadSkin("/marioskin.png");
|
||||||
}
|
}
|
||||||
if (MarioScreen.groundskin == null) {
|
if (MarioScreen.groundskin == null) {
|
||||||
MarioScreen.groundskin = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.loadSkin("marioground.png");
|
MarioScreen.groundskin = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.loadSkin("/marioground.png");
|
||||||
}
|
}
|
||||||
if (MarioScreen.gpuTest2 == null) {
|
if (MarioScreen.gpuTest2 == null) {
|
||||||
try {
|
try {
|
||||||
MarioScreen.gpuTest2 = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.loadFont("gputest2");
|
MarioScreen.gpuTest2 = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.loadFont("/gputest2");
|
||||||
} catch (final Exception ex) {}
|
} catch (final Exception ex) {}
|
||||||
}
|
}
|
||||||
if (MarioScreen.gpuTest1 == null) {
|
if (MarioScreen.gpuTest1 == null) {
|
||||||
try {
|
try {
|
||||||
MarioScreen.gpuTest1 = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.loadFont("gputest12");
|
MarioScreen.gpuTest1 = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.loadFont("/gputest12");
|
||||||
MarioScreen.gpuTest12 = true;
|
MarioScreen.gpuTest12 = true;
|
||||||
} catch (final Exception ex) {
|
} catch (final Exception ex) {
|
||||||
MarioScreen.gpuTest12 = false;
|
MarioScreen.gpuTest12 = false;
|
||||||
|
@ -178,7 +178,7 @@ public class RulesManager {
|
|||||||
Engine.getPlatform().getStorageUtils();
|
Engine.getPlatform().getStorageUtils();
|
||||||
Engine.getPlatform().getStorageUtils();
|
Engine.getPlatform().getStorageUtils();
|
||||||
Engine.getPlatform().getStorageUtils().write(tFileJava, javaCode.getBytes("UTF-8"), StorageUtils.OpenOptionWrite, StorageUtils.OpenOptionCreate);
|
Engine.getPlatform().getStorageUtils().write(tFileJava, javaCode.getBytes("UTF-8"), StorageUtils.OpenOptionWrite, StorageUtils.OpenOptionCreate);
|
||||||
final boolean compiled = Engine.getPlatform().compile(new String[] { "-nowarn", "-1.8", tFileJava.toString() }, new PrintWriter(System.out), new PrintWriter(System.err));
|
final boolean compiled = Engine.getPlatform().compile(new String[] { "-nowarn", "-10", tFileJava.toString() }, new PrintWriter(System.out), new PrintWriter(System.err));
|
||||||
if (StaticVars.startupArguments.isUncached()) {
|
if (StaticVars.startupArguments.isUncached()) {
|
||||||
tFileJava.deleteOnExit();
|
tFileJava.deleteOnExit();
|
||||||
} else {
|
} else {
|
||||||
|
@ -18,9 +18,8 @@
|
|||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-10">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="module" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
encoding//src/main/java=UTF-8
|
encoding//src/main/java=UTF-8
|
||||||
encoding//src/main/resources=UTF-8
|
encoding//src/main/resources=UTF-8
|
||||||
|
encoding//src/test/java=UTF-8
|
||||||
encoding/<project>=UTF-8
|
encoding/<project>=UTF-8
|
||||||
|
@ -10,5 +10,5 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
|||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.release=disabled
|
org.eclipse.jdt.core.compiler.release=enabled
|
||||||
org.eclipse.jdt.core.compiler.source=10
|
org.eclipse.jdt.core.compiler.source=10
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<artifactId>warppi-desktop</artifactId>
|
<artifactId>warppi-desktop</artifactId>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>WarpPI Calculator Desktop</name>
|
<name>WarpPI Calculator Desktop</name>
|
||||||
<description>WarpPI Calculator desktop project</description>
|
<description>WarpPI Calculator desktop project</description>
|
||||||
@ -36,9 +36,9 @@
|
|||||||
<version>1.3.2</version>
|
<version>1.3.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jdt.core.compiler</groupId>
|
<groupId>org.eclipse.tycho</groupId>
|
||||||
<artifactId>ecj</artifactId>
|
<artifactId>org.eclipse.jdt.core</artifactId>
|
||||||
<version>4.6.1</version>
|
<version>3.14.0.v20171206-0802</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ar.com.hjg</groupId>
|
<groupId>ar.com.hjg</groupId>
|
||||||
|
@ -91,8 +91,24 @@ public class DesktopStorageUtils implements StorageUtils {
|
|||||||
return Paths.get(string.substring(1)).toFile();
|
return Paths.get(string.substring(1)).toFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream getResourceStream(String string) throws IOException, URISyntaxException {
|
public boolean doesResourceExist(String string) throws IOException {
|
||||||
|
final URL res = ClassUtils.classLoader.getResource(string);
|
||||||
|
final boolean isResource = res != null;
|
||||||
|
if (isResource) return true;
|
||||||
|
else {
|
||||||
|
if (string.length() > 0) {
|
||||||
|
final char ch = string.charAt(0);
|
||||||
|
if (ch == '/' || ch == File.separatorChar)
|
||||||
|
string = string.substring(1);
|
||||||
|
}
|
||||||
|
return Files.exists(Paths.get(string));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InputStream getResourceStream(String string) throws IOException {
|
||||||
final URL res = ClassUtils.classLoader.getResource(string);
|
final URL res = ClassUtils.classLoader.getResource(string);
|
||||||
final boolean isResource = res != null;
|
final boolean isResource = res != null;
|
||||||
if (isResource)
|
if (isResource)
|
||||||
@ -110,6 +126,8 @@ public class DesktopStorageUtils implements StorageUtils {
|
|||||||
return Files.newInputStream(Paths.get(uri));
|
return Files.newInputStream(Paths.get(uri));
|
||||||
} catch (final java.lang.IllegalArgumentException e) {
|
} catch (final java.lang.IllegalArgumentException e) {
|
||||||
throw e;
|
throw e;
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
throw (IOException) new IOException().initCause(e);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (string.length() > 0) {
|
if (string.length() > 0) {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-9">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-10">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
encoding//src/main/java=UTF-8
|
||||||
encoding/<project>=UTF-8
|
encoding/<project>=UTF-8
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<artifactId>warppi-engine-jogl</artifactId>
|
<artifactId>warppi-engine-jogl</artifactId>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>WarpPI Calculator JOGL Engine</name>
|
<name>WarpPI Calculator JOGL Engine</name>
|
||||||
<description>WarpPI Calculator engine-jogl project</description>
|
<description>WarpPI Calculator engine-jogl project</description>
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
package it.cavallium.warppi.gui.graphicengine.impl.jogl;
|
package it.cavallium.warppi.gui.graphicengine.impl.jogl;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import com.jogamp.opengl.GLException;
|
import com.jogamp.opengl.GLException;
|
||||||
import com.jogamp.opengl.util.texture.Texture;
|
import com.jogamp.opengl.util.texture.Texture;
|
||||||
|
|
||||||
|
import it.cavallium.warppi.Engine;
|
||||||
import it.cavallium.warppi.gui.graphicengine.GraphicEngine;
|
import it.cavallium.warppi.gui.graphicengine.GraphicEngine;
|
||||||
import it.cavallium.warppi.gui.graphicengine.Skin;
|
import it.cavallium.warppi.gui.graphicengine.Skin;
|
||||||
import it.cavallium.warppi.gui.graphicengine.impl.jogl.JOGLRenderer.OpenedTextureData;
|
import it.cavallium.warppi.gui.graphicengine.impl.jogl.JOGLRenderer.OpenedTextureData;
|
||||||
@ -28,7 +30,7 @@ public class JOGLSkin implements Skin {
|
|||||||
@Override
|
@Override
|
||||||
public void load(final String file) throws IOException {
|
public void load(final String file) throws IOException {
|
||||||
final boolean isResource = !Files.exists(Paths.get(file));
|
final boolean isResource = !Files.exists(Paths.get(file));
|
||||||
if (isResource && this.getClass().getClassLoader().getResource(file) == null)
|
if (isResource && Engine.getPlatform().getStorageUtils().getResourceStream(file) == null)
|
||||||
throw new IOException("File '" + file + "' not found!");
|
throw new IOException("File '" + file + "' not found!");
|
||||||
texturePath = file;
|
texturePath = file;
|
||||||
this.isResource = isResource;
|
this.isResource = isResource;
|
||||||
|
@ -453,7 +453,7 @@ class NEWTWindow implements GLEventListener {
|
|||||||
//gl.glEnable(GL.GL_MULTISAMPLE);
|
//gl.glEnable(GL.GL_MULTISAMPLE);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
renderer.currentTex = ((JOGLSkin) disp.loadSkin("test.png")).t;
|
renderer.currentTex = ((JOGLSkin) disp.loadSkin("/test.png")).t;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,8 @@
|
|||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-10">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="module" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
encoding//src/main/java=UTF-8
|
encoding//src/main/java=UTF-8
|
||||||
|
encoding//src/test/java=UTF-8
|
||||||
encoding/<project>=UTF-8
|
encoding/<project>=UTF-8
|
||||||
|
@ -10,5 +10,5 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
|||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.release=disabled
|
org.eclipse.jdt.core.compiler.release=enabled
|
||||||
org.eclipse.jdt.core.compiler.source=10
|
org.eclipse.jdt.core.compiler.source=10
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<artifactId>warppi-hardware</artifactId>
|
<artifactId>warppi-hardware</artifactId>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>WarpPI Calculator Hardware</name>
|
<name>WarpPI Calculator Hardware</name>
|
||||||
<description>WarpPI Calculator hardware project</description>
|
<description>WarpPI Calculator hardware project</description>
|
||||||
|
@ -92,7 +92,23 @@ public class HardwareStorageUtils implements StorageUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream getResourceStream(String string) throws IOException, URISyntaxException {
|
public boolean doesResourceExist(String string) throws IOException {
|
||||||
|
final URL res = ClassUtils.classLoader.getResource(string);
|
||||||
|
final boolean isResource = res != null;
|
||||||
|
if (isResource)
|
||||||
|
return true;
|
||||||
|
else {
|
||||||
|
if (string.length() > 0) {
|
||||||
|
final char ch = string.charAt(0);
|
||||||
|
if (ch == '/' || ch == File.separatorChar)
|
||||||
|
string = string.substring(1);
|
||||||
|
}
|
||||||
|
return Files.exists(Paths.get(string));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InputStream getResourceStream(String string) throws IOException {
|
||||||
final URL res = ClassUtils.classLoader.getResource(string);
|
final URL res = ClassUtils.classLoader.getResource(string);
|
||||||
final boolean isResource = res != null;
|
final boolean isResource = res != null;
|
||||||
if (isResource)
|
if (isResource)
|
||||||
@ -110,6 +126,8 @@ public class HardwareStorageUtils implements StorageUtils {
|
|||||||
return Files.newInputStream(Paths.get(uri));
|
return Files.newInputStream(Paths.get(uri));
|
||||||
} catch (final java.lang.IllegalArgumentException e) {
|
} catch (final java.lang.IllegalArgumentException e) {
|
||||||
throw e;
|
throw e;
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
throw (IOException) new IOException().initCause(e);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (string.length() > 0) {
|
if (string.length() > 0) {
|
||||||
|
BIN
math-rules-cache.zip
Normal file
BIN
math-rules-cache.zip
Normal file
Binary file not shown.
12
pom.xml
12
pom.xml
@ -29,10 +29,10 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<project.version>0.9.0a0</project.version>
|
<project.version>0.9.0a0</project.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<maven.compiler.release>11</maven.compiler.release>
|
<maven.compiler.release>1.8</maven.compiler.release>
|
||||||
<java.version>11</java.version>
|
<java.version>1.8</java.version>
|
||||||
<src.dir>src/main/java</src.dir>
|
<src.dir>src/main/java</src.dir>
|
||||||
<src.dir2>src/main/java</src.dir2>
|
<src.dir2>src/main/java</src.dir2>
|
||||||
<src.resdir>src/main/resources</src.resdir>
|
<src.resdir>src/main/resources</src.resdir>
|
||||||
@ -45,8 +45,8 @@
|
|||||||
<module>rules</module>
|
<module>rules</module>
|
||||||
<module>hardware</module>
|
<module>hardware</module>
|
||||||
<module>desktop</module>
|
<module>desktop</module>
|
||||||
<module>teavm</module>
|
|
||||||
<module>engine-jogl</module>
|
<module>engine-jogl</module>
|
||||||
|
<module>teavm</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
@ -134,7 +134,7 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<release>11</release>
|
<release>${maven.compiler.release}</release>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-9">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-10">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
encoding//src/main/java=UTF-8
|
||||||
encoding/<project>=UTF-8
|
encoding/<project>=UTF-8
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>warppi-rules</artifactId>
|
<artifactId>warppi-rules</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>WarpPI Calculator Rules</name>
|
<name>WarpPI Calculator Rules</name>
|
||||||
<description>WarpPI Calculator rules project</description>
|
<description>WarpPI Calculator rules project</description>
|
||||||
|
@ -16,7 +16,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Exponent rule
|
* Exponent rule
|
||||||
* (a) ^ (b+c) = a ^ b + a ^ c
|
* (a) ^ (b+c) = a ^ b * a ^ c
|
||||||
*
|
*
|
||||||
* @author Andrea Cavalli
|
* @author Andrea Cavalli
|
||||||
*
|
*
|
||||||
|
@ -13,9 +13,8 @@
|
|||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-10">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="module" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
encoding//src/main/java=UTF-8
|
encoding//src/main/java=UTF-8
|
||||||
|
encoding//src/test/java=UTF-8
|
||||||
encoding/<project>=UTF-8
|
encoding/<project>=UTF-8
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=9
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=10
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
org.eclipse.jdt.core.compiler.compliance=9
|
org.eclipse.jdt.core.compiler.compliance=10
|
||||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.release=disabled
|
org.eclipse.jdt.core.compiler.release=enabled
|
||||||
org.eclipse.jdt.core.compiler.source=9
|
org.eclipse.jdt.core.compiler.source=10
|
||||||
|
@ -9,8 +9,14 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>warppi-teavm</artifactId>
|
<artifactId>warppi-teavm</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
<maven.compiler.release>1.8</maven.compiler.release>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<name>WarpPI Calculator TeaVM</name>
|
<name>WarpPI Calculator TeaVM</name>
|
||||||
<description>WarpPI Calculator teavm project</description>
|
<description>WarpPI Calculator teavm project</description>
|
||||||
@ -31,12 +37,6 @@
|
|||||||
<version>0.6.0-dev-567</version>
|
<version>0.6.0-dev-567</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.teavm</groupId>
|
|
||||||
<artifactId>teavm-extras-slf4j</artifactId>
|
|
||||||
<version>0.6.0-dev-567</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
|
@ -41,16 +41,10 @@ public class HtmlSkin implements Skin {
|
|||||||
if (!file.startsWith("/"))
|
if (!file.startsWith("/"))
|
||||||
file = "/" + file;
|
file = "/" + file;
|
||||||
url = Engine.getPlatform().getStorageUtils().getBasePath() + file;
|
url = Engine.getPlatform().getStorageUtils().getBasePath() + file;
|
||||||
try {
|
final InputStream stream = Engine.getPlatform().getStorageUtils().getResourceStream(file);
|
||||||
final InputStream stream = Engine.getPlatform().getStorageUtils().getResourceStream(file);
|
final PngReader r = new PngReader(stream);
|
||||||
final PngReader r = new PngReader(stream);
|
skinSize = new int[] { r.imgInfo.cols, r.imgInfo.rows };
|
||||||
skinSize = new int[] { r.imgInfo.cols, r.imgInfo.rows };
|
r.close();
|
||||||
r.close();
|
|
||||||
} catch (final URISyntaxException e) {
|
|
||||||
final IOException ex = new IOException();
|
|
||||||
ex.initCause(e);
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -4,12 +4,8 @@ import it.cavallium.warppi.boot.Boot;
|
|||||||
|
|
||||||
public class TeaVMBoot {
|
public class TeaVMBoot {
|
||||||
|
|
||||||
public static void main(final String[] args) {
|
public static void main(final String[] args) throws Exception {
|
||||||
try {
|
Boot.boot(new TeaVMPlatform(), args);
|
||||||
Boot.boot(new TeaVMPlatform(), args);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ public class TeaVMStorageUtils implements StorageUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream getResourceStream(final String path) throws IOException, URISyntaxException {
|
public InputStream getResourceStream(final String path) throws IOException {
|
||||||
try {
|
try {
|
||||||
File targetFile;
|
File targetFile;
|
||||||
if (TeaVMStorageUtils.resourcesCache.containsKey(path))
|
if (TeaVMStorageUtils.resourcesCache.containsKey(path))
|
||||||
@ -104,6 +104,21 @@ public class TeaVMStorageUtils implements StorageUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean doesResourceExist(final String path) throws IOException {
|
||||||
|
try {
|
||||||
|
File targetFile;
|
||||||
|
if (TeaVMStorageUtils.resourcesCache.containsKey(path))
|
||||||
|
if ((targetFile = TeaVMStorageUtils.resourcesCache.get(path)).exists())
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
TeaVMStorageUtils.resourcesCache.remove(path);
|
||||||
|
return true;
|
||||||
|
} catch (final java.lang.IllegalArgumentException e) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> readAllLines(final File file) throws IOException {
|
public List<String> readAllLines(final File file) throws IOException {
|
||||||
final Reader reader_ = new InputStreamReader(new FileInputStream(file), Charset.defaultCharset());
|
final Reader reader_ = new InputStreamReader(new FileInputStream(file), Charset.defaultCharset());
|
||||||
|
Loading…
Reference in New Issue
Block a user