com.annahid.libs.artenus.input
TouchButton
Handles touch events for the underlying entity.
public class TouchButton extends FilteredEntity implements Button, Touchable
Field Summary
Fields inherited from com.annahid.libs.artenus.entities.FilteredEntity
Constructor Summary
| Modifier and Type | Constructor and Description |
|---|---|
public | TouchButton(Entity target) Creates a new touch button that adds button behavior to the underlying entity. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
public ButtonListener | getListener() Gets the button listener currently assigned to this touch button. |
public final boolean | handleTouch(TouchEvent event) Always returns false. |
public boolean | hasBehavior(Behaviors behavior) Determines whether the underlying entity has the specified behavior. |
public boolean | isPressed() Returns a value indicating whether this touch button is currently in pressed state. |
public void | onAttach(Scene scene) Called when this entity is associated with a scene. |
public void | onDetach(Scene scene) Called when this entity is dissociated with a scene. |
public void | render(RenderingContext ctx, int flags) Calls render on the underlying entity, with specified flags. |
public void | setListener(ButtonListener listener) Sets the button listener for this touch button. |
Methods inherited from com.annahid.libs.artenus.entities.FilteredEntity
advance, equals, getAlpha, getAnimation, getColorFilter, getPosition, getRotation, getScale, getUnderlyingEntity, hasBehavior, move, onAttach, onDetach, render, rotate, setAlpha, setAnimation, setColorFilter, setColorFilter, setPosition, setPosition, setRotation, setScale, setScaleMethods inherited from java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitConstructor Detail
| TouchButton | ||
|---|---|---|
public TouchButton(
Entity target
)Creates a new touch button that adds button behavior to the underlying entity.Parameters:
|
Method Detail
| getListener |
|---|
public ButtonListener getListener() Gets the button listener currently assigned to this touch button. Specified By:
|
| handleTouch | ||
|---|---|---|
public final boolean handleTouch(
TouchEvent event
)Always returns false. Touch buttons do not participate in the normal touch event pipeline.
Their touch event is handled through the touch map associated with the scene. Parameters:
Specified By:
Returns:
true if handled, false otherwise |
| hasBehavior |
|---|
public boolean hasBehavior(
Behaviors behavior
)Determines whether the underlying entity has the specified behavior. Overrides:
Returns:
true if the underlying entity has the behavior, false otherwise |
| isPressed |
|---|
public boolean isPressed() Returns a value indicating whether this touch button is currently in pressed state. Specified By:
Returns:
true if the button is pressed, false otherwise |
| onAttach |
|---|
public void onAttach(
Scene scene
)Called when this entity is associated with a scene. Overrides:
|
| onDetach |
|---|
public void onDetach(
Scene scene
)Called when this entity is dissociated with a scene. Overrides:
|
| render |
|---|
public void render(
RenderingContext ctx,
int flags
)Calls render on the underlying entity, with specified flags. Overrides:
|
| setListener | ||
|---|---|---|
public void setListener(
ButtonListener listener
)Sets the button listener for this touch button. Parameters:
Specified By:
|