com.annahid.libs.artenus.entities
FilteredEntity
Superclass of all classes that provide a modification on the behavior of other entities. It
represents an entity that applies all its methods on an underlying entity.
public abstract class FilteredEntity implements Entity, Animatable, Transformable, Renderable
Field Summary
Modifier and Type | Field and Description |
---|---|
protected | target Holds the underlying entity. |
Constructor Summary
Modifier and Type | Constructor and Description |
---|---|
protected | FilteredEntity(Entity e) Called by subclasses to setup this filtered entity with the given underlying entity. |
Method Summary
Modifier and Type | Method and Description |
---|---|
public void | advance(float elapsedTime) Advances the animation for this animatable. |
public boolean | equals(Object o) Checks whether this instance or its underlying entity equals the given object. |
public float | getAlpha() Gets the transparency value for this renderable. |
public final AnimationHandler | getAnimation() Gets the animation handler currently affecting this animatable. |
public RGB | getColorFilter() Gets the color filter for this entity. |
public Point2D | getPosition() Gets the current position of this entity. |
public float | getRotation() Gets the current rotational angle of this entity. |
public Point2D | getScale() Gets the 2-dimensional scaling factor for this entity. |
public final Entity | getUnderlyingEntity() Gets the underlying entity. |
public boolean | hasBehavior(Behaviors behavior) Determines whether the underlying entity has the specified behavior. |
public final void | move(float amountX, float amountY) Moves this entity the given distance. |
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 final void | rotate(float angle) Rotates this entity the given number of degrees. |
public void | setAlpha(float alpha) Sets the transparency value for this renderable. |
public final void | setAnimation(AnimationHandler animation) Assigns an animation handler to handle animations for this animatable. |
public void | setColorFilter(float r, float g, float b) Sets the color filter for this entity. |
public final void | setColorFilter(RGB rgb) Sets the color filter for this entity. |
public final void | setPosition(Point2D position) Sets the position of this entity. |
public void | setPosition(float x, float y) Sets the position of this entity. |
public void | setRotation(float angle) Sets the rotational angle of this entity. |
public final void | setScale(float scaleValue) Sets the scaling factor for this entity. |
public void | setScale(float scaleX, float scaleY) Sets the scaling factor for this entity, specifying different values horizontally and
vertically. |
Methods inherited from java.lang.Object
clone
, equals
, finalize
, getClass
, hashCode
, notify
, notifyAll
, toString
, wait
, wait
, wait
Constructor Detail
FilteredEntity | ||
---|---|---|
protected FilteredEntity( Entity e )Called by subclasses to setup this filtered entity with the given underlying entity. Parameters:
|
Method Detail
advance |
---|
public void advance( float elapsedTime ) Advances the animation for this animatable. This method is called once per animation frame. Specified By:
|
equals | ||
---|---|---|
public boolean equals( Object o ) Checks whether this instance or its underlying entity equals the given object. Filtered
entities are only decorators, and the real object to be compared should be their target.
This facilitates for example the removal of the underlying object from an entity collection
directly rather than using its decorator, or recursive removal. Parameters:
Returns:
true if this filtered entity or its underlying entity is the same as o,
false otherwise See Also:
|
getAlpha |
---|
public float getAlpha() Gets the transparency value for this renderable. Specified By:
Returns:
The alpha value for transparency |
getAnimation |
---|
public final AnimationHandler getAnimation() Gets the animation handler currently affecting this animatable. Specified By:
Returns:
Animation handler |
getColorFilter |
---|
public RGB getColorFilter() Gets the color filter for this entity. Modifying the fields in the returned value affects
the color filter. Specified By:
Returns:
The color filter |
getPosition |
---|
public Point2D getPosition() Gets the current position of this entity. Specified By:
Returns:
Current 2-dimensional position |
getRotation |
---|
public float getRotation() Gets the current rotational angle of this entity. Specified By:
Returns:
Rotational angle in degrees |
getScale |
---|
public Point2D getScale() Gets the 2-dimensional scaling factor for this entity. Specified By:
Returns:
The scaling factor over horizontal and vertical axes |
getUnderlyingEntity |
---|
public final Entity getUnderlyingEntity() Gets the underlying entity. Returns:
Underlying entity |
hasBehavior | ||
---|---|---|
public boolean hasBehavior( Behaviors behavior ) Determines whether the underlying entity has the specified behavior. Parameters:
Specified By:
Returns:
true if this entity has the behavior, false otherwise |
move |
---|
public final void move( float amountX, float amountY ) Moves this entity the given distance. The translation will be relative to this entity's
current position. Specified By:
|
onAttach |
---|
public void onAttach( Scene scene ) Called when this entity is associated with a scene. Specified By:
|
onDetach |
---|
public void onDetach( Scene scene ) Called when this entity is dissociated with a scene. Specified By:
|
render | ||
---|---|---|
public void render( RenderingContext ctx, int flags ) Calls render on the underlying entity, with specified flags. Parameters:
Specified By:
render in Renderable See Also:
|
rotate |
---|
public final void rotate( float angle ) Rotates this entity the given number of degrees. This rotation will be relative to this
entity's current rotational angle. Specified By:
|
setAlpha |
---|
public void setAlpha( float alpha ) Sets the transparency value for this renderable. An alpha value of 1 indicates a fully opaque
renderable and a value of 0 is an invisible sprite. Any value in between can be specified to
achieve transparency. Specified By:
|
setAnimation |
---|
public final void setAnimation( AnimationHandler animation ) Assigns an animation handler to handle animations for this animatable. Specified By:
|
setColorFilter |
---|
public void setColorFilter( float r, float g, float b ) Sets the color filter for this entity. The original colors should be multiplied by this color
when rendering. Specified By:
|
setColorFilter |
---|
public final void setColorFilter( RGB rgb ) Sets the color filter for this entity. The original colors should be multiplied by this color
when rendering. Specified By:
|
setPosition |
---|
public final void setPosition( Point2D position ) Sets the position of this entity. Specified By:
|
setPosition |
---|
public void setPosition( float x, float y ) Sets the position of this entity. Specified By:
|
setRotation |
---|
public void setRotation( float angle ) Sets the rotational angle of this entity. Specified By:
|
setScale |
---|
public final void setScale( float scaleValue ) Sets the scaling factor for this entity. Horizontal and vertical scaling factors will be set
to the same value. Specified By:
|
setScale |
---|
public void setScale( float scaleX, float scaleY ) Sets the scaling factor for this entity, specifying different values horizontally and
vertically. Specified By:
|