mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-14 07:05:40 -04:00
[AWT] try find reason not rendered
This commit is contained in:
parent
ec7c02e0f9
commit
c0074cbf12
@ -12,7 +12,7 @@ import org.lwjgl.glfw.*;
|
|||||||
public class AWTCanvasView extends View {
|
public class AWTCanvasView extends View {
|
||||||
private int mWidth, mHeight;
|
private int mWidth, mHeight;
|
||||||
|
|
||||||
private TextPaint fpsPaint = new TextPaint(Color.WHITE);
|
private TextPaint fpsPaint;
|
||||||
private boolean attached = false;
|
private boolean attached = false;
|
||||||
|
|
||||||
// Temporary count fps https://stackoverflow.com/a/13729241
|
// Temporary count fps https://stackoverflow.com/a/13729241
|
||||||
@ -39,6 +39,10 @@ public class AWTCanvasView extends View {
|
|||||||
public AWTCanvasView(Context ctx, AttributeSet attrs) {
|
public AWTCanvasView(Context ctx, AttributeSet attrs) {
|
||||||
super(ctx, attrs);
|
super(ctx, attrs);
|
||||||
setWillNotDraw(false);
|
setWillNotDraw(false);
|
||||||
|
|
||||||
|
fpsPaint = new TextPaint();
|
||||||
|
fpsPaint.setColor(Color.WHITE);
|
||||||
|
fpsPaint.setTextSize(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -48,6 +52,7 @@ public class AWTCanvasView extends View {
|
|||||||
// mRadius = (float) (Math.min(mWidth, mHeight) / 2 * 0.8);
|
// mRadius = (float) (Math.min(mWidth, mHeight) / 2 * 0.8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean drawing = false;
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas) {
|
||||||
super.onDraw(canvas);
|
super.onDraw(canvas);
|
||||||
@ -56,8 +61,8 @@ public class AWTCanvasView extends View {
|
|||||||
attached = CallbackBridge.nativeAttachThreadToOther(true, MainActivity.isInputStackCall);
|
attached = CallbackBridge.nativeAttachThreadToOther(true, MainActivity.isInputStackCall);
|
||||||
}
|
}
|
||||||
if (attached) {
|
if (attached) {
|
||||||
JREUtils.renderAWTScreenFrame(canvas, mWidth, mHeight);
|
drawing = JREUtils.renderAWTScreenFrame(canvas, mWidth, mHeight);
|
||||||
}
|
}
|
||||||
canvas.drawText("FPS: " + fps(), 100, 100, fpsPaint);
|
canvas.drawText("FPS: " + fps() + ", drawing=" + drawing, 100, 100, fpsPaint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ public class JREUtils
|
|||||||
public static native void setupBridgeWindow(Object surface);
|
public static native void setupBridgeWindow(Object surface);
|
||||||
|
|
||||||
// TODO AWT Android port
|
// TODO AWT Android port
|
||||||
public static native void renderAWTScreenFrame(Object canvas, int width, int height);
|
public static native boolean renderAWTScreenFrame(Object canvas, int width, int height);
|
||||||
|
|
||||||
// BEFORE Load and execute PIE binary using dlopen and dlsym("main")
|
// BEFORE Load and execute PIE binary using dlopen and dlsym("main")
|
||||||
// AFTER: [Deprecated]
|
// AFTER: [Deprecated]
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
// jmethodID method_awt;
|
// jmethodID method_awt;
|
||||||
|
|
||||||
// TODO: check for memory leaks
|
// TODO: check for memory leaks
|
||||||
JNIEXPORT void JNICALL Java_net_kdt_pojavlaunch_JREUtils_renderAWTScreenFrame(JNIEnv* env, jclass clazz, jobject canvas, jint width, jint height) {
|
JNIEXPORT jboolean JNICALL Java_net_kdt_pojavlaunch_JREUtils_renderAWTScreenFrame(JNIEnv* env, jclass clazz, jobject canvas, jint width, jint height) {
|
||||||
if (runtimeJNIEnvPtr_ANDROID == NULL) return;
|
if (runtimeJNIEnvPtr_ANDROID == NULL) return JNI_FALSE;
|
||||||
|
|
||||||
int *rgbArray;
|
int *rgbArray;
|
||||||
jintArray jreRgbArray, androidRgbArray;
|
jintArray jreRgbArray, androidRgbArray;
|
||||||
@ -40,5 +40,7 @@ JNIEXPORT void JNICALL Java_net_kdt_pojavlaunch_JREUtils_renderAWTScreenFrame(JN
|
|||||||
(*runtimeJNIEnvPtr_ANDROID)->ReleaseIntArrayElements(runtimeJNIEnvPtr_ANDROID, jreRgbArray, rgbArray, NULL);
|
(*runtimeJNIEnvPtr_ANDROID)->ReleaseIntArrayElements(runtimeJNIEnvPtr_ANDROID, jreRgbArray, rgbArray, NULL);
|
||||||
(*dalvikJNIEnvPtr_ANDROID)->DeleteLocalRef(dalvikJNIEnvPtr_ANDROID, androidRgbArray);
|
(*dalvikJNIEnvPtr_ANDROID)->DeleteLocalRef(dalvikJNIEnvPtr_ANDROID, androidRgbArray);
|
||||||
// free(rgbArray);
|
// free(rgbArray);
|
||||||
|
|
||||||
|
return JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user