Web-fix libgdx1.11.0 support, rebased (#977)
* Support libgdx 1.9.11 * Support libgdx 1.9.13 * Support libgdx 1.9.14 * Re-enabled vtm-web and vtm-web-app
This commit is contained in:
parent
f7bdc420bf
commit
272ead2518
@ -38,6 +38,6 @@ include ':vtm-playground'
|
|||||||
include ':vtm-tests'
|
include ':vtm-tests'
|
||||||
include ':vtm-theme-comparator'
|
include ':vtm-theme-comparator'
|
||||||
include ':vtm-themes'
|
include ':vtm-themes'
|
||||||
//include ':vtm-web'
|
include ':vtm-web'
|
||||||
//include ':vtm-web-app'
|
include ':vtm-web-app'
|
||||||
//include ':vtm-web-js'
|
//include ':vtm-web-js'
|
||||||
|
|||||||
@ -580,7 +580,7 @@ public class GdxGL extends GwtGL20 implements GL {
|
|||||||
return glGetActiveAttrib(program,
|
return glGetActiveAttrib(program,
|
||||||
index,
|
index,
|
||||||
size,
|
size,
|
||||||
type);
|
(IntBuffer)type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -588,7 +588,7 @@ public class GdxGL extends GwtGL20 implements GL {
|
|||||||
return glGetActiveUniform(program,
|
return glGetActiveUniform(program,
|
||||||
index,
|
index,
|
||||||
size,
|
size,
|
||||||
type);
|
(IntBuffer)type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -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);
|
||||||
@ -53,13 +53,76 @@ public class GwtInput implements Input {
|
|||||||
long currentEventTimeStamp;
|
long currentEventTimeStamp;
|
||||||
final CanvasElement canvas;
|
final CanvasElement canvas;
|
||||||
boolean hasFocus = true;
|
boolean hasFocus = true;
|
||||||
|
final GwtApplicationConfiguration config;
|
||||||
|
GwtAccelerometer accelerometer;
|
||||||
|
GwtGyroscope gyroscope;
|
||||||
|
|
||||||
public GwtInput(CanvasElement canvas) {
|
public DefaultGwtInput(CanvasElement canvas, GwtApplicationConfiguration config) {
|
||||||
this.canvas = canvas;
|
this.canvas = canvas;
|
||||||
|
this.config = config;
|
||||||
|
|
||||||
|
if (config.useAccelerometer && GwtFeaturePolicy.allowsFeature(GwtAccelerometer.PERMISSION)) {
|
||||||
|
if (GwtApplication.agentInfo().isFirefox()) {
|
||||||
|
setupAccelerometer();
|
||||||
|
} else {
|
||||||
|
GwtPermissions.queryPermission(GwtAccelerometer.PERMISSION, new GwtPermissions.GwtPermissionResult() {
|
||||||
|
@Override
|
||||||
|
public void granted() {
|
||||||
|
setupAccelerometer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void denied() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void prompt() {
|
||||||
|
setupAccelerometer();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (config.useGyroscope) {
|
||||||
|
if (GwtApplication.agentInfo().isFirefox()) {
|
||||||
|
setupGyroscope();
|
||||||
|
} else {
|
||||||
|
GwtPermissions.queryPermission(GwtGyroscope.PERMISSION, new GwtPermissions.GwtPermissionResult() {
|
||||||
|
@Override
|
||||||
|
public void granted() {
|
||||||
|
setupGyroscope();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void denied() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void prompt() {
|
||||||
|
setupGyroscope();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
hookEvents();
|
hookEvents();
|
||||||
|
|
||||||
|
// backwards compatibility: backspace was caught in older versions
|
||||||
|
setCatchKey(Keys.BACKSPACE, true);
|
||||||
|
}
|
||||||
|
void setupAccelerometer () {
|
||||||
|
if (GwtAccelerometer.isSupported() && GwtFeaturePolicy.allowsFeature(GwtAccelerometer.PERMISSION)) {
|
||||||
|
if (accelerometer == null) accelerometer = GwtAccelerometer.getInstance();
|
||||||
|
if (!accelerometer.activated()) accelerometer.start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() {
|
void setupGyroscope () {
|
||||||
|
if (GwtGyroscope.isSupported() && GwtFeaturePolicy.allowsFeature(GwtGyroscope.PERMISSION)) {
|
||||||
|
if (gyroscope == null) gyroscope = GwtGyroscope.getInstance();
|
||||||
|
if (!gyroscope.activated()) gyroscope.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 +299,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 +520,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 +700,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();
|
||||||
@ -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;
|
||||||
@ -179,12 +179,12 @@ public abstract class GwtApplication implements EntryPoint, Application {
|
|||||||
lastWidth = graphics.getWidth();
|
lastWidth = graphics.getWidth();
|
||||||
lastHeight = graphics.getHeight();
|
lastHeight = graphics.getHeight();
|
||||||
Gdx.app = this;
|
Gdx.app = this;
|
||||||
Gdx.audio = new GwtAudio();
|
Gdx.audio = createAudio();
|
||||||
Gdx.graphics = graphics;
|
Gdx.graphics = graphics;
|
||||||
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 = createInput(graphics.canvas, this.config);
|
||||||
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;
|
||||||
@ -597,6 +597,14 @@ public abstract class GwtApplication implements EntryPoint, Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected GwtAudio createAudio() {
|
||||||
|
return new DefaultGwtAudio();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DefaultGwtInput createInput(CanvasElement canvas, GwtApplicationConfiguration config) {
|
||||||
|
return new DefaultGwtInput(canvas, config);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LoadingListener interface main purpose is to do some things before or after {@link GwtApplication#setupLoop()}
|
* LoadingListener interface main purpose is to do some things before or after {@link GwtApplication#setupLoop()}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -184,6 +184,31 @@ public class GwtGraphics implements Graphics {
|
|||||||
return canvas.getHeight();
|
return canvas.getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getBackBufferScale() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSafeInsetLeft() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSafeInsetTop() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSafeInsetBottom() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSafeInsetRight() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getFrameId() {
|
public long getFrameId() {
|
||||||
return frameId;
|
return frameId;
|
||||||
@ -517,6 +542,11 @@ public class GwtGraphics implements Graphics {
|
|||||||
public void setVSync(boolean vsync) {
|
public void setVSync(boolean vsync) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setForegroundFPS(int fps) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getDensity() {
|
public float getDensity() {
|
||||||
return 96.0f / 160;
|
return 96.0f / 160;
|
||||||
|
|||||||
@ -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
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
var TESSELLATION_LIMIT = 4096;
|
var TESSELLATION_LIMIT = 8128;
|
||||||
|
|
||||||
function j(a) {
|
function j(a) {
|
||||||
throw a;
|
throw a;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user