|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.scenes.scene2d.InputListener
com.badlogic.gdx.scenes.scene2d.utils.DragListener
public class DragListener
Detects mouse or finger touch drags on an actor. A touch must go down over the actor and a drag won't start until it is moved
outside the tap square
. Any touch (not just the first) will trigger this listener. While
pressed, other touch downs are ignored.
Constructor Summary | |
---|---|
DragListener()
|
Method Summary | |
---|---|
void |
drag(InputEvent event,
float x,
float y,
int pointer)
|
void |
dragStart(InputEvent event,
float x,
float y,
int pointer)
|
void |
dragStop(InputEvent event,
float x,
float y,
int pointer)
|
int |
getButton()
|
float |
getDeltaX()
Returns the amount on the x axis that the touch has been dragged since the last drag event. |
float |
getDeltaY()
Returns the amount on the y axis that the touch has been dragged since the last drag event. |
float |
getTapSquareSize()
|
float |
getTouchDownX()
|
float |
getTouchDownY()
|
boolean |
isDragging()
Returns true if a touch has been dragged outside the tap square. |
void |
setButton(int button)
Sets the button to listen for, all other buttons are ignored. |
void |
setTapSquareSize(float halfTapSquareSize)
|
boolean |
touchDown(InputEvent event,
float x,
float y,
int pointer,
int button)
Called when a mouse button or a finger touch goes down on the actor. |
void |
touchDragged(InputEvent event,
float x,
float y,
int pointer)
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. |
void |
touchUp(InputEvent event,
float x,
float y,
int pointer,
int button)
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. |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.InputListener |
---|
enter, exit, handle, keyDown, keyTyped, keyUp, mouseMoved, scrolled |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DragListener()
Method Detail |
---|
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button)
InputListener
handled
.
touchDown
in class InputListener
InputEvent
public void touchDragged(InputEvent event, float x, float y, int pointer)
InputListener
handled
.
touchDragged
in class InputListener
InputEvent
public void touchUp(InputEvent event, float x, float y, int pointer, int button)
InputListener
handled
.
touchUp
in class InputListener
InputEvent
public void dragStart(InputEvent event, float x, float y, int pointer)
public void drag(InputEvent event, float x, float y, int pointer)
public void dragStop(InputEvent event, float x, float y, int pointer)
public boolean isDragging()
public void setTapSquareSize(float halfTapSquareSize)
public float getTapSquareSize()
public float getTouchDownX()
public float getTouchDownY()
public float getDeltaX()
public float getDeltaY()
public int getButton()
public void setButton(int button)
Input.Buttons.LEFT
. Use -1 for any button.
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |