Updated TeaVM to the latest snapshot and fixed panels history behaviour

This commit is contained in:
Andrea Cavalli 2019-02-25 13:12:22 +01:00
parent 87151ed606
commit c906c43b8b
16 changed files with 90 additions and 78 deletions

2
Flow

@ -1 +1 @@
Subproject commit 59b89e9d165c3fc615ca44aa742b531caf13fcb6 Subproject commit 92db616ef508f16fe30e8e37d17d7d7a18f56f4a

@ -1 +1 @@
Subproject commit b08a4a6aca41fbc6bf0c4bd252f716d518d368a5 Subproject commit 40d89e539223aaa9202326833a2c813bed3c6eef

View File

@ -18,7 +18,7 @@
<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/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>

View File

@ -17,7 +17,7 @@
<dependency> <dependency>
<groupId>it.cavallium</groupId> <groupId>it.cavallium</groupId>
<artifactId>warppi-flow</artifactId> <artifactId>warppi-flow</artifactId>
<version>0.9.0a3</version> <version>1.0.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>it.cavallium</groupId> <groupId>it.cavallium</groupId>

View File

@ -92,32 +92,23 @@ public final class DisplayManager implements RenderingLoop {
} }
/* /*
* private void load_skin() { * private void load_skin() { try { skin_tex = glGenTextures();
* try { * glBindTexture(GL_TEXTURE_2D, skin_tex); glPixelStorei(GL_UNPACK_ALIGNMENT,
* skin_tex = glGenTextures(); * 1);
* glBindTexture(GL_TEXTURE_2D, skin_tex);
* glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
* *
* InputStream in = new FileInputStream("skin.png"); * InputStream in = new FileInputStream("skin.png"); PNGDecoder decoder = new
* PNGDecoder decoder = new PNGDecoder(in); * PNGDecoder(in);
* *
* System.out.println("width="+decoder.getWidth()); * System.out.println("width="+decoder.getWidth());
* System.out.println("height="+decoder.getHeight()); * System.out.println("height="+decoder.getHeight());
* *
* ByteBuffer buf = * ByteBuffer buf =
* ByteBuffer.allocateDirect(4*decoder.getWidth()*decoder.getHeight()); * ByteBuffer.allocateDirect(4*decoder.getWidth()*decoder.getHeight());
* decoder.decode(buf, decoder.getWidth()*4, Format.RGBA); * decoder.decode(buf, decoder.getWidth()*4, Format.RGBA); buf.flip();
* buf.flip();
* *
* skin = buf; * skin = buf; skin_w = decoder.getWidth(); skin_h = decoder.getHeight();
* skin_w = decoder.getWidth(); * glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, skin_w, skin_h, 0, GL_RGBA,
* skin_h = decoder.getHeight(); * GL_UNSIGNED_BYTE, skin); } catch (IOException ex) { ex.printStackTrace(); } }
* glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, skin_w,
* skin_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, skin);
* } catch (IOException ex) {
* ex.printStackTrace();
* }
* }
*/ */
private GraphicEngine chooseGraphicEngine() { private GraphicEngine chooseGraphicEngine() {
@ -139,7 +130,8 @@ public final class DisplayManager implements RenderingLoop {
} }
d = Utils.getOrDefault(Engine.getPlatform().getEnginesList(), "headless 24 bit engine", null); d = Utils.getOrDefault(Engine.getPlatform().getEnginesList(), "headless 24 bit engine", null);
if (d != null && d.isSupported()) { if (d != null && d.isSupported()) {
System.err.println("Using Headless 24 bit Engine! This is a problem! No other graphic engines are available."); System.err.println(
"Using Headless 24 bit Engine! This is a problem! No other graphic engines are available.");
return d; return d;
} }
d = Utils.getOrDefault(Engine.getPlatform().getEnginesList(), "headless 256 colors engine", null); d = Utils.getOrDefault(Engine.getPlatform().getEnginesList(), "headless 256 colors engine", null);
@ -149,12 +141,14 @@ public final class DisplayManager implements RenderingLoop {
} }
d = Utils.getOrDefault(Engine.getPlatform().getEnginesList(), "headless 8 colors engine", null); d = Utils.getOrDefault(Engine.getPlatform().getEnginesList(), "headless 8 colors engine", null);
if (d != null && d.isSupported()) { if (d != null && d.isSupported()) {
System.err.println("Using Headless basic Engine! This is a problem! No other graphic engines are available."); System.err
.println("Using Headless basic Engine! This is a problem! No other graphic engines are available.");
return d; return d;
} }
d = Utils.getOrDefault(Engine.getPlatform().getEnginesList(), "HTML5 engine", null); d = Utils.getOrDefault(Engine.getPlatform().getEnginesList(), "HTML5 engine", null);
if (d != null && d.isSupported()) { if (d != null && d.isSupported()) {
Engine.getPlatform().getConsoleUtils().out().println(ConsoleUtils.OUTPUTLEVEL_NODEBUG, "Using Html Graphic Engine"); Engine.getPlatform().getConsoleUtils().out().println(ConsoleUtils.OUTPUTLEVEL_NODEBUG,
"Using Html Graphic Engine");
return d; return d;
} }
d = new NoGuiEngine(); d = new NoGuiEngine();
@ -165,8 +159,6 @@ public final class DisplayManager implements RenderingLoop {
throw new UnsupportedOperationException("No graphic engines available."); throw new UnsupportedOperationException("No graphic engines available.");
} }
public void closeScreen() { public void closeScreen() {
boolean isLastSession = sessions[1] == null; boolean isLastSession = sessions[1] == null;
if (!isLastSession) { if (!isLastSession) {
@ -186,10 +178,10 @@ public final class DisplayManager implements RenderingLoop {
} else { } else {
currentSession = 0; currentSession = 0;
} }
updateCurrentScreen(sessions[currentSession]); updateCurrentScreen(sessions[currentSession]);
} }
} }
public void setScreen(final Screen screen) { public void setScreen(final Screen screen) {
boolean mustBeAddedToHistory = screen.initialized == false; boolean mustBeAddedToHistory = screen.initialized == false;
if (!mustBeAddedToHistory) { if (!mustBeAddedToHistory) {
@ -200,34 +192,44 @@ public final class DisplayManager implements RenderingLoop {
mustBeAddedToHistory |= !found; mustBeAddedToHistory |= !found;
} }
if (mustBeAddedToHistory) { if (mustBeAddedToHistory) {
if (screen.historyBehavior == HistoryBehavior.NORMAL || screen.historyBehavior == HistoryBehavior.ALWAYS_KEEP_IN_HISTORY) { if (screen.historyBehavior == HistoryBehavior.NORMAL
|| screen.historyBehavior == HistoryBehavior.ALWAYS_KEEP_IN_HISTORY) {
if (currentSession > 0) { if (currentSession > 0) {
final int sl = sessions.length; //TODO: I don't know why if i don't add +5 or more some items disappear final int sl = sessions.length; // TODO: I don't know why if i don't add +5 or more some items
// disappear
List<Screen> newSessions = new LinkedList<>(); List<Screen> newSessions = new LinkedList<>();
int i = 0; int i = 0;
for (Screen s : sessions) { for (Screen s : sessions) {
if (i == currentSession) {
currentSession = newSessions.size();
newSessions.add(screen);
}
if (s != null) { if (s != null) {
if (i < currentSession) { if (i < currentSession) {
if (s.historyBehavior != HistoryBehavior.DONT_KEEP_IN_HISTORY)
newSessions.add(s);
} else {
if (s.historyBehavior == HistoryBehavior.ALWAYS_KEEP_IN_HISTORY) { if (s.historyBehavior == HistoryBehavior.ALWAYS_KEEP_IN_HISTORY) {
newSessions.add(s); newSessions.add(s);
} }
} else {
if (s.historyBehavior != HistoryBehavior.DONT_KEEP_IN_HISTORY)
newSessions.add(s);
} }
} }
i++; i++;
} }
sessions = newSessions.toArray(new Screen[5]); for (int j = 0; j < sl; j++) {
currentSession = newSessions.indexOf(screen); if (j < newSessions.size()) {
// sessions = Arrays.copyOfRange(sessions, currentSession, sl); sessions[j] = newSessions.get(j);
} else {
sessions[j] = null;
}
}
} else { } else {
currentSession = 0; currentSession = 0;
for (int i = sessions.length - 1; i >= 1; i--) {
sessions[i] = sessions[i - 1];
}
sessions[0] = screen;
} }
for (int i = sessions.length - 1; i >= 1; i--) {
sessions[i] = sessions[i - 1];
}
sessions[0] = screen;
} else { } else {
currentSession = -1; currentSession = -1;
} }
@ -254,7 +256,8 @@ public final class DisplayManager implements RenderingLoop {
public void replaceScreen(final Screen screen) { public void replaceScreen(final Screen screen) {
if (screen.initialized == false) { if (screen.initialized == false) {
if (screen.historyBehavior == HistoryBehavior.NORMAL || screen.historyBehavior == HistoryBehavior.ALWAYS_KEEP_IN_HISTORY) { if (screen.historyBehavior == HistoryBehavior.NORMAL
|| screen.historyBehavior == HistoryBehavior.ALWAYS_KEEP_IN_HISTORY) {
sessions[currentSession] = screen; sessions[currentSession] = screen;
} else { } else {
currentSession = -1; currentSession = -1;
@ -300,7 +303,8 @@ public final class DisplayManager implements RenderingLoop {
public void goBack() { public void goBack() {
if (canGoBack()) { if (canGoBack()) {
if (currentSession >= 0 && screen != sessions[currentSession]) {} else { if (currentSession >= 0 && screen != sessions[currentSession]) {
} else {
currentSession += 1; currentSession += 1;
} }
screen = sessions[currentSession]; screen = sessions[currentSession];
@ -359,8 +363,8 @@ public final class DisplayManager implements RenderingLoop {
fonts[1] = engine.loadFont("smallest"); fonts[1] = engine.loadFont("smallest");
fonts[2] = engine.loadFont("norm"); fonts[2] = engine.loadFont("norm");
fonts[3] = engine.loadFont("smal"); fonts[3] = engine.loadFont("smal");
//4 // 4
//fonts[5] = engine.loadFont("square"); // fonts[5] = engine.loadFont("square");
} }
private void draw_init() { private void draw_init() {
@ -391,7 +395,9 @@ public final class DisplayManager implements RenderingLoop {
fnt.use(engine); fnt.use(engine);
} }
renderer.glColor3i(129, 28, 22); renderer.glColor3i(129, 28, 22);
renderer.glDrawStringRight(StaticVars.screenSize[0] - 2, StaticVars.screenSize[1] - (fnt.getCharacterHeight() + 2), Engine.getPlatform().getSettings().getCalculatorNameUppercase() + " CALCULATOR"); renderer.glDrawStringRight(StaticVars.screenSize[0] - 2,
StaticVars.screenSize[1] - (fnt.getCharacterHeight() + 2),
Engine.getPlatform().getSettings().getCalculatorNameUppercase() + " CALCULATOR");
renderer.glColor3i(149, 32, 26); renderer.glColor3i(149, 32, 26);
renderer.glDrawStringCenter(StaticVars.screenSize[0] / 2, 22, error); renderer.glDrawStringCenter(StaticVars.screenSize[0] / 2, 22, error);
renderer.glColor3i(164, 34, 28); renderer.glColor3i(164, 34, 28);
@ -409,14 +415,16 @@ public final class DisplayManager implements RenderingLoop {
if (fonts[0] != null && fonts[0] != engine.getRenderer().getCurrentFont()) { if (fonts[0] != null && fonts[0] != engine.getRenderer().getCurrentFont()) {
fonts[0].use(engine); fonts[0].use(engine);
} }
if (hud.visible) hud.renderBackground(); if (hud.visible)
hud.renderBackground();
screen.render(); screen.render();
if (hud.visible) { if (hud.visible) {
hud.render(); hud.render();
hud.renderTopmostBackground(); hud.renderTopmostBackground();
} }
screen.renderTopmost(); screen.renderTopmost();
if (hud.visible) hud.renderTopmost(); if (hud.visible)
hud.renderTopmost();
} }
} }
@ -483,7 +491,8 @@ public final class DisplayManager implements RenderingLoop {
engine.start(getDrawable()); engine.start(getDrawable());
} catch (final Exception ex) { } catch (final Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} finally {} } finally {
}
} }
public void changeBrightness(final float change) { public void changeBrightness(final float change) {

View File

@ -23,7 +23,7 @@
<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/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>

View File

@ -1,6 +1,6 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.compliance=11
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=1.8 org.eclipse.jdt.core.compiler.source=11

View File

@ -18,7 +18,7 @@
<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/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>

View File

@ -18,7 +18,7 @@
<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/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>

View File

@ -1,6 +1,6 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.compliance=11
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=1.8 org.eclipse.jdt.core.compiler.source=11

21
pom.xml
View File

@ -28,9 +28,10 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source> <java.version>11</java.version>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>11</maven.compiler.source>
<java.version>1.8</java.version> <maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
<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>
@ -43,7 +44,7 @@
<module>bigdecimal-math</module> <module>bigdecimal-math</module>
<module>Flow</module> <module>Flow</module>
<module>rules</module> <module>rules</module>
<!-- <module>hardware</module>--> <!-- <module>hardware</module> -->
<module>desktop</module> <module>desktop</module>
<module>engine-jogl</module> <module>engine-jogl</module>
<module>teavm</module> <module>teavm</module>
@ -138,10 +139,6 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version> <version>3.8.0</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -161,6 +158,12 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version> <version>2.22.0</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
<argLine>
--illegal-access=permit
</argLine>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.felix</groupId> <groupId>org.apache.felix</groupId>
@ -212,7 +215,7 @@
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -18,7 +18,7 @@
<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/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>

View File

@ -13,7 +13,7 @@
<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/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>

View File

@ -1,6 +1,6 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.compliance=11
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=1.8 org.eclipse.jdt.core.compiler.source=11

View File

@ -27,7 +27,7 @@
<dependency> <dependency>
<groupId>org.teavm</groupId> <groupId>org.teavm</groupId>
<artifactId>teavm-classlib</artifactId> <artifactId>teavm-classlib</artifactId>
<version>0.6.0-dev-567</version> <version>0.6.0-dev-682</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@ -86,7 +86,7 @@
<plugin> <plugin>
<groupId>org.teavm</groupId> <groupId>org.teavm</groupId>
<artifactId>teavm-maven-plugin</artifactId> <artifactId>teavm-maven-plugin</artifactId>
<version>0.6.0-dev-567</version> <version>0.6.0-dev-682</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>

View File

@ -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-1.8"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>