3

タッチダウンイベントのような libGdx (Android の場合) に相当するものはありますか?

4

1 に答える 1

8

使用できますGestureDetector。実装されているInputAdapterため、InputAdapter の代わりに、または を使用して InputAdapter と一緒に使用できますInputMultiplexer

を提供する必要があります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してオーバーライドできます。あなたの場合、メソッドをオーバーライドしますlongPresslongPressDurationコンストラクターへのパラメーターとして提供することもできます。

于 2012-04-08T19:51:52.633 に答える