add input timestamp api

This commit is contained in:
qimiko committed 2024-05-17 19:23:05 -07:00
1 parent c3adddc86b
commit 649cba97a6
3 files changed
+58 -31

No files matched your search

@@ -515,12 +515,17 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL
}
override fun onCapabilityAdded(capability: String): Boolean {
if (capability == GeodeUtils.CAPABILITY_EXTENDED_INPUT) {
mGLSurfaceView?.useKeyboardEvents = true
return true
return when (capability) {
GeodeUtils.CAPABILITY_EXTENDED_INPUT -> {
mGLSurfaceView?.useKeyboardEvents = true
true
}
GeodeUtils.CAPABILITY_TIMESTAMP_INPUT -> {
mGLSurfaceView?.sendTimestampEvents = true
true
}
else -> false
}
return false
}
/**
@@ -450,6 +450,7 @@ object GeodeUtils {
}
const val CAPABILITY_EXTENDED_INPUT = "extended_input"
const val CAPABILITY_TIMESTAMP_INPUT = "timestamp_inputs"
private var capabilityListener: WeakReference<CapabilityListener?> = WeakReference(null)
@@ -470,4 +471,7 @@ object GeodeUtils {
external fun nativeKeyDown(keyCode: Int, modifiers: Int, isRepeating: Boolean)
external fun nativeActionScroll(scrollX: Float, scrollY: Float)
external fun resizeSurface(width: Int, height: Int)
// represents the timestamp of the next input callback, in nanoseconds (most events don't send it, but it's there)
external fun setNextInputTimestamp(timestamp: Long)
}