52ky 发表于 2022-11-9 14:26:15

Android研究院之游戏开发触摸的响应方式(十三)源码

在游戏开发中监听屏幕接触事件须要在View中重写父类onTouchEvent方法,在重写的方法中阻拦用户接触屏幕的一些信息,比方接触屏幕的X、Y坐标接触屏幕发作的事件接触按下接触抬起接触移动,接触屏幕发作的时刻等等,我们先看看onTouchEvent的函数原型。

(To monitor screen contact events in game development, you need to rewrite the parent onTouchEvent method in View. In the rewritten method, users are prevented from touching some information on the screen, such as the X and Y coordinates of the screen, the event of the screen attack, the contact press, the contact lift, the contact move, the time of the screen attack, etc. Let's first look at the function prototype of onTouchEvent.)




页: [1]
查看完整版本: Android研究院之游戏开发触摸的响应方式(十三)源码