diff --git a/forge-adventure/pom.xml b/forge-adventure/pom.xml index ca961a6312a..1d730d49b9f 100644 --- a/forge-adventure/pom.xml +++ b/forge-adventure/pom.xml @@ -109,36 +109,36 @@ com.badlogicgames.gdx gdx - 1.12.1 + 1.13.0 compile com.badlogicgames.gdx gdx-platform - 1.12.1 + 1.13.0 natives-desktop com.badlogicgames.gdx gdx-freetype - 1.12.1 + 1.13.0 com.badlogicgames.gdx gdx-backend-lwjgl - 1.12.1 + 1.13.0 compile com.badlogicgames.gdx gdx-tools - 1.12.1 + 1.13.0 compile com.badlogicgames.gdx gdx-freetype-platform - 1.12.1 + 1.13.0 natives-desktop diff --git a/forge-adventure/src/main/java/forge/adventure/editor/EditorMainWindow.java b/forge-adventure/src/main/java/forge/adventure/editor/EditorMainWindow.java index c9c857d371e..d4157128e5b 100644 --- a/forge-adventure/src/main/java/forge/adventure/editor/EditorMainWindow.java +++ b/forge-adventure/src/main/java/forge/adventure/editor/EditorMainWindow.java @@ -41,9 +41,14 @@ public class EditorMainWindow extends JFrame { } BorderLayout layout=new BorderLayout(); JToolBar toolBar = new JToolBar("toolbar"); - JButton newButton=new JButton("open ParticleEditor"); - newButton.addActionListener(e -> EventQueue.invokeLater(ParticleEditor::new)); - toolBar.add(newButton); + // refer to removal of Swing Particle Editor: https://github.com/libgdx/libgdx/issues/7285 + //todo add New Particle Editor here (needs Java 11+): https://github.com/libgdx/gdx-particle-editor + //JButton newButton=new JButton("open ParticleEditor"); + //newButton.addActionListener(e -> EventQueue.invokeLater(ParticleEditor::new)); + JButton quit = new JButton("Quit"); + quit.addActionListener(e-> System.exit(0)); + //toolBar.add(newButton); + toolBar.add(quit); setLayout(layout); toolBar.setFloatable(false); add(toolBar, BorderLayout.NORTH); diff --git a/forge-gui-android/libs/arm64-v8a/libgdx-box2d.so b/forge-gui-android/libs/arm64-v8a/libgdx-box2d.so index f3a8a41cdcc..9fe83039884 100644 Binary files a/forge-gui-android/libs/arm64-v8a/libgdx-box2d.so and b/forge-gui-android/libs/arm64-v8a/libgdx-box2d.so differ diff --git a/forge-gui-android/libs/arm64-v8a/libgdx-freetype.so b/forge-gui-android/libs/arm64-v8a/libgdx-freetype.so index 9f7e218abc9..1a2b34ff4e2 100644 Binary files a/forge-gui-android/libs/arm64-v8a/libgdx-freetype.so and b/forge-gui-android/libs/arm64-v8a/libgdx-freetype.so differ diff --git a/forge-gui-android/libs/arm64-v8a/libgdx.so b/forge-gui-android/libs/arm64-v8a/libgdx.so index ffb154277e7..9df8b027c47 100644 Binary files a/forge-gui-android/libs/arm64-v8a/libgdx.so and b/forge-gui-android/libs/arm64-v8a/libgdx.so differ diff --git a/forge-gui-android/libs/armeabi-v7a/libgdx-box2d.so b/forge-gui-android/libs/armeabi-v7a/libgdx-box2d.so index 00700e9d50c..82f2cee2ea0 100644 Binary files a/forge-gui-android/libs/armeabi-v7a/libgdx-box2d.so and b/forge-gui-android/libs/armeabi-v7a/libgdx-box2d.so differ diff --git a/forge-gui-android/libs/armeabi-v7a/libgdx-freetype.so b/forge-gui-android/libs/armeabi-v7a/libgdx-freetype.so index 6ceab900ad0..62a2aebae2c 100644 Binary files a/forge-gui-android/libs/armeabi-v7a/libgdx-freetype.so and b/forge-gui-android/libs/armeabi-v7a/libgdx-freetype.so differ diff --git a/forge-gui-android/libs/armeabi-v7a/libgdx.so b/forge-gui-android/libs/armeabi-v7a/libgdx.so index 7192dc626f0..005705b3a23 100644 Binary files a/forge-gui-android/libs/armeabi-v7a/libgdx.so and b/forge-gui-android/libs/armeabi-v7a/libgdx.so differ diff --git a/forge-gui-android/libs/gdx-backend-android-sources.jar b/forge-gui-android/libs/gdx-backend-android-sources.jar index 524836a1f35..5d44f0a0b9c 100644 Binary files a/forge-gui-android/libs/gdx-backend-android-sources.jar and b/forge-gui-android/libs/gdx-backend-android-sources.jar differ diff --git a/forge-gui-android/libs/gdx-backend-android.jar b/forge-gui-android/libs/gdx-backend-android.jar index f67fc316ccd..da5c7c2bd25 100644 Binary files a/forge-gui-android/libs/gdx-backend-android.jar and b/forge-gui-android/libs/gdx-backend-android.jar differ diff --git a/forge-gui-android/libs/gdx-freetype.jar b/forge-gui-android/libs/gdx-freetype.jar index 7882e998dda..daf2f4f1d70 100644 Binary files a/forge-gui-android/libs/gdx-freetype.jar and b/forge-gui-android/libs/gdx-freetype.jar differ diff --git a/forge-gui-android/libs/gdx-sources.jar b/forge-gui-android/libs/gdx-sources.jar index 85793e30966..11bed47689d 100644 Binary files a/forge-gui-android/libs/gdx-sources.jar and b/forge-gui-android/libs/gdx-sources.jar differ diff --git a/forge-gui-android/libs/gdx.jar b/forge-gui-android/libs/gdx.jar index cca18342888..50d65286c35 100644 Binary files a/forge-gui-android/libs/gdx.jar and b/forge-gui-android/libs/gdx.jar differ diff --git a/forge-gui-android/libs/x86/libgdx-box2d.so b/forge-gui-android/libs/x86/libgdx-box2d.so index 98a5aefa823..4b80ce2fd6a 100644 Binary files a/forge-gui-android/libs/x86/libgdx-box2d.so and b/forge-gui-android/libs/x86/libgdx-box2d.so differ diff --git a/forge-gui-android/libs/x86/libgdx-freetype.so b/forge-gui-android/libs/x86/libgdx-freetype.so index b98bf59da7b..0d5a244fa40 100644 Binary files a/forge-gui-android/libs/x86/libgdx-freetype.so and b/forge-gui-android/libs/x86/libgdx-freetype.so differ diff --git a/forge-gui-android/libs/x86/libgdx.so b/forge-gui-android/libs/x86/libgdx.so index 623b66290d5..7fbd858dd76 100644 Binary files a/forge-gui-android/libs/x86/libgdx.so and b/forge-gui-android/libs/x86/libgdx.so differ diff --git a/forge-gui-android/libs/x86_64/libgdx-box2d.so b/forge-gui-android/libs/x86_64/libgdx-box2d.so index 6d8d101fb9b..04fbd2ca6af 100644 Binary files a/forge-gui-android/libs/x86_64/libgdx-box2d.so and b/forge-gui-android/libs/x86_64/libgdx-box2d.so differ diff --git a/forge-gui-android/libs/x86_64/libgdx-freetype.so b/forge-gui-android/libs/x86_64/libgdx-freetype.so index b71ab3b08f0..ca5b553d52e 100644 Binary files a/forge-gui-android/libs/x86_64/libgdx-freetype.so and b/forge-gui-android/libs/x86_64/libgdx-freetype.so differ diff --git a/forge-gui-android/libs/x86_64/libgdx.so b/forge-gui-android/libs/x86_64/libgdx.so index 87a2ca594ed..c93c34d8d3b 100644 Binary files a/forge-gui-android/libs/x86_64/libgdx.so and b/forge-gui-android/libs/x86_64/libgdx.so differ diff --git a/forge-gui-android/pom.xml b/forge-gui-android/pom.xml index c33c54aa40f..5dc0b84a32d 100644 --- a/forge-gui-android/pom.xml +++ b/forge-gui-android/pom.xml @@ -144,7 +144,7 @@ com.badlogicgames.gdx gdx-backend-android - 1.12.1 + 1.13.0 system ${pom.basedir}/libs/gdx-backend-android.jar diff --git a/forge-gui-android/src/com/badlogic/gdx/backends/android/ForgeAndroidApplication.java b/forge-gui-android/src/com/badlogic/gdx/backends/android/ForgeAndroidApplication.java new file mode 100644 index 00000000000..4a38863d058 --- /dev/null +++ b/forge-gui-android/src/com/badlogic/gdx/backends/android/ForgeAndroidApplication.java @@ -0,0 +1,537 @@ +/******************************************************************************* + * Copyright 2011 See AUTHORS file. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ******************************************************************************/ + +package com.badlogic.gdx.backends.android; + +import android.annotation.TargetApi; +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.content.res.Configuration; +import android.os.Build; +import android.os.Bundle; +import android.os.Debug; +import android.os.Handler; +import android.view.Gravity; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.FrameLayout; +import com.badlogic.gdx.*; +// androidx dependencies disabled so it will not crash Forge app on startup +//import com.badlogic.gdx.backends.android.keyboardheight.AndroidXKeyboardHeightProvider; +//import com.badlogic.gdx.backends.android.keyboardheight.KeyboardHeightProvider; +//import com.badlogic.gdx.backends.android.keyboardheight.StandardKeyboardHeightProvider; +import com.badlogic.gdx.backends.android.surfaceview.FillResolutionStrategy; +import com.badlogic.gdx.utils.*; + +/** A modified implementation of the {@link Application} interface for Android - Forge app. Create an {@link Activity} that derives from this class. + * In the {@link Activity#onCreate(Bundle)} method call the {@link #initialize(ApplicationListener)} method specifying the + * configuration for the GLSurfaceView. + * + * @author mzechner */ +public class ForgeAndroidApplication extends Activity implements AndroidApplicationBase { + + protected AndroidGraphics graphics; + protected AndroidInput input; + protected AndroidAudio audio; + protected AndroidFiles files; + protected AndroidNet net; + protected AndroidClipboard clipboard; + protected ApplicationListener listener; + public Handler handler; + protected boolean firstResume = true; + protected final Array runnables = new Array(); + protected final Array executedRunnables = new Array(); + protected final SnapshotArray lifecycleListeners = new SnapshotArray( + LifecycleListener.class); + private final Array androidEventListeners = new Array(); + protected int logLevel = LOG_INFO; + protected ApplicationLogger applicationLogger; + protected boolean useImmersiveMode = false; + private int wasFocusChanged = -1; + private boolean isWaitingForAudio = false; + //private KeyboardHeightProvider keyboardHeightProvider; + + protected boolean renderUnderCutout = false; + + /** This method has to be called in the {@link Activity#onCreate(Bundle)} method. It sets up all the things necessary to get + * input, render via OpenGL and so on. Uses a default {@link AndroidApplicationConfiguration}. + * + * @param listener the {@link ApplicationListener} implementing the program logic **/ + public void initialize (ApplicationListener listener) { + AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); + initialize(listener, config); + } + + /** This method has to be called in the {@link Activity#onCreate(Bundle)} method. It sets up all the things necessary to get + * input, render via OpenGL and so on. You can configure other aspects of the application with the rest of the fields in the + * {@link AndroidApplicationConfiguration} instance. + * + * @param listener the {@link ApplicationListener} implementing the program logic + * @param config the {@link AndroidApplicationConfiguration}, defining various settings of the application (use accelerometer, + * etc.). */ + public void initialize (ApplicationListener listener, AndroidApplicationConfiguration config) { + init(listener, config, false); + } + + /** This method has to be called in the {@link Activity#onCreate(Bundle)} method. It sets up all the things necessary to get + * input, render via OpenGL and so on. Uses a default {@link AndroidApplicationConfiguration}. + *

+ * Note: you have to add the returned view to your layout! + * + * @param listener the {@link ApplicationListener} implementing the program logic + * @return the GLSurfaceView of the application */ + public View initializeForView (ApplicationListener listener) { + AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); + return initializeForView(listener, config); + } + + /** This method has to be called in the {@link Activity#onCreate(Bundle)} method. It sets up all the things necessary to get + * input, render via OpenGL and so on. You can configure other aspects of the application with the rest of the fields in the + * {@link AndroidApplicationConfiguration} instance. + *

+ * Note: you have to add the returned view to your layout! + * + * @param listener the {@link ApplicationListener} implementing the program logic + * @param config the {@link AndroidApplicationConfiguration}, defining various settings of the application (use accelerometer, + * etc.). + * @return the GLSurfaceView of the application */ + public View initializeForView (ApplicationListener listener, AndroidApplicationConfiguration config) { + init(listener, config, true); + return graphics.getView(); + } + + private void init (ApplicationListener listener, AndroidApplicationConfiguration config, boolean isForView) { + if (this.getVersion() < MINIMUM_SDK) { + throw new GdxRuntimeException("libGDX requires Android API Level " + MINIMUM_SDK + " or later."); + } + config.nativeLoader.load(); + setApplicationLogger(new AndroidApplicationLogger()); + graphics = new AndroidGraphics(this, config, + config.resolutionStrategy == null ? new FillResolutionStrategy() : config.resolutionStrategy); + input = createInput(this, this, graphics.view, config); + audio = createAudio(this, config); + files = createFiles(); + net = new AndroidNet(this, config); + this.listener = listener; + this.handler = new Handler(); + this.useImmersiveMode = config.useImmersiveMode; + this.clipboard = new AndroidClipboard(this); + this.renderUnderCutout = config.renderUnderCutout; + + // Add a specialized audio lifecycle listener + addLifecycleListener(new LifecycleListener() { + + @Override + public void resume () { + // No need to resume audio here + } + + @Override + public void pause () { + audio.pause(); + } + + @Override + public void dispose () { + audio.dispose(); + } + }); + + Gdx.app = this; + Gdx.input = this.getInput(); + Gdx.audio = this.getAudio(); + Gdx.files = this.getFiles(); + Gdx.graphics = this.getGraphics(); + Gdx.net = this.getNet(); + + if (!isForView) { + try { + requestWindowFeature(Window.FEATURE_NO_TITLE); + } catch (Exception ex) { + log("AndroidApplication", "Content already displayed, cannot request FEATURE_NO_TITLE", ex); + } + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); + setContentView(graphics.getView(), createLayoutParams()); + } + + createWakeLock(config.useWakelock); + useImmersiveMode(this.useImmersiveMode); + if (this.useImmersiveMode) { + AndroidVisibilityListener vlistener = new AndroidVisibilityListener(); + vlistener.createListener(this); + } + + // detect an already connected bluetooth keyboardAvailable + if (getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS) input.setKeyboardAvailable(true); + + setLayoutInDisplayCutoutMode(this.renderUnderCutout); + + // As per the docs, it might work unreliable < 23 https://developer.android.com/jetpack/androidx/releases/core#1.5.0-alpha02 + // So, I guess since 23 is pretty rare we can use the old API for the users + /*if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + keyboardHeightProvider = new AndroidXKeyboardHeightProvider(this); + } else { + keyboardHeightProvider = new StandardKeyboardHeightProvider(this); + }*/ + } + + protected FrameLayout.LayoutParams createLayoutParams () { + FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, + android.view.ViewGroup.LayoutParams.MATCH_PARENT); + layoutParams.gravity = Gravity.CENTER; + return layoutParams; + } + + protected void createWakeLock (boolean use) { + if (use) { + getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } + } + + @TargetApi(Build.VERSION_CODES.P) + private void setLayoutInDisplayCutoutMode (boolean render) { + if (render && getVersion() >= Build.VERSION_CODES.P) { + WindowManager.LayoutParams lp = getWindow().getAttributes(); + lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; + } + } + + @Override + public void onWindowFocusChanged (boolean hasFocus) { + super.onWindowFocusChanged(hasFocus); + useImmersiveMode(this.useImmersiveMode); + if (hasFocus) { + this.wasFocusChanged = 1; + if (this.isWaitingForAudio) { + this.audio.resume(); + this.isWaitingForAudio = false; + } + } else { + this.wasFocusChanged = 0; + } + } + + @Override + public void useImmersiveMode (boolean use) { + if (!use) return; + + View view = getWindow().getDecorView(); + int code = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; + view.setSystemUiVisibility(code); + } + + @Override + protected void onPause () { + boolean isContinuous = graphics.isContinuousRendering(); + boolean isContinuousEnforced = AndroidGraphics.enforceContinuousRendering; + + // from here we don't want non continuous rendering + AndroidGraphics.enforceContinuousRendering = true; + graphics.setContinuousRendering(true); + // calls to setContinuousRendering(false) from other thread (ex: GLThread) + // will be ignored at this point... + graphics.pause(); + + input.onPause(); + + if (isFinishing()) { + graphics.clearManagedCaches(); + graphics.destroy(); + } + + AndroidGraphics.enforceContinuousRendering = isContinuousEnforced; + graphics.setContinuousRendering(isContinuous); + + graphics.onPauseGLSurfaceView(); + + super.onPause(); + //keyboardHeightProvider.setKeyboardHeightObserver(null); + } + + @Override + protected void onResume () { + Gdx.app = this; + Gdx.input = this.getInput(); + Gdx.audio = this.getAudio(); + Gdx.files = this.getFiles(); + Gdx.graphics = this.getGraphics(); + Gdx.net = this.getNet(); + + input.onResume(); + + if (graphics != null) { + graphics.onResumeGLSurfaceView(); + } + + if (!firstResume) { + graphics.resume(); + } else + firstResume = false; + + this.isWaitingForAudio = true; + if (this.wasFocusChanged == 1 || this.wasFocusChanged == -1) { + this.audio.resume(); + this.isWaitingForAudio = false; + } + super.onResume(); + /*keyboardHeightProvider.setKeyboardHeightObserver((DefaultAndroidInput)Gdx.input); + ((AndroidGraphics)getGraphics()).getView().post(new Runnable() { + @Override + public void run () { + keyboardHeightProvider.start(); + } + });*/ + } + + @Override + protected void onDestroy () { + super.onDestroy(); + //keyboardHeightProvider.close(); + } + + @Override + public ApplicationListener getApplicationListener () { + return listener; + } + + @Override + public Audio getAudio () { + return audio; + } + + @Override + public AndroidInput getInput () { + return input; + } + + @Override + public Files getFiles () { + return files; + } + + @Override + public Graphics getGraphics () { + return graphics; + } + + @Override + public Net getNet () { + return net; + } + + @Override + public ApplicationType getType () { + return ApplicationType.Android; + } + + @Override + public int getVersion () { + return android.os.Build.VERSION.SDK_INT; + } + + @Override + public long getJavaHeap () { + return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); + } + + @Override + public long getNativeHeap () { + return Debug.getNativeHeapAllocatedSize(); + } + + @Override + public Preferences getPreferences (String name) { + return new AndroidPreferences(getSharedPreferences(name, Context.MODE_PRIVATE)); + } + + @Override + public Clipboard getClipboard () { + return clipboard; + } + + @Override + public void postRunnable (Runnable runnable) { + synchronized (runnables) { + runnables.add(runnable); + Gdx.graphics.requestRendering(); + } + } + + @Override + public void onConfigurationChanged (Configuration config) { + super.onConfigurationChanged(config); + boolean keyboardAvailable = false; + if (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) keyboardAvailable = true; + input.setKeyboardAvailable(keyboardAvailable); + } + + @Override + public void exit () { + handler.post(new Runnable() { + @Override + public void run () { + ForgeAndroidApplication.this.finish(); + } + }); + } + + @Override + public void debug (String tag, String message) { + if (logLevel >= LOG_DEBUG) getApplicationLogger().debug(tag, message); + } + + @Override + public void debug (String tag, String message, Throwable exception) { + if (logLevel >= LOG_DEBUG) getApplicationLogger().debug(tag, message, exception); + } + + @Override + public void log (String tag, String message) { + if (logLevel >= LOG_INFO) getApplicationLogger().log(tag, message); + } + + @Override + public void log (String tag, String message, Throwable exception) { + if (logLevel >= LOG_INFO) getApplicationLogger().log(tag, message, exception); + } + + @Override + public void error (String tag, String message) { + if (logLevel >= LOG_ERROR) getApplicationLogger().error(tag, message); + } + + @Override + public void error (String tag, String message, Throwable exception) { + if (logLevel >= LOG_ERROR) getApplicationLogger().error(tag, message, exception); + } + + @Override + public void setLogLevel (int logLevel) { + this.logLevel = logLevel; + } + + @Override + public int getLogLevel () { + return logLevel; + } + + @Override + public void setApplicationLogger (ApplicationLogger applicationLogger) { + this.applicationLogger = applicationLogger; + } + + @Override + public ApplicationLogger getApplicationLogger () { + return applicationLogger; + } + + @Override + public void addLifecycleListener (LifecycleListener listener) { + synchronized (lifecycleListeners) { + lifecycleListeners.add(listener); + } + } + + @Override + public void removeLifecycleListener (LifecycleListener listener) { + synchronized (lifecycleListeners) { + lifecycleListeners.removeValue(listener, true); + } + } + + @Override + protected void onActivityResult (int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + + // forward events to our listeners if there are any installed + synchronized (androidEventListeners) { + for (int i = 0; i < androidEventListeners.size; i++) { + androidEventListeners.get(i).onActivityResult(requestCode, resultCode, data); + } + } + } + + /** Adds an event listener for Android specific event such as onActivityResult(...). */ + public void addAndroidEventListener (AndroidEventListener listener) { + synchronized (androidEventListeners) { + androidEventListeners.add(listener); + } + } + + /** Removes an event listener for Android specific event such as onActivityResult(...). */ + public void removeAndroidEventListener (AndroidEventListener listener) { + synchronized (androidEventListeners) { + androidEventListeners.removeValue(listener, true); + } + } + + @Override + public Context getContext () { + return this; + } + + @Override + public Array getRunnables () { + return runnables; + } + + @Override + public Array getExecutedRunnables () { + return executedRunnables; + } + + @Override + public SnapshotArray getLifecycleListeners () { + return lifecycleListeners; + } + + @Override + public Window getApplicationWindow () { + return this.getWindow(); + } + + @Override + public Handler getHandler () { + return this.handler; + } + + @Override + public AndroidAudio createAudio (Context context, AndroidApplicationConfiguration config) { + if (!config.disableAudio) + return new DefaultAndroidAudio(context, config); + else + return new DisabledAndroidAudio(); + } + + @Override + public AndroidInput createInput (Application activity, Context context, Object view, AndroidApplicationConfiguration config) { + return new DefaultAndroidInput(this, this, graphics.view, config); + } + + protected AndroidFiles createFiles () { + this.getFilesDir(); // workaround for Android bug #10515463 + return new DefaultAndroidFiles(this.getAssets(), this, true); + } + + /*public KeyboardHeightProvider getKeyboardHeightProvider () { + return keyboardHeightProvider; + }*/ +} \ No newline at end of file diff --git a/forge-gui-android/src/forge/app/Main.java b/forge-gui-android/src/forge/app/Main.java index e8f5543093d..d805308106b 100644 --- a/forge-gui-android/src/forge/app/Main.java +++ b/forge-gui-android/src/forge/app/Main.java @@ -51,7 +51,7 @@ import android.widget.TableRow; import android.widget.TextView; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Version; -import com.badlogic.gdx.backends.android.AndroidApplication; +import com.badlogic.gdx.backends.android.ForgeAndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import com.badlogic.gdx.backends.android.AndroidAudio; import com.badlogic.gdx.backends.android.AsynchronousAndroidAudio; @@ -72,7 +72,7 @@ import java.io.OutputStream; import java.text.Normalizer; import java.util.ArrayList; -public class Main extends AndroidApplication { +public class Main extends ForgeAndroidApplication { private AndroidAdapter Gadapter; private ArrayList gamepads; private AndroidClipboard androidClipboard; diff --git a/forge-gui-ios/libs/gdx-backend-robovm-sources.jar b/forge-gui-ios/libs/gdx-backend-robovm-sources.jar index 4c52154c7e7..5292538e22c 100644 Binary files a/forge-gui-ios/libs/gdx-backend-robovm-sources.jar and b/forge-gui-ios/libs/gdx-backend-robovm-sources.jar differ diff --git a/forge-gui-ios/libs/gdx-backend-robovm.jar b/forge-gui-ios/libs/gdx-backend-robovm.jar index ddf5c9bbfcf..f0c3576d5e5 100644 Binary files a/forge-gui-ios/libs/gdx-backend-robovm.jar and b/forge-gui-ios/libs/gdx-backend-robovm.jar differ diff --git a/forge-gui-ios/libs/gdx-sources.jar b/forge-gui-ios/libs/gdx-sources.jar index 22d94b50342..11bed47689d 100644 Binary files a/forge-gui-ios/libs/gdx-sources.jar and b/forge-gui-ios/libs/gdx-sources.jar differ diff --git a/forge-gui-ios/libs/gdx.jar b/forge-gui-ios/libs/gdx.jar index 1a0381b8566..50d65286c35 100644 Binary files a/forge-gui-ios/libs/gdx.jar and b/forge-gui-ios/libs/gdx.jar differ diff --git a/forge-gui-ios/pom.xml b/forge-gui-ios/pom.xml index 811b535bb2a..e72343d5356 100644 --- a/forge-gui-ios/pom.xml +++ b/forge-gui-ios/pom.xml @@ -67,7 +67,7 @@ com.badlogicgames.gdx gdx-backend-robovm - 1.12.1 + 1.13.0 diff --git a/forge-gui-mobile-dev/libs/gdx-backend-lwjgl-sources.jar b/forge-gui-mobile-dev/libs/gdx-backend-lwjgl-sources.jar index 0485da75bac..96604cce9ff 100644 Binary files a/forge-gui-mobile-dev/libs/gdx-backend-lwjgl-sources.jar and b/forge-gui-mobile-dev/libs/gdx-backend-lwjgl-sources.jar differ diff --git a/forge-gui-mobile-dev/libs/gdx-backend-lwjgl.jar b/forge-gui-mobile-dev/libs/gdx-backend-lwjgl.jar index f1422b30d71..d893c882a8d 100644 Binary files a/forge-gui-mobile-dev/libs/gdx-backend-lwjgl.jar and b/forge-gui-mobile-dev/libs/gdx-backend-lwjgl.jar differ diff --git a/forge-gui-mobile-dev/libs/gdx-box2d-platform-natives.jar b/forge-gui-mobile-dev/libs/gdx-box2d-platform-natives.jar index b8c835fd2c2..c2f4f26f422 100644 Binary files a/forge-gui-mobile-dev/libs/gdx-box2d-platform-natives.jar and b/forge-gui-mobile-dev/libs/gdx-box2d-platform-natives.jar differ diff --git a/forge-gui-mobile-dev/libs/gdx-freetype-natives.jar b/forge-gui-mobile-dev/libs/gdx-freetype-natives.jar index 564d2f5139e..8e1f595b0b3 100644 Binary files a/forge-gui-mobile-dev/libs/gdx-freetype-natives.jar and b/forge-gui-mobile-dev/libs/gdx-freetype-natives.jar differ diff --git a/forge-gui-mobile-dev/libs/gdx-natives.jar b/forge-gui-mobile-dev/libs/gdx-natives.jar index fb8b5e13ec2..15c0b61ffe5 100644 Binary files a/forge-gui-mobile-dev/libs/gdx-natives.jar and b/forge-gui-mobile-dev/libs/gdx-natives.jar differ diff --git a/forge-gui-mobile-dev/pom.xml b/forge-gui-mobile-dev/pom.xml index be57368d8cf..9973aef52a4 100644 --- a/forge-gui-mobile-dev/pom.xml +++ b/forge-gui-mobile-dev/pom.xml @@ -177,18 +177,18 @@ com.badlogicgames.gdx gdx-backend-lwjgl3 - 1.12.1 + 1.13.0 com.badlogicgames.gdx gdx-platform - 1.12.1 + 1.13.0 natives-desktop com.badlogicgames.gdx gdx-freetype-platform - 1.12.1 + 1.13.0 natives-desktop @@ -211,7 +211,7 @@ com.badlogicgames.gdx gdx-box2d-platform - 1.12.1 + 1.13.0 natives-desktop diff --git a/forge-gui-mobile-dev/src/forge/app/GameLauncher.java b/forge-gui-mobile-dev/src/forge/app/GameLauncher.java index 632e2e03618..8c34cf9e7a0 100644 --- a/forge-gui-mobile-dev/src/forge/app/GameLauncher.java +++ b/forge-gui-mobile-dev/src/forge/app/GameLauncher.java @@ -6,11 +6,13 @@ import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Clipboard; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3WindowAdapter; import com.badlogic.gdx.graphics.glutils.HdpiMode; +import com.badlogic.gdx.utils.SharedLibraryLoader; import forge.Forge; import forge.adventure.util.Config; import forge.assets.AssetsDownloader; import forge.util.BuildInfo; import forge.util.FileUtil; +import org.lwjgl.system.Configuration; import java.nio.file.Files; import java.nio.file.Paths; @@ -41,7 +43,10 @@ public class GameLauncher { // Place the file "switch_orientation.ini" to your assets folder to make the game switch to landscape orientation (unless desktopMode = true) String switchOrientationFile = assetsDir + "switch_orientation.ini"; - + // This should fix MAC-OS startup without the need for -XstartOnFirstThread parameter + if (SharedLibraryLoader.isMac) { + Configuration.GLFW_LIBRARY_NAME.set("glfw_async"); + } Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration(); config.setResizable(false); ApplicationListener start = Forge.getApp(new Lwjgl3Clipboard(), new Main.DesktopAdapter(switchOrientationFile),//todo get totalRAM && isTabletDevice diff --git a/forge-gui-mobile/libs/gdx-freetype.jar b/forge-gui-mobile/libs/gdx-freetype.jar index 7882e998dda..daf2f4f1d70 100644 Binary files a/forge-gui-mobile/libs/gdx-freetype.jar and b/forge-gui-mobile/libs/gdx-freetype.jar differ diff --git a/forge-gui-mobile/libs/gdx-sources.jar b/forge-gui-mobile/libs/gdx-sources.jar index 85793e30966..11bed47689d 100644 Binary files a/forge-gui-mobile/libs/gdx-sources.jar and b/forge-gui-mobile/libs/gdx-sources.jar differ diff --git a/forge-gui-mobile/libs/gdx.jar b/forge-gui-mobile/libs/gdx.jar index cca18342888..50d65286c35 100644 Binary files a/forge-gui-mobile/libs/gdx.jar and b/forge-gui-mobile/libs/gdx.jar differ diff --git a/forge-gui-mobile/pom.xml b/forge-gui-mobile/pom.xml index db2596a4819..3dd42d225a6 100644 --- a/forge-gui-mobile/pom.xml +++ b/forge-gui-mobile/pom.xml @@ -75,12 +75,12 @@ com.badlogicgames.gdx gdx - 1.12.1 + 1.13.0 com.badlogicgames.gdx gdx-freetype - 1.12.1 + 1.13.0 com.github.raeleus.TenPatch @@ -97,7 +97,7 @@ com.badlogicgames.gdx gdx-box2d - 1.12.1 + 1.13.0 com.badlogicgames.gdx