我正在尝试检测一个用PlayN和Tripleplay库开发的游戏的滑动手势。我用tripleplay.gesture包做了一些实验,但我不知道如何使用它。有什么例子吗?谢谢你,乔瓦尼
发布于 2014-11-04 18:55:56
我找到了一个运行良好的解决方案。我希望它能对某些人有用(尽管我认为不幸的是,我们中很少有人还在使用PlayN)
if (touch().hasTouch()) {
platform().setPropagateEvents(true);
final Swipe swipe = new Swipe(Gesture.Direction.LEFT);
swipe.completed().connect(new UnitSlot() {
@Override
public void onEmit() {
PlayN.log().info("Swipe");
UIController.getInstance().toggleScreen();
}
});
Touch.LayerListener tll = new GestureDirector(
new Rectangle(
0,
0,
layerWidth,
layerHeigth
), UIController.getTimer()).add(swipe);
layer.addListener(tll);
}https://stackoverflow.com/questions/26524743
复制相似问题