v0.9.4: updated libGDX to 1.10.0, dropping support for Android 2.3/3
This commit is contained in:
@@ -7,7 +7,6 @@ dependencies {
|
|||||||
//TODO migrate this to implementation from api
|
//TODO migrate this to implementation from api
|
||||||
//in order to do this I have to remove 100% of libGDX API access from core
|
//in order to do this I have to remove 100% of libGDX API access from core
|
||||||
api "com.badlogicgames.gdx:gdx:$gdxVersion"
|
api "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||||
implementation "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
|
|
||||||
implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
|
implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
|
||||||
|
|
||||||
//noinspection GradleDependency , later JSON versions cause crashes on old versions of android
|
//noinspection GradleDependency , later JSON versions cause crashes on old versions of android
|
||||||
|
|||||||
@@ -109,8 +109,8 @@ public class InputHandler extends InputAdapter {
|
|||||||
// ********************
|
// ********************
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean scrolled(int amount) {
|
public boolean scrolled(float amountX, float amountY) {
|
||||||
ScrollEvent.addScrollEvent( new ScrollEvent(pointerHoverPos, amount));
|
ScrollEvent.addScrollEvent( new ScrollEvent(pointerHoverPos, amountY));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ import java.util.ArrayList;
|
|||||||
public class ScrollEvent {
|
public class ScrollEvent {
|
||||||
|
|
||||||
public PointF pos;
|
public PointF pos;
|
||||||
public int amount;
|
public float amount;
|
||||||
|
|
||||||
public ScrollEvent(PointF mousePos, int amount){
|
public ScrollEvent(PointF mousePos, float amount){
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
this.pos = mousePos;
|
this.pos = mousePos;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class DeviceCompat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void openURI( String URI ){
|
public static void openURI( String URI ){
|
||||||
Game.platform.openURI(URI);
|
Gdx.net.openURI(URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log( String tag, String message ){
|
public static void log( String tag, String message ){
|
||||||
|
|||||||
@@ -31,10 +31,6 @@ public abstract class PlatformSupport {
|
|||||||
|
|
||||||
public abstract boolean connectedToUnmeteredNetwork();
|
public abstract boolean connectedToUnmeteredNetwork();
|
||||||
|
|
||||||
//FIXME this is a temporary method to workaround a bug in libGDX with Android 11+
|
|
||||||
//it can be removed once Shattered is updated to libGDX 1.9.14+
|
|
||||||
public abstract boolean openURI( String URI );
|
|
||||||
|
|
||||||
//FIXME this is currently used because no platform-agnostic text input has been implemented.
|
//FIXME this is currently used because no platform-agnostic text input has been implemented.
|
||||||
//should look into doing that using either plain openGL or libgdx's libraries
|
//should look into doing that using either plain openGL or libgdx's libraries
|
||||||
public abstract void promptTextInput( String title, String hintText, int maxLen, boolean multiLine,
|
public abstract void promptTextInput( String title, String hintText, int maxLen, boolean multiLine,
|
||||||
|
|||||||
@@ -60,15 +60,11 @@ dependencies {
|
|||||||
implementation project(':core')
|
implementation project(':core')
|
||||||
|
|
||||||
implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
|
implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
|
||||||
implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
|
|
||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
|
|
||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
|
||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
|
||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
|
||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
|
||||||
implementation "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
|
implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
|
||||||
implementation "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion"
|
|
||||||
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
|
|
||||||
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
|
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
|
||||||
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
|
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
|
||||||
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
|
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
|
||||||
@@ -79,19 +75,17 @@ dependencies {
|
|||||||
// the natives configuration, and extracts them to the proper libs/ folders
|
// the natives configuration, and extracts them to the proper libs/ folders
|
||||||
// so they get packed with the APK.
|
// so they get packed with the APK.
|
||||||
task copyAndroidNatives() {
|
task copyAndroidNatives() {
|
||||||
file("libs/armeabi/").mkdirs()
|
|
||||||
file("libs/armeabi-v7a/").mkdirs()
|
file("libs/armeabi-v7a/").mkdirs()
|
||||||
file("libs/arm64-v8a/").mkdirs()
|
file("libs/arm64-v8a/").mkdirs()
|
||||||
file("libs/x86_64/").mkdirs()
|
|
||||||
file("libs/x86/").mkdirs()
|
file("libs/x86/").mkdirs()
|
||||||
|
file("libs/x86_64/").mkdirs()
|
||||||
|
|
||||||
configurations.natives.copy().files.each { jar ->
|
configurations.natives.copy().files.each { jar ->
|
||||||
def outputDir = null
|
def outputDir = null
|
||||||
if(jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
|
|
||||||
if(jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
|
if(jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
|
||||||
if(jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi")
|
if(jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
|
||||||
if(jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64")
|
|
||||||
if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
|
if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
|
||||||
|
if(jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64")
|
||||||
if(outputDir != null) {
|
if(outputDir != null) {
|
||||||
copy {
|
copy {
|
||||||
from zipTree(jar)
|
from zipTree(jar)
|
||||||
|
|||||||
@@ -173,23 +173,6 @@ public class AndroidPlatformSupport extends PlatformSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean openURI(String URI) {
|
|
||||||
//copied from LibGDX 1.9.14 source
|
|
||||||
final Uri uri = Uri.parse(URI);
|
|
||||||
try {
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
|
||||||
// LiveWallpaper and Daydream applications need this flag
|
|
||||||
if (!(((AndroidApplication)Gdx.app).getContext() instanceof Activity)) {
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
}
|
|
||||||
((AndroidApplication)Gdx.app).startActivity(intent);
|
|
||||||
return true;
|
|
||||||
} catch (ActivityNotFoundException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void promptTextInput(final String title, final String hintText, final int maxLen, final boolean multiLine, final String posTxt, final String negTxt, final TextCallback callback) {
|
public void promptTextInput(final String title, final String hintText, final int maxLen, final boolean multiLine, final String posTxt, final String negTxt, final TextCallback callback) {
|
||||||
Game.runOnRenderThread( new Callback() {
|
Game.runOnRenderThread( new Callback() {
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ allprojects {
|
|||||||
appJavaCompatibility = JavaVersion.VERSION_1_8
|
appJavaCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
||||||
appAndroidCompileSDK = 30
|
appAndroidCompileSDK = 30
|
||||||
appAndroidMinSDK = 9
|
appAndroidMinSDK = 14
|
||||||
appAndroidTargetSDK = 30
|
appAndroidTargetSDK = 30
|
||||||
|
|
||||||
gdxVersion = '1.9.10'
|
gdxVersion = '1.10.0'
|
||||||
}
|
}
|
||||||
version = appVersionName
|
version = appVersionName
|
||||||
|
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ dependencies {
|
|||||||
implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
implementation "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
||||||
|
|
||||||
//we use LWJGL tinyFD directly to display crash messages and (for now) single-line text input
|
//we use LWJGL tinyFD directly to display crash messages and (for now) single-line text input
|
||||||
implementation "org.lwjgl:lwjgl-tinyfd:3.2.1"
|
implementation "org.lwjgl:lwjgl-tinyfd:3.2.3"
|
||||||
implementation "org.lwjgl:lwjgl-tinyfd:3.2.1:natives-windows"
|
implementation "org.lwjgl:lwjgl-tinyfd:3.2.3:natives-windows"
|
||||||
implementation "org.lwjgl:lwjgl-tinyfd:3.2.1:natives-macos"
|
implementation "org.lwjgl:lwjgl-tinyfd:3.2.3:natives-macos"
|
||||||
implementation "org.lwjgl:lwjgl-tinyfd:3.2.1:natives-linux"
|
implementation "org.lwjgl:lwjgl-tinyfd:3.2.3:natives-linux"
|
||||||
|
|
||||||
//Need these at compile time to prevent errors there.
|
//Need these at compile time to prevent errors there.
|
||||||
// The actual dependency used at runtime will vary based on source set.
|
// The actual dependency used at runtime will vary based on source set.
|
||||||
|
|||||||
@@ -143,7 +143,12 @@ public class DesktopLauncher {
|
|||||||
config.setWindowSizeLimits( 480, 320, -1, -1 );
|
config.setWindowSizeLimits( 480, 320, -1, -1 );
|
||||||
Point p = SPDSettings.windowResolution();
|
Point p = SPDSettings.windowResolution();
|
||||||
config.setWindowedMode( p.x, p.y );
|
config.setWindowedMode( p.x, p.y );
|
||||||
config.setAutoIconify( true );
|
|
||||||
|
config.setMaximized(SPDSettings.windowMaximized());
|
||||||
|
|
||||||
|
if (SPDSettings.fullscreen()) {
|
||||||
|
config.setFullscreenMode(Lwjgl3ApplicationConfiguration.getDisplayMode());
|
||||||
|
}
|
||||||
|
|
||||||
//we set fullscreen/maximized in the listener as doing it through the config seems to be buggy
|
//we set fullscreen/maximized in the listener as doing it through the config seems to be buggy
|
||||||
DesktopWindowListener listener = new DesktopWindowListener();
|
DesktopWindowListener listener = new DesktopWindowListener();
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ public class DesktopPlatformSupport extends PlatformSupport {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDisplaySize() {
|
public void updateDisplaySize() {
|
||||||
|
//FIXME we still set window resolution when game becomes maximized =/
|
||||||
if (!SPDSettings.fullscreen()) {
|
if (!SPDSettings.fullscreen()) {
|
||||||
SPDSettings.windowResolution( new Point( Game.width, Game.height ) );
|
SPDSettings.windowResolution( new Point( Game.width, Game.height ) );
|
||||||
}
|
}
|
||||||
@@ -66,11 +67,6 @@ public class DesktopPlatformSupport extends PlatformSupport {
|
|||||||
return true; //no easy way to check this in desktop, just assume user doesn't care
|
return true; //no easy way to check this in desktop, just assume user doesn't care
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean openURI(String URI) {
|
|
||||||
return Gdx.net.openURI(URI);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
//FIXME tinyfd_inputBox isn't a full solution for this. No support for multiline, looks ugly. Ideally we'd have an opengl-based input box
|
//FIXME tinyfd_inputBox isn't a full solution for this. No support for multiline, looks ugly. Ideally we'd have an opengl-based input box
|
||||||
public void promptTextInput(String title, String hintText, int maxLen, boolean multiLine, String posTxt, String negTxt, TextCallback callback) {
|
public void promptTextInput(String title, String hintText, int maxLen, boolean multiLine, String posTxt, String negTxt, TextCallback callback) {
|
||||||
|
|||||||
@@ -29,19 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
|||||||
public class DesktopWindowListener implements Lwjgl3WindowListener {
|
public class DesktopWindowListener implements Lwjgl3WindowListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void created ( Lwjgl3Window lwjgl3Window ) {
|
public void created ( Lwjgl3Window lwjgl3Window ) { }
|
||||||
if (SPDSettings.fullscreen()){
|
|
||||||
lwjgl3Window.postRunnable( new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run () {
|
|
||||||
Gdx.graphics.setFullscreenMode( Gdx.graphics.getDisplayMode() );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
if (SPDSettings.windowMaximized()) {
|
|
||||||
lwjgl3Window.maximizeWindow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void maximized ( boolean b ) {
|
public void maximized ( boolean b ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user