This commit is contained in:
Andrea Cavalli 2019-11-02 23:13:19 +01:00
parent 70ff11da7f
commit 26dc8369a7
18 changed files with 264 additions and 159 deletions

View File

@ -210,8 +210,8 @@ public class MarioScreen extends Screen {
for (int ix = 0; ix < width; ix++) {
for (int iy = 0; iy < height; iy++) {
final double distX = Math.abs(playerX - ix);
final double distY = Math.abs(playerY - iy - 1.5d);
if (distX * distX + distY * distY / 2d < 25d) {
final double distY = Math.abs(playerY - iy - 1.2d);
if (distX * distX + distY * distY / 2d < 270d) {
final byte b = w.getBlockIdAt(ix, iy);
if (b == 0) {
if (blue != 1) {

View File

@ -377,6 +377,10 @@ public class BlockContainer implements TreeContainer, GraphicalElement {
BlockContainer.initialized = true;
}
public static boolean isInitialized() {
return BlockContainer.initialized;
}
public static BinaryFont getDefaultFont(final boolean small) {
BlockContainer.checkInitialized();
return BlockContainer.defFonts[small ? 1 : 0];

View File

@ -50,7 +50,7 @@ public class LoadingScreen extends Screen {
ended = true;
StaticVars.windowZoom.submit(previousZoomValue);
WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().getHUD().show();
WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().setScreen(new MarioScreen());
WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().setScreen(new MathInputScreen());
}
mustRefresh = true;
}
@ -58,7 +58,7 @@ public class LoadingScreen extends Screen {
@Override
public void render(RenderContext ctx) {
DisplayOutputDevice display = d.display;
WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().guiSkin.use(WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().display);
WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().guiSkin.use(display);
ctx.getRenderer().glColor3i(255, 255, 255);
ctx.getRenderer().glFillRect(ctx.getWidth() / 2f - 80, ctx.getHeight() / 2f - 64, 160, 48, 0, 32, 160, 48);
ctx.getRenderer().glFillRect(ctx.getWidth() / 2f - 24, ctx.getHeight() / 2f - loadingTextTranslation, 48, 48, 160, 32, 48, 48);

View File

@ -45,6 +45,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class MathInputScreen extends Screen {
private static final BinaryFont fontBig = Utils.getFont(false);
private final boolean isCloned;
public MathContext calc;
public InputContext ic;
@ -64,6 +65,7 @@ public class MathInputScreen extends Screen {
public MathInputScreen() {
super();
historyBehavior = HistoryBehavior.NORMAL;
isCloned = false;
}
/**
@ -81,6 +83,7 @@ public class MathInputScreen extends Screen {
this.mustRefresh = old.mustRefresh;
this.result = new NormalOutputContainer(old.result);
this.userInput = new NormalInputContainer(old.userInput, this.ic);
this.isCloned = true;
}
@Override
@ -100,14 +103,18 @@ public class MathInputScreen extends Screen {
public void graphicInitialized(ScreenContext ctx) throws InterruptedException {
/* Fine caricamento */
try {
BlockContainer.initializeFonts(ctx.getGraphicEngine().loadFont("norm"), ctx.getGraphicEngine().loadFont("smal"));
if (!BlockContainer.isInitialized()) {
BlockContainer.initializeFonts(ctx.getGraphicEngine().loadFont("norm"), ctx.getGraphicEngine().loadFont("smal"));
}
} catch (final IOException e) {
e.printStackTrace();
WarpPI.getPlatform().exit(1);
}
userInput = new NormalInputContainer(ic);
result = new NormalOutputContainer();
if (!isCloned) {
userInput = new NormalInputContainer(ic);
result = new NormalOutputContainer();
}
}
@Override

View File

@ -27,7 +27,7 @@ public class Timer {
}
});
WarpPI.getPlatform().setThreadName(thread, "Timer");
thread.setDaemon(true);
WarpPI.getPlatform().setThreadDaemon(thread, true);
thread.start();
}
}

View File

@ -51,36 +51,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<!-- Maven Assembly Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<!-- get all project dependencies -->
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<!-- MainClass in mainfest make a executable jar -->
<archive>
<manifest>
<mainClass>it.cavallium.warppi.desktop.DesktopBoot</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- bind to the packaging phase -->
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
@ -91,4 +62,46 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>build-desktop-jar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<!-- Maven Assembly Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<!-- get all project dependencies -->
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<!-- MainClass in mainfest make a executable jar -->
<archive>
<manifest>
<mainClass>it.cavallium.warppi.desktop.DesktopBoot</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- bind to the packaging phase -->
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -5,6 +5,7 @@ import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicInteger;
import it.cavallium.warppi.WarpPI;
import it.cavallium.warppi.StaticVars;
@ -118,8 +119,9 @@ public class SwingEngine implements GraphicEngine {
@Deprecated()
public void refresh() {
if (WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().getScreen() == null || WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().error != null && WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().error.length() > 0 || WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().getScreen() == null || WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().getScreen().mustBeRefreshed())
if (WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().getScreen() == null || WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().error != null && WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().error.length() > 0 || WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().getScreen() == null || WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().getScreen().mustBeRefreshed()) {
INSTANCE.c.paintImmediately(0, 0, getWidth(), getHeight());
}
}
@Override

View File

@ -1,34 +1,20 @@
package it.cavallium.warppi.gui.graphicengine.impl.swing;
import java.awt.*;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import it.cavallium.warppi.StaticVars;
import it.cavallium.warppi.WarpPI;
import it.cavallium.warppi.device.input.Keyboard;
import it.cavallium.warppi.gui.graphicengine.RenderingLoop;
import it.cavallium.warppi.util.EventSubmitter;
import java.awt.event.MouseMotionListener;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import java.io.IOException;
import java.net.URISyntaxException;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JPanel;
import it.cavallium.warppi.WarpPI;
import it.cavallium.warppi.device.input.Keyboard;
import it.cavallium.warppi.StaticVars;
import it.cavallium.warppi.event.TouchEndEvent;
import it.cavallium.warppi.event.TouchMoveEvent;
import it.cavallium.warppi.event.TouchPoint;
import it.cavallium.warppi.event.TouchStartEvent;
import it.cavallium.warppi.gui.graphicengine.RenderingLoop;
import it.cavallium.warppi.util.EventSubmitter;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
public class SwingWindow extends JFrame {
private static final long serialVersionUID = 2945898937634075491L;
private final int defaultWidth;
@ -90,7 +76,7 @@ public class SwingWindow extends JFrame {
newSize[1] = 1;
var oldSize = disp.r.size;
disp.r.size = new int[] { newSize[0], newSize[1] };
disp.r.size = new int[]{newSize[0], newSize[1]};
SwingRenderer.canvas2d = new int[disp.r.size[0] * disp.r.size[1]];
var oldG = disp.g;
@ -124,12 +110,13 @@ public class SwingWindow extends JFrame {
}
@Override
public void componentMoved(final ComponentEvent e) {}
public void componentMoved(final ComponentEvent e) {
}
@Override
public void componentResized(final ComponentEvent e) {
if (windowShown) {
onResize.submit(new Integer[] { c.getWidth() / mult, c.getHeight() / mult });
onResize.submit(new Integer[]{c.getWidth() / mult, c.getHeight() / mult});
}
}
@ -162,7 +149,7 @@ public class SwingWindow extends JFrame {
StaticVars.windowZoom$.subscribe((newZoomValue) -> {
if (newZoomValue != mult) {
mult = (int) newZoomValue.floatValue();
onResize.submit(new Integer[] { getWWidth(), getWHeight() });
onResize.submit(new Integer[]{getWWidth(), getWHeight()});
WarpPI.getPlatform().getConsoleUtils().out().println(3, "Engine", "CPU", "Zoom changed");
}
});
@ -232,11 +219,13 @@ public class SwingWindow extends JFrame {
Keyboard.keyRaw(row, col, true);
c.grabFocus();
}
@Override
public void mousePressed(MouseEvent e) {
Keyboard.keyRaw(row, col, false);
c.grabFocus();
}
@Override
public void mouseExited(MouseEvent e) {
if (b.state == 2) {
@ -247,6 +236,7 @@ public class SwingWindow extends JFrame {
b.hover = false;
b.repaint();
}
@Override
public void mouseEntered(MouseEvent e) {
if (b.state == 2) {
@ -257,10 +247,11 @@ public class SwingWindow extends JFrame {
b.hover = true;
b.repaint();
}
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
}
});
buttons[row][col] = b;

View File

@ -173,7 +173,102 @@ class NEWTWindow implements GLEventListener {
glWindow.addKeyListener(new KeyListener() {
@Override
public void keyPressed(final KeyEvent arg0) {
Keyboard.debugKeyCode = arg0.getKeyCode();
switch (arg0.getKeyCode()) {
case KeyEvent.VK_ESCAPE:
Keyboard.keyPressed(Key.POWEROFF);
break;
case KeyEvent.VK_D:
Keyboard.keyPressed(Key.debug_DEG);
break;
case KeyEvent.VK_R:
Keyboard.keyPressed(Key.debug_RAD);
break;
case KeyEvent.VK_G:
Keyboard.keyPressed(Key.debug_GRA);
break;
case KeyEvent.VK_X:
if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_X);
else
Keyboard.keyPressed(Key.NONE);
break;
case KeyEvent.VK_P:
if (Keyboard.alpha)
Keyboard.keyPressed(Key.PI);
else
Keyboard.keyPressed(Key.NONE);
break;
case KeyEvent.VK_B:
if (Keyboard.shift)
Keyboard.keyPressed(Key.BRIGHTNESS_CYCLE_REVERSE);
else if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.BRIGHTNESS_CYCLE);
else
Keyboard.keyPressed(Key.ZOOM_MODE);
break;
case KeyEvent.VK_ENTER:
if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.SIMPLIFY);
else
Keyboard.keyPressed(Key.NONE);
int row = 2;
int col = 1;
Keyboard.debugKeysDown[row - 1][col - 1] = true;
break;
case KeyEvent.VK_1:
if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.debug1);
else
Keyboard.keyPressed(Key.NONE);
break;
case KeyEvent.VK_2:
if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.debug2);
else
Keyboard.keyPressed(Key.NONE);
break;
case KeyEvent.VK_3:
if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.debug3);
else
Keyboard.keyPressed(Key.NONE);
break;
case KeyEvent.VK_4:
if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.debug4);
else
Keyboard.keyPressed(Key.NONE);
break;
case KeyEvent.VK_5:
if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.debug5);
else
Keyboard.keyPressed(Key.NONE);
break;
case 0x15:
case KeyEvent.VK_SHIFT:
Keyboard.keyPressed(Key.SHIFT);
break;
case KeyEvent.VK_CONTROL:
Keyboard.keyPressed(Key.ALPHA);
break;
case KeyEvent.VK_M:
Keyboard.keyPressed(Key.SURD_MODE);
break;
case KeyEvent.VK_LEFT:
Keyboard.keyPressed(Key.LEFT);
break;
case KeyEvent.VK_RIGHT:
Keyboard.keyPressed(Key.RIGHT);
break;
case KeyEvent.VK_UP:
Keyboard.keyPressed(Key.UP);
break;
case KeyEvent.VK_DOWN:
case (short) 12:
Keyboard.keyPressed(Key.DOWN);
break;
}
}
@Override
@ -269,34 +364,17 @@ class NEWTWindow implements GLEventListener {
Keyboard.keyPressed(Key.SURD_MODE);
break;
case KeyEvent.VK_LEFT:
//LEFT
row = 2;
col = 3;
Keyboard.debugKeysDown[row - 1][col - 1] = false;
Keyboard.keyReleased(Key.LEFT);
break;
case KeyEvent.VK_RIGHT:
//RIGHT
row = 2;
col = 5;
Keyboard.debugKeysDown[row - 1][col - 1] = false;
Keyboard.keyReleased(Key.RIGHT);
break;
case KeyEvent.VK_UP:
//UP
row = 1;
col = 4;
Keyboard.debugKeysDown[row - 1][col - 1] = false;
Keyboard.keyReleased(Key.UP);
break;
case KeyEvent.VK_DOWN:
//Down
row = 3;
col = 4;
Keyboard.debugKeysDown[row - 1][col - 1] = false;
break;
case (short) 12:
//Down
row = 2;
col = 4;
Keyboard.debugKeysDown[row - 1][col - 1] = false;
Keyboard.keyReleased(Key.DOWN);
break;
}
}

13
pom.xml
View File

@ -45,9 +45,20 @@
<!-- <module>hardware</module> -->
<module>desktop</module>
<module>engine-jogl</module>
<module>teavm</module>
</modules>
<profiles>
<profile>
<id>generate-js</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<modules>
<module>teavm</module>
</modules>
</profile>
</profiles>
<repositories>
<repository>
<id>teavm-dev</id>

6
rules/rules.list Normal file
View File

@ -0,0 +1,6 @@
expand.rules
exponent.rules
fractions.rules
number.rules
undefined.rules
variable.rules

View File

@ -22,7 +22,7 @@
<dependency>
<groupId>org.teavm</groupId>
<artifactId>teavm-classlib</artifactId>
<version>0.7.0-dev-916</version>
<version>0.7.0-dev-859</version>
<scope>provided</scope>
</dependency>
</dependencies>
@ -81,7 +81,7 @@
<plugin>
<groupId>org.teavm</groupId>
<artifactId>teavm-maven-plugin</artifactId>
<version>0.7.0-dev-916</version>
<version>0.7.0-dev-859</version>
<executions>
<execution>
<goals>
@ -91,10 +91,12 @@
<configuration>
<mainClass>it.cavallium.warppi.teavm.TeaVMBoot</mainClass>
<mainPageIncluded>true</mainPageIncluded>
<debugInformationGenerated>true</debugInformationGenerated>
<debugInformationGenerated>false</debugInformationGenerated>
<sourceMapsGenerated>true</sourceMapsGenerated>
<sourceFilesCopied>true</sourceFilesCopied>
<optimizationLevel>FULL</optimizationLevel>
<minifying>true</minifying>
<runtime>SEPARATE</runtime>
</configuration>
</execution>
</executions>

View File

@ -1,6 +1,7 @@
package it.cavallium.warppi.gui.graphicengine.html;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import it.cavallium.warppi.util.EventSubmitter;
import org.teavm.jso.JSBody;
@ -28,7 +29,6 @@ import it.unimi.dsi.fastutil.objects.Object2IntArrayMap;
public class HtmlEngine implements GraphicEngine {
private boolean initialized;
public Semaphore exitSemaphore;
private static final HTMLDocument document = Window.current().getDocument();
private HTMLCanvasElement canvas;
private CanvasRenderingContext2D g;
@ -39,6 +39,7 @@ public class HtmlEngine implements GraphicEngine {
private final int frameTime = (int) (1000d / 10d);
private final EventSubmitter<Integer[]> onResize = EventSubmitter.create();
private final EventSubmitter<Float> onZoom = EventSubmitter.create();
private AtomicBoolean exitRequested = new AtomicBoolean();
@Override
public int[] getSize() {
@ -85,7 +86,6 @@ public class HtmlEngine implements GraphicEngine {
@Override
public void create(final Runnable onInitialized) {
exitSemaphore = WarpPI.getPlatform().newSemaphore(0);
width = -1;
height = -1;
canvas = (HTMLCanvasElement) HtmlEngine.document.createElement("canvas");
@ -253,7 +253,7 @@ public class HtmlEngine implements GraphicEngine {
private void destroyEngine() {
HtmlEngine.document.getBody().removeChild(canvas);
initialized = false;
exitSemaphore.release();
exitRequested.set(true);
}
@Override
@ -313,11 +313,13 @@ public class HtmlEngine implements GraphicEngine {
public void subscribeExit(Runnable subscriber) {
var thr = new Thread(() -> {
try {
exitSemaphore.acquire();
while(!exitRequested.get()) {
Thread.sleep(1000);
}
} catch (final InterruptedException e) {}
subscriber.run();
});
thr.setDaemon(true);
WarpPI.getPlatform().setThreadDaemon(thr, true);
thr.start();
}

View File

@ -46,10 +46,14 @@ public class HtmlFont extends RFTFont {
}
}
@Override
public boolean isInitialized() {
return super.isInitialized();
}
@Override
public void use(final DisplayOutputDevice d) {
if (d.getGraphicEngine().getRenderer() instanceof HtmlRenderer)
((HtmlRenderer) d.getGraphicEngine().getRenderer()).f = this;
((HtmlEngine) d.getGraphicEngine()).getRenderer().f = this;
}
}

View File

@ -230,54 +230,4 @@ public class HtmlRenderer implements Renderer {
public HtmlFont getCurrentFont() {
return f;
}
@Override
public HtmlRenderer getBoundedInstance(int dx, int dy, int width, int height) {
return new HtmlRenderer(e, g) {
@Override
public void glDrawLine(float x0, float y0, float x1, float y1) {
super.glDrawLine(x0 + dx, y0 + dy, x1, y1);
}
@Override
public void glDrawCharCenter(int x, int y, char ch) {
super.glDrawCharCenter(x + dx, y + dy, ch);
}
@Override
public void glDrawCharLeft(int x, int y, char ch) {
super.glDrawCharLeft(x + dx, y + dy, ch);
}
@Override
public void glDrawCharRight(int x, int y, char ch) {
super.glDrawCharRight(x + dx, y + dy, ch);
}
@Override
public void glFillColor(float x0, float y0, float w1, float h1) {
super.glFillColor(x0 + dx, y0 + dy, w1, h1);
}
@Override
public void glFillRect(float x, float y, float width, float height, float uvX, float uvY, float uvWidth, float uvHeight) {
super.glFillRect(x + dx, y + dy, width, height, uvX, uvY, uvWidth, uvHeight);
}
@Override
public void glDrawStringCenter(float x, float y, String text) {
super.glDrawStringCenter(x + dx, y + dy, text);
}
@Override
public void glDrawStringLeft(float x, float y, String text) {
super.glDrawStringLeft(x + dx, y + dy, text);
}
@Override
public void glDrawStringRight(float x, float y, String text) {
super.glDrawStringRight(x + dx, y + dy, text);
}
};
}
}

View File

@ -2,6 +2,7 @@ package it.cavallium.warppi.gui.graphicengine.html;
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.commons.lang3.ArrayUtils;
import org.teavm.jso.browser.Window;
@ -30,11 +31,9 @@ public class HtmlSkin implements Skin {
@Override
public void use(final DisplayOutputDevice d) {
if (d instanceof HtmlEngine) {
if (!initd)
initialize(d);
((HtmlEngine) d).getRenderer().currentSkin = this;
}
if (!initd)
initialize(d);
((HtmlEngine) d.getGraphicEngine()).getRenderer().currentSkin = this;
}
@Override
@ -45,13 +44,13 @@ public class HtmlSkin implements Skin {
@Override
public void initialize(final DisplayOutputDevice d) {
final HTMLDocument doc = Window.current().getDocument();
Boolean[] done = new Boolean[]{false};
AtomicBoolean done = new AtomicBoolean(false);
imgEl = doc.createElement("img").cast();
imgEl.addEventListener("load", (Event e) -> {
done[0] = true;
done.set(true);
});
imgEl.setSrc(url);
while (!done[0]) {
while (!done.get()) {
try {Thread.sleep(15);} catch (Exception e) {}
}
skinSize = new int[] { imgEl.getNaturalWidth(), imgEl.getNaturalHeight() };

View File

@ -7,6 +7,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import it.cavallium.warppi.boot.StartupArguments;
import it.cavallium.warppi.device.DeviceStateDevice;
@ -15,6 +16,7 @@ import it.cavallium.warppi.device.display.NoDisplaysAvailableException;
import it.cavallium.warppi.device.display.NullBacklightOutputDevice;
import it.cavallium.warppi.device.input.KeyboardInputDevice;
import it.cavallium.warppi.device.input.TouchInputDevice;
import it.cavallium.warppi.event.TouchEvent;
import it.cavallium.warppi.gui.graphicengine.html.HtmlDeviceState;
import it.cavallium.warppi.gui.graphicengine.html.HtmlDisplayOutputDevice;
import org.teavm.jso.browser.Window;
@ -224,7 +226,41 @@ public class TeaVMPlatform implements Platform {
if (displayOutputDevice instanceof HtmlDisplayOutputDevice) {
//this.touchInputDevice = new HtmlTouchInputDevice((HtmlEngine) displayOutputDevice.getGraphicEngine());
this.keyboardInputDevice = null;
//todo: implement
this.touchInputDevice = new TouchInputDevice() {
@Override
public boolean getSwappedAxes() {
return false;
}
@Override
public boolean getInvertedX() {
return false;
}
@Override
public boolean getInvertedY() {
return false;
}
@Override
public void listenTouchEvents(Consumer<TouchEvent> touchEventListener) {
}
@Override
public void initialize() {
}
};
//todo: implement
this.keyboardInputDevice = new KeyboardInputDevice() {
@Override
public void initialize() {
}
};
this.deviceStateDevice = new HtmlDeviceState((HtmlEngine) displayOutputDevice.getGraphicEngine());

View File

@ -87,7 +87,7 @@ public class TeaVMStorageUtils implements StorageUtils {
return new FileInputStream(targetFile);
else
TeaVMStorageUtils.resourcesCache.remove(path);
final URL res = new URL(getBasePath() + path);
final URL res = new URL(getBasePath() + (path.startsWith("/") ? path : "/" + path));
final InputStream initialStream = res.openStream();
final byte[] buffer = new byte[initialStream.available()];
initialStream.read(buffer);