tap square. This behavior
makes it easier to press buttons on a touch interface when the initial touch happens near the edge of the actor. Double clicks
can be detected using getTapCount(). Any touch (not just the first) will trigger this listener. While pressed, other
touch downs are ignored.
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private boolean | |
| private boolean | |
| private long | |
| private boolean | |
| private boolean | |
| private int | |
| private int | |
| private int | |
| private long | |
| private float | |
| private float | |
| private float | |
| public static float | visualPressedDuration
Time in seconds |
| private long |
| Access | Constructor and Description |
|---|---|
| public | ClickListener()
Create a listener where |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | cancel()
If a touch down is being monitored, the over state and drag and touch up events are ignored until the next touch up. |
| public void | |
| public void | enter(InputEvent event, float x, float y, int pointer, Actor fromActor)
Overrides com. Called any time the mouse cursor or a finger touch is moved over an actor. |
| public void | exit(InputEvent event, float x, float y, int pointer, Actor toActor)
Overrides com. Called any time the mouse cursor or a finger touch is moved out of an actor. |
| public int | |
| public int | |
| public int | getPressedPointer()
The pointer that initially pressed this button or -1 if the button is not pressed. |
| public int | getTapCount()
Returns the number of taps within the tap count interval for the most recent click event. |
| public float | |
| public float | |
| public float | |
| public boolean | |
| public boolean | |
| public void | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | isVisualPressed()
Returns true if a touch is over the actor or within the tap square or has been very recently. |
| public void | |
| public void | |
| public void | setTapCountInterval(float
time in seconds that must pass for two touch down/up sequences to be detected as consecutive
taps. tapCountInterval)
|
| public void | |
| public void | |
| public boolean | touchDown(InputEvent event, float x, float y, int pointer, int button)
Overrides com. Called when a mouse button or a finger touch goes down on the actor. |
| public void | touchDragged(InputEvent event, float x, float y, int pointer)
Overrides com. Called when a mouse button or a finger touch is moved anywhere, but only if touchDown previously returned true for the mouse button or touch. |
| public void | touchUp(InputEvent event, float x, float y, int pointer, int button)
Overrides com. Called when a mouse button or a finger touch goes up anywhere, but only if touchDown previously returned true for the mouse button or touch. |
| button | back to summary |
|---|---|
| private int button | |
| cancelled | back to summary |
|---|---|
| private boolean cancelled | |
| cancelledOver | back to summary |
|---|---|
| private boolean cancelledOver | |
| lastTapTime | back to summary |
|---|---|
| private long lastTapTime | |
| over | back to summary |
|---|---|
| private boolean over | |
| pressed | back to summary |
|---|---|
| private boolean pressed | |
| pressedButton | back to summary |
|---|---|
| private int pressedButton | |
| pressedPointer | back to summary |
|---|---|
| private int pressedPointer | |
| tapCount | back to summary |
|---|---|
| private int tapCount | |
| tapCountInterval | back to summary |
|---|---|
| private long tapCountInterval | |
| tapSquareSize | back to summary |
|---|---|
| private float tapSquareSize | |
| touchDownX | back to summary |
|---|---|
| private float touchDownX | |
| touchDownY | back to summary |
|---|---|
| private float touchDownY | |
| visualPressedDuration | back to summary |
|---|---|
| public static float visualPressedDuration Time in seconds | |
| visualPressedTime | back to summary |
|---|---|
| private long visualPressedTime | |
| ClickListener | back to summary |
|---|---|
| public ClickListener() Create a listener where
| |
| ClickListener | back to summary |
|---|---|
public ClickListener(int button)
| |
| cancel | back to summary |
|---|---|
| public void cancel() If a touch down is being monitored, the over state and drag and touch up events are ignored until the next touch up. | |
| clicked | back to summary |
|---|---|
| public void clicked(InputEvent event, float x, float y) | |
| enter | back to summary |
|---|---|
| public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) Overrides com. Doc from com. Called any time the mouse cursor or a finger touch is moved over an actor. On the desktop, this event occurs even when no mouse buttons are pressed (pointer will be -1). | |
| exit | back to summary |
|---|---|
| public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) Overrides com. Doc from com. Called any time the mouse cursor or a finger touch is moved out of an actor. On the desktop, this event occurs even when no mouse buttons are pressed (pointer will be -1). | |
| getButton | back to summary |
|---|---|
public int getButton()
| |
| getPressedButton | back to summary |
|---|---|
| public int getPressedButton() The button that initially pressed this button or -1 if the button is not pressed. | |
| getPressedPointer | back to summary |
|---|---|
| public int getPressedPointer() The pointer that initially pressed this button or -1 if the button is not pressed. | |
| getTapCount | back to summary |
|---|---|
| public int getTapCount() Returns the number of taps within the tap count interval for the most recent click event. | |
| getTapSquareSize | back to summary |
|---|---|
| public float getTapSquareSize() | |
| getTouchDownX | back to summary |
|---|---|
| public float getTouchDownX() | |
| getTouchDownY | back to summary |
|---|---|
| public float getTouchDownY() | |
| inTapSquare | back to summary |
|---|---|
| public boolean inTapSquare(float x, float y) | |
| inTapSquare | back to summary |
|---|---|
| public boolean inTapSquare() Returns true if a touch is within the tap square. | |
| invalidateTapSquare | back to summary |
|---|---|
| public void invalidateTapSquare() The tap square will no longer be used for the current touch. | |
| isOver | back to summary |
|---|---|
| public boolean isOver(Actor actor, float x, float y) Returns true if the specified position is over the specified actor or within the tap square. | |
| isOver | back to summary |
|---|---|
| public boolean isOver() Returns true if the mouse or touch is over the actor or pressed and within the tap square. | |
| isPressed | back to summary |
|---|---|
| public boolean isPressed() Returns true if a touch is over the actor or within the tap square. | |
| isVisualPressed | back to summary |
|---|---|
| public boolean isVisualPressed() Returns true if a touch is over the actor or within the tap square or has been very recently. This allows the UI to show a press and release that was so fast it occurred within a single frame. | |
| setButton | back to summary |
|---|---|
| public void setButton(int button) Sets the button to listen for, all other buttons are ignored. Default is | |
| setTapCount | back to summary |
|---|---|
| public void setTapCount(int tapCount) | |
| setTapCountInterval | back to summary |
|---|---|
public void setTapCountInterval(float tapCountInterval)
| |
| setTapSquareSize | back to summary |
|---|---|
| public void setTapSquareSize(float halfTapSquareSize) | |
| setVisualPressed | back to summary |
|---|---|
| public void setVisualPressed(boolean visualPressed) If true, sets the visual pressed time to now. If false, clears the visual pressed time. | |
| touchDown | back to summary |
|---|---|
| public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) Overrides com. Doc from com. Called when a mouse button or a finger touch goes down on the actor. If true is returned, this listener will have
| |
| touchDragged | back to summary |
|---|---|
| public void touchDragged(InputEvent event, float x, float y, int pointer) Overrides com. Doc from com. Called when a mouse button or a finger touch is moved anywhere, but only if touchDown previously returned true for the
mouse button or touch. The touchDragged event is always | |
| touchUp | back to summary |
|---|---|
| public void touchUp(InputEvent event, float x, float y, int pointer, int button) Overrides com. Doc from com. Called when a mouse button or a finger touch goes up anywhere, but only if touchDown previously returned true for the mouse
button or touch. The touchUp event is always | |