0
텍스트 (LibGdx 사용)에 대한 클릭을 어떻게 감지 할 수 있습니까? 사용자가 텍스트를 클릭 할 때 글꼴 색을 변경하려고합니다. 그래서 이것은 내가 지금까지 가지고있는 것입니다.텍스트 감지 방법 libGdx
public class MainMenuScreen implements Screen,InputProcessor {
final MainClass game;
String playButton = "PLAY";
private int screenWidth;
private int screenHeight;
public MainMenuScreen(final MainClass gam){
game=gam;
Gdx.input.setInputProcessor(this);
screenHeight = Gdx.graphics.getHeight();
screenWidth = Gdx.graphics.getWidth();
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0, 0.2f, 0, 10);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
game.batch.begin();
game.font.draw(game.batch,playButton,screenWidth/3,screenHeight/2);
game.batch.end();
}
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
//here, how to detect that the user clicked on the text??
return true;
}
나는 화면의 왼쪽 중앙 근처에 텍스트를 표시했습니다. 사용자가 해당 텍스트를 클릭했는지 확인하는 방법 ??
감사합니다. –