implement resize callback

This commit is contained in:
Chloe committed 2026-04-05 23:03:01 -07:00
1 parent c9c51f0032
commit 8bff33c013
3 files changed
+12

No files matched your search

@@ -623,6 +623,10 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL
mGLSurfaceView?.enableControllerEvents()
true
}
GeodeUtils.CAPABILITY_RESIZE_CALLBACK -> {
mGLSurfaceView?.supportsResizeEvents = true
true
}
else -> false
}
}
@@ -557,6 +557,7 @@ object GeodeUtils {
const val CAPABILITY_EXTENDED_INPUT = "extended_input"
const val CAPABILITY_TIMESTAMP_INPUT = "timestamp_inputs"
const val CAPABILITY_RICH_INPUT = "internal_callbacks_v2"
const val CAPABILITY_RESIZE_CALLBACK = "resize_callbacks"
private var capabilityListener: WeakReference<CapabilityListener?> = WeakReference(null)
@@ -63,6 +63,7 @@ class Cocos2dxGLSurfaceView(context: Context) : GLSurfaceView(context) {
var manualBackEvents = false
var controllerEventsEnabled = false
private set
var supportsResizeEvents = false
var cocos2dxEditText: AppCompatEditText? = null
set(value) {
@@ -288,6 +289,12 @@ class Cocos2dxGLSurfaceView(context: Context) : GLSurfaceView(context) {
if (!isInEditMode) {
cocos2dxRenderer.setScreenWidthAndHeight(newSurfaceWidth, newSurfaceHeight)
}
if (supportsResizeEvents) {
queueEvent {
GeodeUtils.resizeSurface(newSurfaceWidth, newSurfaceHeight)
}
}
}
private fun legacyKeyDown(keyCode: Int, keyEvent: KeyEvent): Boolean {