You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Add CameraFeed support for Android
Co-authored-by: KOGA Mitsuhiro <shiena.jp@gmail.com>
This commit is contained in:
committed by
KOGA Mitsuhiro
parent
209a446e36
commit
296ca79b9d
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user