2012-03-24 5 views
4

Ich habe einen Schauspieler auf einer Bühne und obwohl getroffen, und Touchdown aufgerufen werden, sind Touchup und Touchdragged nicht. Irgendwelche Ideen, was falsch ist?libgdx Touchup und Touchdragged nicht aufgerufen, aber Touchdown ist

............ 
    stage = new Stage(0, 0, true); 
    Gdx.input.setInputProcessor(stage); 
........... 

    @Override 
    public Actor hit(float arg_x, float arg_y) { 
     if ((arg_x > this.location.x) && (arg_x < (this.location.x + 40)) && (arg_y >  this.location.y) && (arg_y < (this.location.y + 40))) { 
      Gdx.app.log("Tile", "hit char = " + this.GetLetter()); 
      return this; 
     } 
     return null; 
    } 

    @Override 
    public boolean touchDown(float arg_x, float arg_y, int arg2) { 
     Gdx.app.log("Tile", "down char = " + this.GetLetter()); 
     return false; 
    } 

    @Override 
    public void touchDragged(float arg_x, float arg_y, int arg2) { 
     Gdx.app.log("Tile", "tile dragged"); 
    } 

    @Override 
    public void touchUp(float arg_x, float arg_y, int arg2) { 
     Gdx.app.log("Tile", "touchUp"); 
    } 

Antwort

9

Ich fand die Antwort in einem anderen Forum.

public boolean touchDown(float arg_x, float arg_y, int arg2) { 
     Gdx.app.log("Tile", "down char = " + this.GetLetter()); 
     return false; 
    } 

sollte

sein
public boolean touchDown(float arg_x, float arg_y, int arg2) { 
     Gdx.app.log("Tile", "down char = " + this.GetLetter()); 
     return true; 
    } 

das heißt, es true statt false zurückkehren. dann werden die anderen Methoden zu den geeigneten Zeiten aufgerufen.