Support libgdx 1.9.13

This commit is contained in:
Izumi Kawashima 2022-11-23 23:27:36 +09:00
parent 4dfabfed22
commit 559f71246d
7 changed files with 28 additions and 13 deletions

View File

@ -6,7 +6,7 @@ allprojects {
group = 'org.mapsforge' group = 'org.mapsforge'
version = 'master-SNAPSHOT' version = 'master-SNAPSHOT'
ext.gdxVersion = "1.9.11" ext.gdxVersion = "1.9.13"
ext.gwtVersion = "2.8.2" ext.gwtVersion = "2.8.2"
ext.slf4jVersion = "1.7.28" ext.slf4jVersion = "1.7.28"

View File

@ -255,10 +255,10 @@ public class InputHandler implements InputProcessor {
} }
@Override @Override
public boolean scrolled(int amount) { public boolean scrolled(float amountX, float amountY) {
float fx = mPosX - mMap.getWidth() / 2; float fx = mPosX - mMap.getWidth() / 2;
float fy = mPosY - mMap.getHeight() / 2; float fy = mPosY - mMap.getHeight() / 2;
mMap.animator().animateZoom(250, amount > 0 ? 0.75f : 1.333f, fx, fy, Easing.Type.LINEAR); mMap.animator().animateZoom(250, amountY > 0 ? 0.75f : 1.333f, fx, fy, Easing.Type.LINEAR);
mMap.updateMap(false); mMap.updateMap(false);
return true; return true;
} }

View File

@ -211,7 +211,7 @@ public class MotionHandler extends MotionEvent implements InputProcessor {
} }
@Override @Override
public boolean scrolled(int amount) { public boolean scrolled(float amountX, float amountY) {
mTime = Gdx.input.getCurrentEventTime(); mTime = Gdx.input.getCurrentEventTime();
return false; return false;

View File

@ -32,7 +32,7 @@ import com.google.gwt.dom.client.Touch;
import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyCodes;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class GwtInput implements Input { public class DefaultGwtInput implements Input {
static final int MAX_TOUCHES = 20; static final int MAX_TOUCHES = 20;
boolean justTouched = false; boolean justTouched = false;
private IntMap<Integer> touchMap = new IntMap<Integer>(20); private IntMap<Integer> touchMap = new IntMap<Integer>(20);
@ -54,12 +54,12 @@ public class GwtInput implements Input {
final CanvasElement canvas; final CanvasElement canvas;
boolean hasFocus = true; boolean hasFocus = true;
public GwtInput(CanvasElement canvas) { public DefaultGwtInput(CanvasElement canvas) {
this.canvas = canvas; this.canvas = canvas;
hookEvents(); hookEvents();
} }
void reset() { public void reset() {
if (justTouched) { if (justTouched) {
justTouched = false; justTouched = false;
for (int i = 0; i < justPressedButtons.length; i++) { 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 @Override
public void setOnscreenKeyboardVisible(boolean visible) { public void setOnscreenKeyboardVisible(boolean visible) {
} }
@Override
public void setOnscreenKeyboardVisible(boolean visible, OnscreenKeyboardType type) {
}
@Override @Override
public void vibrate(int milliseconds) { public void vibrate(int milliseconds) {
} }
@ -447,12 +457,12 @@ public class GwtInput implements Input {
} }
// kindly borrowed from our dear playn friends... // 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 target
.addEventListener( .addEventListener(
name, name,
function(e) { 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); }, capture);
}-*/; }-*/;
@ -627,7 +637,7 @@ public class GwtInput implements Input {
} }
if (e.getType().equals(getMouseWheelEvent())) { if (e.getType().equals(getMouseWheelEvent())) {
if (processor != null) { if (processor != null) {
processor.scrolled((int) getMouseWheelVelocity(e)); processor.scrolled(0, (int) getMouseWheelVelocity(e));
} }
this.currentEventTimeStamp = TimeUtils.nanoTime(); this.currentEventTimeStamp = TimeUtils.nanoTime();
e.preventDefault(); e.preventDefault();

View File

@ -67,7 +67,7 @@ public abstract class GwtApplication implements EntryPoint, Application {
private ApplicationListener listener; private ApplicationListener listener;
GwtApplicationConfiguration config; GwtApplicationConfiguration config;
GwtGraphics graphics; GwtGraphics graphics;
private GwtInput input; private DefaultGwtInput input;
private GwtNet net; private GwtNet net;
private Panel root = null; private Panel root = null;
private TextArea log = null; private TextArea log = null;
@ -184,7 +184,7 @@ public abstract class GwtApplication implements EntryPoint, Application {
Gdx.gl20 = graphics.getGL20(); Gdx.gl20 = graphics.getGL20();
Gdx.gl = Gdx.gl20; Gdx.gl = Gdx.gl20;
Gdx.files = new GwtFiles(preloader); Gdx.files = new GwtFiles(preloader);
this.input = new GwtInput(graphics.canvas); this.input = new DefaultGwtInput(graphics.canvas);
Gdx.input = this.input; Gdx.input = this.input;
this.net = new GwtNet(config); this.net = new GwtNet(config);
Gdx.net = this.net; Gdx.net = this.net;

View File

@ -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.canvas.dom.client.Context2d.Composite;
import com.google.gwt.dom.client.CanvasElement; import com.google.gwt.dom.client.CanvasElement;
import com.google.gwt.dom.client.ImageElement; import com.google.gwt.dom.client.ImageElement;
import com.google.gwt.dom.client.VideoElement;
import java.nio.Buffer; import java.nio.Buffer;
import java.nio.IntBuffer; import java.nio.IntBuffer;
@ -234,6 +235,10 @@ public class Pixmap implements Disposable {
return imageElement; return imageElement;
} }
public boolean canUseVideoElement(){return false;}
public VideoElement getVideoElement(){return null;}
/** /**
* Sets the color for the following drawing operations * Sets the color for the following drawing operations
* *

View File

@ -1,4 +1,4 @@
var TESSELLATION_LIMIT = 4096; var TESSELLATION_LIMIT = 8128;
function j(a) { function j(a) {
throw a; throw a;