Class Pointer
java.lang.Object
nl.colorize.multimedialib.renderer.Pointer
- All Implemented Interfaces:
Updatable
Represents a pointer device, which can be a mouse, a trackpad, or touch
controls, depending on the current platform and device.
Devices that support multi-touch will allow multiple pointers to be active
simultaneously. In such situations the render will provide access to
multiple Pointer instances that can be tracked individually, using
getId() to identify each pointer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidResets the state of this pointer, so that it is no longer marked as being pressed or released.getId()intgetState()floatReturns the time this pointer has been pressed, in seconds.booleanReturns true if this pointer is currently in the pressed state, regardless of the pointer's current position.booleanReturns true if this pointer is currently in the pressed state and the pointer's position is currently located within the specified area.booleanReturns true if this pointer is currently in the released state, regardless of the pointer's current position.booleanisReleased(Rect bounds) Returns true if this pointer is currently in the released state and the pointer's position is currently located within the specified area.voidsetPosition(Point2D position) voidsetState(int state) voidupdate(float deltaTime) Updates this object for the current frame.
-
Field Details
-
STATE_IDLE
public static final int STATE_IDLE- See Also:
-
STATE_PRESSED
public static final int STATE_PRESSED- See Also:
-
STATE_RELEASED
public static final int STATE_RELEASED- See Also:
-
-
Constructor Details
-
Pointer
-
-
Method Details
-
isPressed
public boolean isPressed()Returns true if this pointer is currently in the pressed state, regardless of the pointer's current position. -
isPressed
Returns true if this pointer is currently in the pressed state and the pointer's position is currently located within the specified area. -
isReleased
public boolean isReleased()Returns true if this pointer is currently in the released state, regardless of the pointer's current position. -
isReleased
Returns true if this pointer is currently in the released state and the pointer's position is currently located within the specified area. -
getTimePressed
public float getTimePressed()Returns the time this pointer has been pressed, in seconds. If this pointer is in the pressed state, this will return the time since the pressed state started. If this pointer is in the released state, this returns the time between the pointer originally being pressed and it being released. Returns zero if this pointer is in the idle state. -
clearState
public void clearState()Resets the state of this pointer, so that it is no longer marked as being pressed or released. This can be used to make certain logic "consume" the pointer, without subsequent logic during the same frame update also trying to consume the same pointer. -
update
public void update(float deltaTime) Description copied from interface:UpdatableUpdates this object for the current frame.deltaTimeindicates the elapsed time since the last frame update, in seconds. -
getId
-
getPosition
-
getState
public int getState() -
getPressedTimer
-
setPosition
-
setState
public void setState(int state)
-