Fix the problem that Surface size may get wrong after Android backend cut to frontend (#255)
This commit is contained in:
parent
c90cf22abf
commit
9a6b364f70
|
|
@ -767,10 +767,15 @@ static void onSurfaceChanged_native(JNIEnv *env, jobject javaGameActivity,
|
||||||
code->nativeWindow);
|
code->nativeWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
code->lastWindowWidth =
|
if (width != code->lastWindowWidth ||
|
||||||
ANativeWindow_getWidth(code->nativeWindow);
|
height != code->lastWindowHeight) {
|
||||||
code->lastWindowHeight =
|
code->lastWindowWidth = width;
|
||||||
ANativeWindow_getHeight(code->nativeWindow);
|
code->lastWindowHeight = height;
|
||||||
|
if (code->callbacks.onNativeWindowResized != NULL) {
|
||||||
|
code->callbacks.onNativeWindowResized(
|
||||||
|
code, code->nativeWindow, width, height);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Maybe it was resized?
|
// Maybe it was resized?
|
||||||
|
|
@ -778,6 +783,8 @@ static void onSurfaceChanged_native(JNIEnv *env, jobject javaGameActivity,
|
||||||
int32_t newHeight = ANativeWindow_getHeight(code->nativeWindow);
|
int32_t newHeight = ANativeWindow_getHeight(code->nativeWindow);
|
||||||
if (newWidth != code->lastWindowWidth ||
|
if (newWidth != code->lastWindowWidth ||
|
||||||
newHeight != code->lastWindowHeight) {
|
newHeight != code->lastWindowHeight) {
|
||||||
|
code->lastWindowWidth = newWidth;
|
||||||
|
code->lastWindowHeight = newHeight;
|
||||||
if (code->callbacks.onNativeWindowResized != NULL) {
|
if (code->callbacks.onNativeWindowResized != NULL) {
|
||||||
code->callbacks.onNativeWindowResized(
|
code->callbacks.onNativeWindowResized(
|
||||||
code, code->nativeWindow, newWidth, newHeight);
|
code, code->nativeWindow, newWidth, newHeight);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue