Hi, I created a little button on android, with libGDX very simple, but the problem is this:
I have assigned a function that writes on screen ("hola")
something like this:
if(boton.sePulsa()){
System.out.println("hola")
}
and of course I print on the screen 3 times or more, "hola"
, and I want that until you do not press again do not print anything. Any help pls.
// I edit the function sePulsa()
is the following:
public boolean sePulsaElBoton() {
return Gdx.input.isTouched() && Gdx.input.getX() >= xMinima && Gdx.input.getX() <= xMaxima &&
Gdx.input.getY() >= yMinima && Gdx.input.getY() <= yMaxima;
}
xMaxima,Xminima
, Yminima ,YMaxima
are of type float
.