전체 시스템이 중지되므로 이벤트 콜백 내부에서 "루프"하거나 콜백을 렌더링 할 수 없습니다. 원하는 것을 얻는 한 가지 방법은 touchDown
메서드 에서 플래그를 설정하고 메서드에서 플래그를 지운 다음 플래그로 보호되는 touchUp
루프의 "본문"을에 넣는 render
것입니다.
boolean touchActive = false;
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
//start runnable (move player)
touchActive = true;
return true;
}
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
//stop runnable
touchActive = false;
}
public void render(float delta) {
...
if (touchActive) {
// Do one iteration of your "while" loop
}
...
}
-------------------render () 또는 그리기 스레드에서 다음을 사용할 수 있습니다.
if (Gdx.input.isTouched()){
//some thing move()
}
출처
https://stackoverflow.com/questions/22009803