mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
feat:[xr] support dispatch xr event to ts (#16382)
* feat:[xr] support dispatch xr event to ts * improve:add se::AutoHandleScope scope;
This commit is contained in:
@@ -499,6 +499,11 @@ void XRInterface::initialize(void *javaVM, void *activity) {
|
||||
});
|
||||
} else if (key == xr::XRConfigKey::ASYNC_LOAD_ASSETS_IMAGE && value.isInt()) {
|
||||
_isFlipPixelY = value.getInt() == static_cast<int>(gfx::API::GLES3);
|
||||
} else if (key == xr::XRConfigKey::TS_EVENT_CALLBACK) {
|
||||
se::AutoHandleScope scope;
|
||||
se::ValueArray args;
|
||||
args.emplace_back(se::Value(value.getString()));
|
||||
EventDispatcher::doDispatchJsEvent("onXREvent", args);
|
||||
}
|
||||
});
|
||||
#if XR_OEM_PICO
|
||||
@@ -871,6 +876,7 @@ bool XRInterface::beginRenderEyeFrame(uint32_t eye) {
|
||||
#if CC_USE_XR
|
||||
if (IS_ENABLE_XR_LOG) CC_LOG_INFO("[XR] beginRenderEyeFrame %d", eye);
|
||||
if (_isEnabledEyeRenderJsCallback) {
|
||||
se::AutoHandleScope scope;
|
||||
se::ValueArray args;
|
||||
args.emplace_back(se::Value(eye));
|
||||
EventDispatcher::doDispatchJsEvent("onXREyeRenderBegin", args);
|
||||
@@ -895,6 +901,7 @@ bool XRInterface::endRenderEyeFrame(uint32_t eye) {
|
||||
#if CC_USE_XR
|
||||
if (IS_ENABLE_XR_LOG) CC_LOG_INFO("[XR] endRenderEyeFrame %d", eye);
|
||||
if (_isEnabledEyeRenderJsCallback) {
|
||||
se::AutoHandleScope scope;
|
||||
se::ValueArray args;
|
||||
args.emplace_back(se::Value(eye));
|
||||
EventDispatcher::doDispatchJsEvent("onXREyeRenderEnd", args);
|
||||
|
||||
Reference in New Issue
Block a user