mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 11:01:17 +00:00
Add CameraFeed support for Android
Co-authored-by: KOGA Mitsuhiro <shiena.jp@gmail.com>
This commit is contained in:
parent
209a446e36
commit
296ca79b9d
12 changed files with 666 additions and 2 deletions
|
|
@ -34,6 +34,7 @@ import org.godotengine.godot.error.Error;
|
|||
import org.godotengine.godot.input.GodotEditText;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.graphics.Rect;
|
||||
|
|
@ -46,7 +47,9 @@ import android.util.DisplayMetrics;
|
|||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.view.DisplayCutout;
|
||||
import android.view.Surface;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
|
|
@ -306,6 +309,19 @@ public class GodotIO {
|
|||
}
|
||||
}
|
||||
|
||||
public int getDisplayRotation() {
|
||||
WindowManager windowManager = (WindowManager)activity.getSystemService(Context.WINDOW_SERVICE);
|
||||
int rotation = windowManager.getDefaultDisplay().getRotation();
|
||||
if (rotation == Surface.ROTATION_90) {
|
||||
return 90;
|
||||
} else if (rotation == Surface.ROTATION_180) {
|
||||
return 180;
|
||||
} else if (rotation == Surface.ROTATION_270) {
|
||||
return 270;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setEdit(GodotEditText _edit) {
|
||||
edit = _edit;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue