android–touchdown压制了libgdx

android–touchdown压制了libgdx,第1张

概述在触摸事件中是否存在类似于触摸事件的libGdx(在Android中)–因此当用户触摸屏幕(并且持续按下他们的手指)时,即.touchhelddown方法?解决方法:您可以使用GestureDetector.它实现了InputAdapter,因此您可以使用它而不是InputAdapter或使用InputMapplexer与InputAdapter一起使用它.

在触摸事件中是否存在类似于触摸事件的libGdx(在Android中) – 因此当用户触摸屏幕(并且持续按下他们的手指)时,即. touchhelddown方法?

解决方法:

您可以使用GestureDetector.它实现了inputAdapter,因此您可以使用它而不是inputAdapter或使用inputMapplexer与inputAdapter一起使用它.

你需要提供一个GestureListener. GestureDetector在检测到支持的手势时调用GestureListener的方法.这些方法和手势是:

public boolean touchDown (int x, int y, int pointer);public boolean tap (int x, int y, int count);public boolean longPress (int x, int y);public boolean fling (float veLocityX, float veLocityY);public boolean pan (int x, int y, int deltaX, int deltaY);public boolean zoom (float originaldistance, float currentdistance);public boolean pinch (Vector2 initialFirstPointer, Vector2 initialSecondPointer,                       Vector2 firstPointer, Vector2 secondPointer);

您可以扩展GestureAdapter并覆盖您感兴趣的方法.在您的情况下,您将覆盖longPress方法.您还可以将longPressDuration作为构造函数的参数提供.

总结

以上是内存溢出为你收集整理的android – touchdown压制了libgdx全部内容,希望文章能够帮你解决android – touchdown压制了libgdx所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/web/1114257.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存