V3.5.0 Distribute touch events independently (#10712)

* Distribute touch events independently

* remove  touch event cast

* Fix the error of clang-tidy

Co-authored-by: qiuguohua <862332094@qq.com>
This commit is contained in:
qiuguohua
2022-04-10 22:10:15 +08:00
committed by GitHub
parent a7f48be180
commit e20e4b889e
15 changed files with 65 additions and 39 deletions
+8
View File
@@ -113,6 +113,9 @@ int32_t Engine::init() {
platform->setHandleEventCallback(
std::bind(&Engine::handleEvent, this, std::placeholders::_1)); // NOLINT(modernize-avoid-bind)
platform->setHandleTouchEventCallback(
std::bind(&Engine::handleTouchEvent, this, std::placeholders::_1)); // NOLINT(modernize-avoid-bind)
se::ScriptEngine::getInstance()->addRegisterCallback(setCanvasCallback);
return 0;
}
@@ -284,6 +287,11 @@ bool Engine::handleEvent(const OSEvent& ev) {
return isHandled;
}
bool Engine::handleTouchEvent(const TouchEvent& ev) { // NOLINT(readability-convert-member-functions-to-static)
cc::EventDispatcher::dispatchTouchEvent(ev);
return true;
}
Engine::SchedulerPtr Engine::getScheduler() const {
return _scheduler;
}