Artenus 2D Framework
Artenus Reference
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 TypeField and Description
protected target
Holds the underlying entity.

Constructor Summary

Modifier and TypeConstructor and Description
protected FilteredEntity(Entity e)
Called by subclasses to setup this filtered entity with the given underlying entity.

Method Summary

Modifier and TypeMethod and Description
public voidadvance(float elapsedTime)
Advances the animation for this animatable.
public booleanequals(Object o)
Checks whether this instance or its underlying entity equals the given object.
public floatgetAlpha()
Gets the transparency value for this renderable.
public final AnimationHandlergetAnimation()
Gets the animation handler currently affecting this animatable.
public RGBgetColorFilter()
Gets the color filter for this entity.
public Point2DgetPosition()
Gets the current position of this entity.
public floatgetRotation()
Gets the current rotational angle of this entity.
public Point2DgetScale()
Gets the 2-dimensional scaling factor for this entity.
public final EntitygetUnderlyingEntity()
Gets the underlying entity.
public booleanhasBehavior(Behaviors behavior)
Determines whether the underlying entity has the specified behavior.
public final voidmove(float amountX, float amountY)
Moves this entity the given distance.
public voidonAttach(Scene scene)
Called when this entity is associated with a scene.
public voidonDetach(Scene scene)
Called when this entity is dissociated with a scene.
public voidrender(RenderingContext ctx, int flags)
Calls render on the underlying entity, with specified flags.
public final voidrotate(float angle)
Rotates this entity the given number of degrees.
public voidsetAlpha(float alpha)
Sets the transparency value for this renderable.
public final voidsetAnimation(AnimationHandler animation)
Assigns an animation handler to handle animations for this animatable.
public voidsetColorFilter(float r, float g, float b)
Sets the color filter for this entity.
public final voidsetColorFilter(RGB rgb)
Sets the color filter for this entity.
public final voidsetPosition(Point2D position)
Sets the position of this entity.
public voidsetPosition(float x, float y)
Sets the position of this entity.
public voidsetRotation(float angle)
Sets the rotational angle of this entity.
public final voidsetScale(float scaleValue)
Sets the scaling factor for this entity.
public voidsetScale(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

Field Detail

target
protected target
Holds the underlying entity.

Constructor Detail

FilteredEntity
protected  FilteredEntity(
    Entity e
)
Called by subclasses to setup this filtered entity with the given underlying entity.
Parameters:
eUnderlying entity

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:
oObject to be compared
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:
behaviorBehavior to be checked
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:
flagsRendering flags
Specified By:
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: