I have this code that is supposed to play a sound every time either a touch event (which I can't test right now) or mouse enters my actor.
button.addListener(new InputListener(){
@Override
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
if (!Gdx.input.justTouched()){
mouseOver.play();
}
}
});
In this code I also restrict the sound such that it doesn't play if the button has just been touched (i.e. if this is a click event, so I play a different sound).
This almost works how I intend it to. However, I've noticed that if I hold the mouse down and then enter my button (actor) the event fires twice. For both of these events the mouse is considered to be pressed down (I checked).
If I comment out that play() line nothing happens (to ensure I'm not doubling up on listeners anywhere).
I just can't figure out why this is happening and would love any help.
Pluckerpluck