SPen SDK を使用してゲームを作成しましたが、LibGDX
そこで SPen SDK を使用したいと考えています。SPenEventLibrary
そのため、リスナーを作成して設定すると、機能しなくなります。から反応が得られますonTouchFinger
(ペンを持っていないため、このイベントのみを使用します) が、モーション イベントを andStage
などの のイベントに伝播しようとすると、動作しません!touchDown
touchUp
mSPenEventLibrary.setSPenTouchListener
必要なため、まず最初にビューを取得します。
TearTissue.libGDXView = initializeForView(new TearTissue(), config);
Stage
次に、クラスを拡張します。
protected SPenEventLibrary mSPenEventLibrary;
public class MyStage extends Stage{
public MyStage(float width, float height, boolean keepAspectRatio, SpriteBatch batch){
super(width, height, keepAspectRatio, batch);
final Stage localStage = this;
mSPenEventLibrary = new SPenEventLibrary();
mSPenEventLibrary.setSPenTouchListener(TearTissue.libGDXView, new SPenTouchListener() {
@Override
public boolean onTouchPenEraser(View arg0, MotionEvent arg1) {
return false;
}
@Override
public boolean onTouchPen(View arg0, MotionEvent arg1) {
return false;
}
@Override
public boolean onTouchFinger(View arg0, MotionEvent arg1) {
if(arg1.getAction()==MotionEvent.ACTION_DOWN){
localStage.touchDown((int)(arg1.getX()), (int)(arg1.getY()), 0, 0);
}
if(arg1.getAction()==MotionEvent.ACTION_UP){
localStage.touchUp((int)(arg1.getX()), (int)(arg1.getY()), 0, 0);
}
return true;
}
@Override
public void onTouchButtonUp(View arg0, MotionEvent arg1) {
}
@Override
public void onTouchButtonDown(View arg0, MotionEvent arg1) {
}
});
}
//DO SOME STUFF, THAT'S WHY I OVERRIDE IT
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
return super.touchDown(screenX, screenY, pointer, button);
}
@Override
public boolean touchDragged(int arg0, int arg1, int arg2) {
return super.touchDragged(arg0, arg1, arg2);
}
@Override
public boolean touchUp(int arg0, int arg1, int arg2, int arg3) {
return super.touchUp(arg0, arg1, arg2, arg3);
}
}
私は何を間違っていますか?どんな助けでも大歓迎です!