cocos / cocos-engine

Cocos simplifies game creation and distribution with Cocos Creator, a free, open-source, cross-platform game engine. Empowering millions of developers to create high-performance, engaging 2D/3D games and instant web entertainment.
https://www.cocos.com/en/creator
Other
5.49k stars 1.58k forks source link

[cocos creator 3.8.1] Android Samsung S-Pen Recognition Issue #16533

Open jhyoo2 opened 7 months ago

jhyoo2 commented 7 months ago

Cocos Creator version

3.8.1

System information

Android

Issue description

Hello developer friends! I’m one of the big fans of cocos – this engine has made game development possible for me.

However, there seems to be an issue with the latest update. We were using version 3.7.2 until a few weeks ago and then upgraded our engine. After this upgrade, we’ve been continuously receiving reviews that the Samsung models’ S-Pen is no longer working. It seems like the engine is not recognizing touches from the S-Pen as regular touch inputs.

Relevant error log output

No response

Steps to reproduce

use s-pen to play game

Minimal reproduction project

No response

jhyoo2 commented 7 months ago

've found that the issue was occurring because the touch pen events were being recognized as mouse events. Modifying the following line in the AndroidPlatform.cpp file resolved the issue. Since we've only released the game for mobile, I don't think it will be a significant problem, but just to be safe, could you check if there's any potential issue for future problems?

Original: // bool isMouseEvent = motionEvent->pointerCount > 0 && (motionEvent->pointers[0].toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS || motionEvent->pointers[0].toolType == AMOTION_EVENT_TOOL_TYPE_MOUSE);

Modified: bool isMouseEvent = motionEvent->pointerCount > 0 && (motionEvent->pointers[0].toolType == AMOTION_EVENT_TOOL_TYPE_MOUSE);

minggo commented 6 months ago

Thanks for reporting the issue, we will take a look.