mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-04 15:27:30 +07:00
Upgraded LibGDX from 1.9.11 -> 1.9.13
API change scrolled(int) -> scrolled(float,float) Changed switches to if/else, asserting non-zero amounts API change gdx.utils.Pool removed prefill argument -- adjusted code Note: DS1Viewer remains broken, API updated anyways
This commit is contained in:
@ -2,20 +2,19 @@ package com.riiablo.console;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
import com.badlogic.gdx.Application;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input;
|
||||
import com.badlogic.gdx.InputProcessor;
|
||||
|
||||
import com.riiablo.util.StringUtils;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
public class Console implements InputProcessor {
|
||||
private static final int INITIAL_BUFFER_CAPACITY = 128;
|
||||
|
||||
@ -207,7 +206,7 @@ public class Console implements InputProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean scrolled(int amount) {
|
||||
public boolean scrolled(float amountX, float amountY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -295,24 +295,19 @@ public class RenderedConsole extends Console implements Disposable, InputProcess
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean scrolled(int amount) {
|
||||
public boolean scrolled(float amountX, float amountY) {
|
||||
if (!visible) return false;
|
||||
switch (amount) {
|
||||
case -1:
|
||||
if (scrollOffset > 0) {
|
||||
scrollOffset--;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (scrollOffset < OUTPUT.size) {
|
||||
scrollOffset++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Gdx.app.error(TAG, "Unexpected scroll amount: " + amount);
|
||||
if (amountY < 0) {
|
||||
if (scrollOffset > 0) {
|
||||
scrollOffset--;
|
||||
}
|
||||
} else {
|
||||
if (scrollOffset < OUTPUT.size) {
|
||||
scrollOffset++;
|
||||
}
|
||||
}
|
||||
|
||||
super.scrolled(amount);
|
||||
super.scrolled(amountX, amountY);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -39,14 +39,19 @@ public class ADPCM {
|
||||
byte stepIndex;
|
||||
}
|
||||
|
||||
private static final Pool<Channel[]> POOL = new Pool<Channel[]>(8, 64, true) {
|
||||
@Override
|
||||
protected Channel[] newObject() {
|
||||
final Channel[] channels = new Channel[CHANNELS];
|
||||
for (int i = 0; i < CHANNELS; i++) channels[i] = new Channel();
|
||||
return channels;
|
||||
}
|
||||
};
|
||||
private static final Pool<Channel[]> POOL;
|
||||
static {
|
||||
final int initialCapacity = 8, max = 64;
|
||||
POOL = new Pool<Channel[]>(initialCapacity, max) {
|
||||
@Override
|
||||
protected Channel[] newObject() {
|
||||
final Channel[] channels = new Channel[CHANNELS];
|
||||
for (int i = 0; i < CHANNELS; i++) channels[i] = new Channel();
|
||||
return channels;
|
||||
}
|
||||
};
|
||||
POOL.fill(initialCapacity);
|
||||
}
|
||||
|
||||
public static void decompress(ByteBuffer in, ByteBuffer out, int numChannels) {
|
||||
Channel[] channels = POOL.obtain();
|
||||
|
@ -159,11 +159,16 @@ public final class Exploder {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Pool<byte[]> BYTES = new Pool<byte[]>(1, 8, true) {
|
||||
@Override
|
||||
protected byte[] newObject() {
|
||||
return new byte[0x1000];
|
||||
}
|
||||
private static final Pool<byte[]> BYTES;
|
||||
static {
|
||||
final int initialCapacity = 1, max = 8;
|
||||
BYTES = new Pool<byte[]>(initialCapacity, max) {
|
||||
@Override
|
||||
protected byte[] newObject() {
|
||||
return new byte[0x1000];
|
||||
}
|
||||
};
|
||||
BYTES.fill(initialCapacity);
|
||||
};
|
||||
|
||||
public static ByteBuf pkexplode(final ByteBuf inout) {
|
||||
|
@ -445,21 +445,15 @@ public class GameScreen extends ScreenAdapter implements GameLoadingScreen.Loada
|
||||
private final float ZOOM_AMOUNT = 0.1f;
|
||||
|
||||
@Override
|
||||
public boolean scrolled(int amount) {
|
||||
switch (amount) {
|
||||
case -1:
|
||||
if (UIUtils.ctrl()) {
|
||||
renderer.zoom(Math.max(0.20f, renderer.zoom() - ZOOM_AMOUNT));
|
||||
}
|
||||
|
||||
break;
|
||||
case 1:
|
||||
if (UIUtils.ctrl()) {
|
||||
renderer.zoom(Math.min(5.00f, renderer.zoom() + ZOOM_AMOUNT));
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
public boolean scrolled(float amountX, float amountY) {
|
||||
if (amountY < 0) {
|
||||
if (UIUtils.ctrl()) {
|
||||
renderer.zoom(Math.max(0.20f, renderer.zoom() - ZOOM_AMOUNT));
|
||||
}
|
||||
} else {
|
||||
if (UIUtils.ctrl()) {
|
||||
renderer.zoom(Math.min(5.00f, renderer.zoom() + ZOOM_AMOUNT));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -86,6 +86,7 @@ public class ScrollPane extends WidgetGroup {
|
||||
addCaptureListener(new InputListener() {
|
||||
private float handlePosition;
|
||||
|
||||
@Override
|
||||
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
|
||||
if (draggingPointer != -1) return false;
|
||||
if (pointer == 0 && button != 0) return false;
|
||||
@ -124,11 +125,13 @@ public class ScrollPane extends WidgetGroup {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
|
||||
if (pointer != draggingPointer) return;
|
||||
cancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void touchDragged (InputEvent event, float x, float y, int pointer) {
|
||||
if (pointer != draggingPointer) return;
|
||||
if (touchScrollH) {
|
||||
@ -152,6 +155,7 @@ public class ScrollPane extends WidgetGroup {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseMoved (InputEvent event, float x, float y) {
|
||||
if (!flickScroll) setScrollbarsVisible(true);
|
||||
return false;
|
||||
@ -159,6 +163,7 @@ public class ScrollPane extends WidgetGroup {
|
||||
});
|
||||
|
||||
flickScrollListener = new ActorGestureListener() {
|
||||
@Override
|
||||
public void pan (InputEvent event, float x, float y, float deltaX, float deltaY) {
|
||||
setScrollbarsVisible(true);
|
||||
amountX -= deltaX;
|
||||
@ -167,6 +172,7 @@ public class ScrollPane extends WidgetGroup {
|
||||
if (cancelTouchFocus && ((scrollX && deltaX != 0) || (scrollY && deltaY != 0))) cancelTouchFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fling (InputEvent event, float x, float y, int button) {
|
||||
if (Math.abs(x) > 150 && scrollX) {
|
||||
flingTimer = flingTime;
|
||||
@ -180,6 +186,7 @@ public class ScrollPane extends WidgetGroup {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle (Event event) {
|
||||
if (super.handle(event)) {
|
||||
if (((InputEvent)event).getType() == InputEvent.Type.touchDown) flingTimer = 0;
|
||||
@ -192,12 +199,13 @@ public class ScrollPane extends WidgetGroup {
|
||||
addListener(flickScrollListener);
|
||||
|
||||
addListener(new InputListener() {
|
||||
public boolean scrolled (InputEvent event, float x, float y, int amount) {
|
||||
@Override
|
||||
public boolean scrolled (InputEvent event, float x, float y, float amountX, float amountY) {
|
||||
setScrollbarsVisible(true);
|
||||
if (scrollY)
|
||||
setScrollY(amountY + getMouseWheelY() * amount);
|
||||
setScrollY(amountY + getMouseWheelY() * amountY);
|
||||
else if (scrollX) //
|
||||
setScrollX(amountX + getMouseWheelX() * amount);
|
||||
setScrollX(amountX + getMouseWheelX() * amountY);
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
@ -252,6 +260,7 @@ public class ScrollPane extends WidgetGroup {
|
||||
return style;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act (float delta) {
|
||||
super.act(delta);
|
||||
|
||||
@ -350,6 +359,7 @@ public class ScrollPane extends WidgetGroup {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layout () {
|
||||
final Drawable bg = style.background;
|
||||
final Drawable hScrollKnob = style.hScrollKnob;
|
||||
@ -627,6 +637,7 @@ public class ScrollPane extends WidgetGroup {
|
||||
this.velocityY = velocityY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPrefWidth () {
|
||||
if (widget instanceof Layout) {
|
||||
float width = ((Layout)widget).getPrefWidth();
|
||||
@ -642,6 +653,7 @@ public class ScrollPane extends WidgetGroup {
|
||||
return 150;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPrefHeight () {
|
||||
if (widget instanceof Layout) {
|
||||
float height = ((Layout)widget).getPrefHeight();
|
||||
@ -657,10 +669,12 @@ public class ScrollPane extends WidgetGroup {
|
||||
return 150;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMinWidth () {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMinHeight () {
|
||||
return 0;
|
||||
}
|
||||
@ -691,28 +705,33 @@ public class ScrollPane extends WidgetGroup {
|
||||
|
||||
/** @deprecated ScrollPane may have only a single child.
|
||||
* @see #setWidget(Actor) */
|
||||
@Override
|
||||
public void addActor (Actor actor) {
|
||||
throw new UnsupportedOperationException("Use ScrollPane#setWidget.");
|
||||
}
|
||||
|
||||
/** @deprecated ScrollPane may have only a single child.
|
||||
* @see #setWidget(Actor) */
|
||||
@Override
|
||||
public void addActorAt (int index, Actor actor) {
|
||||
throw new UnsupportedOperationException("Use ScrollPane#setWidget.");
|
||||
}
|
||||
|
||||
/** @deprecated ScrollPane may have only a single child.
|
||||
* @see #setWidget(Actor) */
|
||||
@Override
|
||||
public void addActorBefore (Actor actorBefore, Actor actor) {
|
||||
throw new UnsupportedOperationException("Use ScrollPane#setWidget.");
|
||||
}
|
||||
|
||||
/** @deprecated ScrollPane may have only a single child.
|
||||
* @see #setWidget(Actor) */
|
||||
@Override
|
||||
public void addActorAfter (Actor actorAfter, Actor actor) {
|
||||
throw new UnsupportedOperationException("Use ScrollPane#setWidget.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeActor (Actor actor) {
|
||||
if (actor == null) throw new IllegalArgumentException("actor cannot be null.");
|
||||
if (actor != widget) return false;
|
||||
@ -720,6 +739,7 @@ public class ScrollPane extends WidgetGroup {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeActor (Actor actor, boolean unfocus) {
|
||||
if (actor == null) throw new IllegalArgumentException("actor cannot be null.");
|
||||
if (actor != widget) return false;
|
||||
@ -727,6 +747,7 @@ public class ScrollPane extends WidgetGroup {
|
||||
return super.removeActor(actor, unfocus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Actor hit (float x, float y, boolean touchable) {
|
||||
if (x < 0 || x >= getWidth() || y < 0 || y >= getHeight()) return null;
|
||||
if (touchable && getTouchable() == Touchable.enabled && isVisible()) {
|
||||
@ -1078,6 +1099,7 @@ public class ScrollPane extends WidgetGroup {
|
||||
this.cancelTouchFocus = cancelTouchFocus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawDebug (ShapeRenderer shapes) {
|
||||
shapes.flush();
|
||||
applyTransform(shapes, computeTransform());
|
||||
|
@ -4,7 +4,7 @@ org.gradle.configureondemand=false
|
||||
|
||||
androidBuildToolsPluginVersion=4.0.1
|
||||
flatbuffersPluginVersion=1.0.7
|
||||
gdxVersion=1.9.11
|
||||
gdxVersion=1.9.13
|
||||
artemisOdbVersion=2.3.0
|
||||
artemisContribVersion=2.4.0
|
||||
gdxAiVersion=1.8.2
|
||||
|
@ -66,10 +66,10 @@ public class CameraTool extends Tool {
|
||||
|
||||
Gdx.input.setInputProcessor(new InputAdapter() {
|
||||
@Override
|
||||
public boolean scrolled(int amount) {
|
||||
iso.zoom += (amount * 0.05);
|
||||
public boolean scrolled(float amountX, float amountY) {
|
||||
iso.zoom += (amountY * 0.05);
|
||||
iso.zoom = MathUtils.clamp(iso.zoom, 0.05f, 2f);
|
||||
return super.scrolled(amount);
|
||||
return super.scrolled(amountX, amountY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,9 @@
|
||||
package com.riiablo.map;
|
||||
|
||||
import com.kotcrab.vis.ui.VisUI;
|
||||
import com.kotcrab.vis.ui.widget.VisSelectBox;
|
||||
import com.kotcrab.vis.ui.widget.VisTable;
|
||||
|
||||
import com.badlogic.gdx.Application;
|
||||
import com.badlogic.gdx.ApplicationAdapter;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
@ -24,9 +28,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException;
|
||||
import com.kotcrab.vis.ui.VisUI;
|
||||
import com.kotcrab.vis.ui.widget.VisSelectBox;
|
||||
import com.kotcrab.vis.ui.widget.VisTable;
|
||||
|
||||
import com.riiablo.COFs;
|
||||
import com.riiablo.Files;
|
||||
import com.riiablo.Palettes;
|
||||
@ -40,7 +42,6 @@ import com.riiablo.codec.excel.LvlTypes;
|
||||
import com.riiablo.graphics.PaletteIndexedBatch;
|
||||
import com.riiablo.loader.COFLoader;
|
||||
import com.riiablo.loader.DCCLoader;
|
||||
import com.riiablo.loader.TXTLoader;
|
||||
import com.riiablo.mpq.MPQFileHandleResolver;
|
||||
|
||||
public class DS1Viewer extends ApplicationAdapter {
|
||||
@ -199,15 +200,11 @@ public class DS1Viewer extends ApplicationAdapter {
|
||||
private final float ZOOM_AMOUNT = 0.1f;
|
||||
|
||||
@Override
|
||||
public boolean scrolled(int amount) {
|
||||
switch (amount) {
|
||||
case -1:
|
||||
camera.zoom = Math.max(0.25f, camera.zoom - ZOOM_AMOUNT);
|
||||
break;
|
||||
case 1:
|
||||
camera.zoom = Math.min(10.0f, camera.zoom + ZOOM_AMOUNT);
|
||||
break;
|
||||
default:
|
||||
public boolean scrolled(float amountX, float amountY) {
|
||||
if (amountY < 0) {
|
||||
camera.zoom = Math.max(0.25f, camera.zoom - ZOOM_AMOUNT);
|
||||
} else {
|
||||
camera.zoom = Math.min(10.0f, camera.zoom + ZOOM_AMOUNT);
|
||||
}
|
||||
|
||||
camera.update();
|
||||
|
@ -430,15 +430,11 @@ public class MapViewer extends Tool {
|
||||
private final float ZOOM_AMOUNT = 0.1f;
|
||||
|
||||
@Override
|
||||
public boolean scrolled(int amount) {
|
||||
switch (amount) {
|
||||
case -1:
|
||||
mapRenderer.zoom(Math.max(0.20f, mapRenderer.zoom() - ZOOM_AMOUNT));
|
||||
break;
|
||||
case 1:
|
||||
mapRenderer.zoom(Math.min(2.50f, mapRenderer.zoom() + ZOOM_AMOUNT));
|
||||
break;
|
||||
default:
|
||||
public boolean scrolled(float amountX, float amountY) {
|
||||
if (amountX < 0) {
|
||||
mapRenderer.zoom(Math.max(0.20f, mapRenderer.zoom() - ZOOM_AMOUNT));
|
||||
} else {
|
||||
mapRenderer.zoom(Math.min(2.50f, mapRenderer.zoom() + ZOOM_AMOUNT));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user