From 779fc98680e72686b4005238b164ac37c71e876b Mon Sep 17 00:00:00 2001 From: Izumi Kawashima Date: Wed, 23 Nov 2022 23:27:36 +0900 Subject: [PATCH] Support libgdx 1.9.13 --- .../{GwtInput.java => DefaultGwtInput.java} | 22 ++++++++++++++----- .../gdx/backends/gwt/GwtApplication.java | 4 ++-- .../emu/com/badlogic/gdx/graphics/Pixmap.java | 5 +++++ .../org/oscim/gdx/resources/js/_tessellate.js | 2 +- 4 files changed, 24 insertions(+), 9 deletions(-) rename vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/{GwtInput.java => DefaultGwtInput.java} (98%) diff --git a/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtInput.java b/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/DefaultGwtInput.java similarity index 98% rename from vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtInput.java rename to vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/DefaultGwtInput.java index 68ee7994..ca6c24c5 100644 --- a/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtInput.java +++ b/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/DefaultGwtInput.java @@ -32,7 +32,7 @@ import com.google.gwt.dom.client.Touch; import com.google.gwt.event.dom.client.KeyCodes; @SuppressWarnings("deprecation") -public class GwtInput implements Input { +public class DefaultGwtInput implements Input { static final int MAX_TOUCHES = 20; boolean justTouched = false; private IntMap touchMap = new IntMap(20); @@ -54,12 +54,12 @@ public class GwtInput implements Input { final CanvasElement canvas; boolean hasFocus = true; - public GwtInput(CanvasElement canvas) { + public DefaultGwtInput(CanvasElement canvas) { this.canvas = canvas; hookEvents(); } - void reset() { + public void reset() { if (justTouched) { justTouched = false; for (int i = 0; i < justPressedButtons.length; i++) { @@ -236,10 +236,20 @@ public class GwtInput implements Input { }); } + @Override + public void getTextInput(TextInputListener listener, String title, String text, String hint, OnscreenKeyboardType type) { + + } + @Override public void setOnscreenKeyboardVisible(boolean visible) { } + @Override + public void setOnscreenKeyboardVisible(boolean visible, OnscreenKeyboardType type) { + + } + @Override public void vibrate(int milliseconds) { } @@ -447,12 +457,12 @@ public class GwtInput implements Input { } // kindly borrowed from our dear playn friends... - static native void addEventListener(JavaScriptObject target, String name, GwtInput handler, boolean capture) /*-{ + static native void addEventListener(JavaScriptObject target, String name, DefaultGwtInput handler, boolean capture) /*-{ target .addEventListener( name, function(e) { - handler.@com.badlogic.gdx.backends.gwt.GwtInput::handleEvent(Lcom/google/gwt/dom/client/NativeEvent;)(e); + handler.@com.badlogic.gdx.backends.gwt.DefaultGwtInput::handleEvent(Lcom/google/gwt/dom/client/NativeEvent;)(e); }, capture); }-*/; @@ -627,7 +637,7 @@ public class GwtInput implements Input { } if (e.getType().equals(getMouseWheelEvent())) { if (processor != null) { - processor.scrolled((int) getMouseWheelVelocity(e)); + processor.scrolled(0, (int) getMouseWheelVelocity(e)); } this.currentEventTimeStamp = TimeUtils.nanoTime(); e.preventDefault(); diff --git a/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtApplication.java b/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtApplication.java index 0ec51198..6209aedf 100644 --- a/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtApplication.java +++ b/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/backends/gwt/GwtApplication.java @@ -67,7 +67,7 @@ public abstract class GwtApplication implements EntryPoint, Application { private ApplicationListener listener; GwtApplicationConfiguration config; GwtGraphics graphics; - private GwtInput input; + private DefaultGwtInput input; private GwtNet net; private Panel root = null; private TextArea log = null; @@ -184,7 +184,7 @@ public abstract class GwtApplication implements EntryPoint, Application { Gdx.gl20 = graphics.getGL20(); Gdx.gl = Gdx.gl20; Gdx.files = new GwtFiles(preloader); - this.input = new GwtInput(graphics.canvas); + this.input = new DefaultGwtInput(graphics.canvas); Gdx.input = this.input; this.net = new GwtNet(config); Gdx.net = this.net; diff --git a/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/graphics/Pixmap.java b/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/graphics/Pixmap.java index 3fceb434..b15b27b3 100644 --- a/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/graphics/Pixmap.java +++ b/vtm-web/src/org/oscim/gdx/emu/com/badlogic/gdx/graphics/Pixmap.java @@ -27,6 +27,7 @@ import com.google.gwt.canvas.dom.client.Context2d; import com.google.gwt.canvas.dom.client.Context2d.Composite; import com.google.gwt.dom.client.CanvasElement; import com.google.gwt.dom.client.ImageElement; +import com.google.gwt.dom.client.VideoElement; import java.nio.Buffer; import java.nio.IntBuffer; @@ -234,6 +235,10 @@ public class Pixmap implements Disposable { return imageElement; } + public boolean canUseVideoElement(){return false;} + + public VideoElement getVideoElement(){return null;} + /** * Sets the color for the following drawing operations * diff --git a/vtm-web/src/org/oscim/gdx/resources/js/_tessellate.js b/vtm-web/src/org/oscim/gdx/resources/js/_tessellate.js index 3eef924a..289090f1 100644 --- a/vtm-web/src/org/oscim/gdx/resources/js/_tessellate.js +++ b/vtm-web/src/org/oscim/gdx/resources/js/_tessellate.js @@ -1,4 +1,4 @@ -var TESSELLATION_LIMIT = 4096; +var TESSELLATION_LIMIT = 8128; function j(a) { throw a;