how to drag and drop actors on libgdx scene2d?

前端 未结 3 897
鱼传尺愫
鱼传尺愫 2021-02-02 16:04

I\'m developing a game using libGDX and I would like to know how I can drag and drop an Actor. I\'ve made my stage and drawn the actor, but I don\'t know how to trigger that eve

3条回答
  •  爱一瞬间的悲伤
    2021-02-02 17:01

    Take a look at the Example in the libgdx examples. Here is the drag and drop test from the libgdx test classes: DragAndDropTest

    If you just want to drag/slide your Actor around you need to add a GestureListener to it and pass your Stage to the Inputprocessor like this:Gdx.input.setInputProcessor(stage);. Here is the GestureDetectorTest from libgdx. For drag events its the Flinglistener.

提交回复
热议问题