mirror of
https://github.com/geode-sdk/android-launcher.git
synced 2026-10-21 16:32:39 +00:00
implement resize callback
This commit is contained in:
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 {
|
||||
|
||||
Reference in new issue
Block a user