액터를 확장하는 Bubble 클래스가 있습니다.LibGdx 스테이지/액터 InputListener (InputListener에 적합한 영역)
public Bubble(MyGdxGame game,Texture texture){
this.game=game;
setPosition(0,0);
setSize(32,32);
gameObject=new GameObject("","bubble");
direction=new MovementDirection();
sprite=new Sprite(texture);
setTouchable(Touchable.enabled);
setWidth(sprite.getWidth());
setHeight(sprite.getHeight());
setBounds(0,0,sprite.getWidth(),sprite.getHeight());
addListener(new InputListener() {
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
Gdx.app.log("BUBBLE", "touchdown");
return true; // must return true for touchUp event to occur
}
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
Gdx.app.log("BUBBLE", "touchup");
}
});
}
이
public void show() {
// TODO Auto-generated method stub
super.show();
//2 bubbles test
gameStage=new Stage(MyGdxGame.WIDTH,MyGdxGame.HEIGHT,true);
Gdx.input.setInputProcessor(gameStage);
for (int i=0; i<10; i++){
Bubble b=new Bubble(game,Assets.bubbleTexture);
b.randomize();
gameStage.addActor(b);
}
//if (bubbleList==null)
// createBubbles();
}
화면
내가 이것에 대해 거품 수준 @ 리스너를 추가하여 잘못된 방향으로 가고 있는가 구현하는 클래스에? (내가 말하는 모든 버블에 대해 InputListener를 만드는 것은 약간 미친 듯합니다.)에 따르면 : http://libgdx.l33tlabs.org/docs/api/com/badlogic/gdx/scenes/scene2d/Actor.html 액터는 touchUp() 및 touchDown 이벤트가 있습니다. 그러나이를 무시하려고 할 때 불만을 토로합니다. 이 문제를 무시하면 더 나은 접근 방식이 될 것입니다.
여기서 사용하는 libgdx의 버전은 무엇입니까? –