문제

Is there any listener in libgdx that would allow me to detect just mouse hover not pressed just hover. In the button class of scene 2D you have 2 methods isOver and isPressed but they do the same thing ... Anyone else having this problem? Is there another way to detect mouse hover over actor?

도움이 되었습니까?

해결책

There's the ClickListener which can be attached to an Actor and it offers events like the following ones:

public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor)
public void exit(InputEvent event, float x, float y, int pointer, Actor toActor)

The enter event basiscally means that the mouse started hovering over the actor, exit means it "left" the area of the actor. It also has a clicked event which you can use to execute some action in the end.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top