LibGdx:如何在Actor上实现手势

LibGdx:如何在Actor上实现手势,libgdx,Libgdx,我正在尝试使用ActorGestureListener在LibGdx中实现演员的手势。下面的代码绘制了参与者,但没有调用pan方法。我错过什么了吗 我使用的是libgdx1.3.1 public class MyApp extends ApplicationAdapter { private Stage stage; @Override public void create() { stage = new Stag

我正在尝试使用ActorGestureListener在LibGdx中实现演员的手势。下面的代码绘制了参与者,但没有调用pan方法。我错过什么了吗

我使用的是libgdx1.3.1

   public class MyApp extends ApplicationAdapter {

        private Stage stage;

        @Override
        public void create() {
            stage = new Stage(new ExtendViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
            Gdx.input.setInputProcessor(stage);

            final Shape circle = new Circle(); // Actor that draws a texture
            stage.addActor(circle);

            circle.addListener(new ActorGestureListener(){
                public void pan (InputEvent event, float x, float y, float deltaX, float deltaY) {
                    Gdx.app.log("", "pan");
                    event.getTarget().moveBy(deltaX, deltaY);
                }
            });

            circle.setTouchable(Touchable.enabled);
        }


        @Override
        public void render() {
            Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
            stage.act(Gdx.graphics.getDeltaTime());
            stage.draw();
        }
    }

您是否通过收进或设置宽度/高度为圆指定了尺寸?
    If you inherit from Actor, you need to set the bounds or it will not be click/touch-able!.
    Simply set the bounds to match the texture your Actor contains.

    //add this Set bounds the x, y, width, and height
                circle.setBounds(0, 0,texture.getWidth(),
texture.getHeight());
    //add this Sets the origin position which is relative to the actor's bottom left corner.
                circle.setOrigin(0, 0);   


            stage.addActor(circle);