feat: updated engine version to 4.4

This commit is contained in:
Sara 2025-03-17 10:43:25 +01:00
parent d08586768d
commit ba58baf432
140 changed files with 108317 additions and 14666 deletions

View file

@ -664,6 +664,8 @@ class Godot(private val context: Context) {
* Configuration change callback
*/
fun onConfigurationChanged(newConfig: Configuration) {
renderView?.inputHandler?.onConfigurationChanged(newConfig)
val newDarkMode = newConfig.uiMode.and(Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES
if (darkMode != newDarkMode) {
darkMode = newDarkMode
@ -823,10 +825,11 @@ class Godot(private val context: Context) {
* Returns true if `Vulkan` is used for rendering.
*/
private fun usesVulkan(): Boolean {
var rendererSource = "ProjectSettings"
var renderer = GodotLib.getGlobal("rendering/renderer/rendering_method")
val rendererInfo = GodotLib.getRendererInfo()
var renderingDeviceSource = "ProjectSettings"
var renderingDevice = GodotLib.getGlobal("rendering/rendering_device/driver")
var renderingDevice = rendererInfo[0]
var rendererSource = "ProjectSettings"
var renderer = rendererInfo[1]
val cmdline = getCommandLine()
var index = cmdline.indexOf("--rendering-method")
if (index > -1 && cmdline.size > index + 1) {

View file

@ -189,6 +189,15 @@ public class GodotLib {
*/
public static native String getGlobal(String p_key);
/**
* Used to get info about the current rendering system.
*
* @return A String array with two elements:
* [0] Rendering driver name.
* [1] Rendering method.
*/
public static native String[] getRendererInfo();
/**
* Used to access Godot's editor settings.
* @param settingKey Setting key

View file

@ -37,6 +37,7 @@ import org.godotengine.godot.GodotLib;
import org.godotengine.godot.GodotRenderView;
import android.content.Context;
import android.content.res.Configuration;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
@ -86,6 +87,8 @@ public class GodotInputHandler implements InputManager.InputDeviceListener, Sens
private int rotaryInputAxis = ROTARY_INPUT_VERTICAL_AXIS;
private int cachedRotation = -1;
public GodotInputHandler(Context context, Godot godot) {
this.godot = godot;
mInputManager = (InputManager)context.getSystemService(Context.INPUT_SERVICE);
@ -741,10 +744,14 @@ public class GodotInputHandler implements InputManager.InputDeviceListener, Sens
return;
}
if (cachedRotation == -1) {
updateCachedRotation();
}
float rotatedValue0 = 0f;
float rotatedValue1 = 0f;
float rotatedValue2 = 0f;
switch (windowManager.getDefaultDisplay().getRotation()) {
switch (cachedRotation) {
case Surface.ROTATION_0:
rotatedValue0 = values[0];
rotatedValue1 = values[1];
@ -776,4 +783,12 @@ public class GodotInputHandler implements InputManager.InputDeviceListener, Sens
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {}
private void updateCachedRotation() {
cachedRotation = windowManager.getDefaultDisplay().getRotation();
}
public void onConfigurationChanged(Configuration newConfig) {
updateCachedRotation();
}
}