1
編輯:
按照每的回答是:我說這個和它的作品罰款:使用ClickListener檢測actor上的clic:無響應?
private class GameScreen implements Screen {
private Stage mStage;
private InputMultiplexer inputMultiplexer = new InputMultiplexer();
public GameScreen() {
Gdx.input.setInputProcessor(inputMultiplexer);
mStage = new Stage(0, 0, true);
MyInput mi = new MyInput(){ //which implements inputProcessor
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
General.Log("gamescreen touchDown");
return false;
}
@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
// TODO Auto-generated method stub
return false;
}
};
inputMultiplexer.addProcessor(mi);
inputMultiplexer.addProcessor(mStage);
}
我想檢測的UI演員點擊,我註冊stage
作爲inputProcessor
Gdx.input.setInputProcessor(stage);
我把這段話添加到我的演員:
setBounds(0, 0, texture.getWidth(), texture.getHeight());
但是仍然沒有迴應...
謝謝你,是有辦法了'Stage'的一類也實現'ApplicationListener'結合?你的例子工作正常。當我添加一個類,'Test test = new Test();'實現ApplicationListener時,它不起作用:例如'render'什麼也不顯示。 'Gdx.input.setInputProcessor'已經被用於'mStage',但是我需要檢測舞臺(用於UI)和世界(例如拖動正交相機)的觸摸。任何想法? – Paul
我剛剛用一個使用ApplicationListener的例子更新了代碼。 –
非常感謝您的幫助,所以我想我應該只使用一個inputProcessor,我認爲錯誤必須來自此,而不是applicationListener。我會試一試,我應該接近解決方案:)謝謝 – Paul