public class

Entity

extends Object
implements IEntity
java.lang.Object
   ↳ org.andengine.entity.Entity
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

(c) 2010 Nicolas Gramlich (c) 2011 Zynga Inc.

Summary

Fields
protected SmartList<IEntity> mChildren
protected boolean mChildrenIgnoreUpdate
protected boolean mChildrenSortPending
protected boolean mChildrenVisible
protected Color mColor
protected boolean mCullingEnabled
protected boolean mDisposed
protected boolean mIgnoreUpdate
protected float mRotation
protected float mRotationCenterX
protected float mRotationCenterY
protected float mScaleCenterX
protected float mScaleCenterY
protected float mScaleX
protected float mScaleY
protected float mSkewCenterX
protected float mSkewCenterY
protected float mSkewX
protected float mSkewY
protected boolean mVisible
protected float mX
protected float mY
protected int mZIndex
Public Constructors
Entity()
Entity(float pX, float pY)
Public Methods
boolean attachChild(IEntity pEntity, int pIndex)
void attachChild(IEntity pEntity)
void callOnChildren(IEntityParameterCallable pEntityParameterCallable, IEntityMatcher pEntityMatcher)
void callOnChildren(IEntityParameterCallable pEntityParameterCallable)
void clearEntityModifiers()
void clearUpdateHandlers()
float[] convertLocalToSceneCoordinates(float[] pCoordinates, float[] pReuse)
float[] convertLocalToSceneCoordinates(float[] pCoordinates)
float[] convertLocalToSceneCoordinates(float pX, float pY)
float[] convertLocalToSceneCoordinates(float pX, float pY, float[] pReuse)
float[] convertSceneToLocalCoordinates(float pX, float pY)
float[] convertSceneToLocalCoordinates(float[] pCoordinates)
float[] convertSceneToLocalCoordinates(float pX, float pY, float[] pReuse)
float[] convertSceneToLocalCoordinates(float[] pCoordinates, float[] pReuse)
boolean detachChild(IEntity pEntity)
WARNING: This function should be called from within postRunnable(Runnable) which is registered to a Scene or the Engine itself, because otherwise it may throw an IndexOutOfBoundsException in the Update-Thread or the GL-Thread!
IEntity detachChild(IEntityMatcher pEntityMatcher)
WARNING: This function should be called from within postRunnable(Runnable) which is registered to a Scene or the Engine itself, because otherwise it may throw an IndexOutOfBoundsException in the Update-Thread or the GL-Thread!
boolean detachChildren(IEntityMatcher pEntityMatcher)
WARNING: This function should be called from within postRunnable(Runnable) which is registered to a Scene or the Engine itself, because otherwise it may throw an IndexOutOfBoundsException in the Update-Thread or the GL-Thread!
void detachChildren()
boolean detachSelf()
void dispose()
float getAlpha()
float getBlue()
IEntity getChild(int pIndex)
IEntity getChild(IEntityMatcher pEntityMatcher)
int getChildCount()
int getChildIndex(IEntity pEntity)
Color getColor()
IEntity getFirstChild()
float getGreen()
float getInitialX()
float getInitialY()
IEntity getLastChild()
Transformation getLocalToParentTransformation()
Transformation getLocalToSceneTransformation()
IEntity getParent()
Transformation getParentToLocalTransformation()
float getRed()
float getRotation()
float getRotationCenterX()
float getRotationCenterY()
float getScaleCenterX()
float getScaleCenterY()
float getScaleX()
float getScaleY()
float[] getSceneCenterCoordinates()
Transformation getSceneToLocalTransformation()
float getSkewCenterX()
float getSkewCenterY()
float getSkewX()
float getSkewY()
Object getUserData()
float getX()
float getY()
int getZIndex()
boolean hasParent()
boolean isChildrenIgnoreUpdate()
boolean isChildrenVisible()
boolean isCulled(Camera pCamera)
Will only be performed if isCullingEnabled() is true.
boolean isCullingEnabled()
boolean isDisposed()
boolean isIgnoreUpdate()
boolean isRotated()
boolean isRotatedOrScaledOrSkewed()
boolean isScaled()
boolean isSkewed()
boolean isVisible()
void onAttached()
void onDetached()
final void onDraw(GLState pGLState, Camera pCamera)
final void onUpdate(float pSecondsElapsed)
<L extends List<IEntity>> L query(IEntityMatcher pEntityMatcher, L pResult)
ArrayList<IEntity> query(IEntityMatcher pEntityMatcher)
<L extends List<S extends T>, S> L queryForSubclass(IEntityMatcher pEntityMatcher, L pResult)
<S extends IEntity> ArrayList<S> queryForSubclass(IEntityMatcher pEntityMatcher)
void registerEntityModifier(IEntityModifier pEntityModifier)
void registerUpdateHandler(IUpdateHandler pUpdateHandler)
void reset()
void setAlpha(float pAlpha)
boolean setChildIndex(IEntity pEntity, int pIndex)
void setChildrenIgnoreUpdate(boolean pChildrenIgnoreUpdate)
void setChildrenVisible(boolean pChildrenVisible)
void setColor(float pRed, float pGreen, float pBlue)
void setColor(Color pColor)
void setColor(float pRed, float pGreen, float pBlue, float pAlpha)
void setCullingEnabled(boolean pCullingEnabled)
void setIgnoreUpdate(boolean pIgnoreUpdate)
void setInitialPosition()
void setParent(IEntity pEntity)
void setPosition(IEntity pOtherEntity)
void setPosition(float pX, float pY)
void setRotation(float pRotation)
void setRotationCenter(float pRotationCenterX, float pRotationCenterY)
void setRotationCenterX(float pRotationCenterX)
void setRotationCenterY(float pRotationCenterY)
void setScale(float pScale)
void setScale(float pScaleX, float pScaleY)
void setScaleCenter(float pScaleCenterX, float pScaleCenterY)
void setScaleCenterX(float pScaleCenterX)
void setScaleCenterY(float pScaleCenterY)
void setScaleX(float pScaleX)
void setScaleY(float pScaleY)
void setSkew(float pSkew)
void setSkew(float pSkewX, float pSkewY)
void setSkewCenter(float pSkewCenterX, float pSkewCenterY)
void setSkewCenterX(float pSkewCenterX)
void setSkewCenterY(float pSkewCenterY)
void setSkewX(float pSkewX)
void setSkewY(float pSkewY)
void setUserData(Object pUserData)
void setVisible(boolean pVisible)
void setZIndex(int pZIndex)
void sortChildren()
Immediately sorts the IEntitys based on their ZIndex.
void sortChildren(Comparator<IEntity> pEntityComparator)
Sorts the IEntitys based on the Comparator supplied.
void sortChildren(boolean pImmediate)
Sorts the IEntitys based on their ZIndex.
boolean swapChildren(int pIndexA, int pIndexB)
boolean swapChildren(IEntity pEntityA, IEntity pEntityB)
void toString(StringBuilder pStringBuilder)
String toString()
boolean unregisterEntityModifier(IEntityModifier pEntityModifier)
boolean unregisterEntityModifiers(IEntityModifier.IEntityModifierMatcher pEntityModifierMatcher)
boolean unregisterUpdateHandler(IUpdateHandler pUpdateHandler)
boolean unregisterUpdateHandlers(IUpdateHandler.IUpdateHandlerMatcher pUpdateHandlerMatcher)
Protected Methods
void applyRotation(GLState pGLState)
void applyScale(GLState pGLState)
void applySkew(GLState pGLState)
void applyTranslation(GLState pGLState)
void draw(GLState pGLState, Camera pCamera)
void finalize()
void onApplyTransformations(GLState pGLState)
void onManagedDraw(GLState pGLState, Camera pCamera)
void onManagedUpdate(float pSecondsElapsed)
void onUpdateColor()
void postDraw(GLState pGLState, Camera pCamera)
void preDraw(GLState pGLState, Camera pCamera)
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.andengine.engine.handler.IDrawHandler
From interface org.andengine.engine.handler.IUpdateHandler
From interface org.andengine.entity.IEntity
From interface org.andengine.util.IDisposable

Fields

protected SmartList<IEntity> mChildren

protected boolean mChildrenIgnoreUpdate

protected boolean mChildrenSortPending

protected boolean mChildrenVisible

protected Color mColor

protected boolean mCullingEnabled

protected boolean mDisposed

protected boolean mIgnoreUpdate

protected float mRotation

protected float mRotationCenterX

protected float mRotationCenterY

protected float mScaleCenterX

protected float mScaleCenterY

protected float mScaleX

protected float mScaleY

protected float mSkewCenterX

protected float mSkewCenterY

protected float mSkewX

protected float mSkewY

protected boolean mVisible

protected float mX

protected float mY

protected int mZIndex

Public Constructors

public Entity ()

public Entity (float pX, float pY)

Public Methods

public boolean attachChild (IEntity pEntity, int pIndex)

public void attachChild (IEntity pEntity)

public void callOnChildren (IEntityParameterCallable pEntityParameterCallable, IEntityMatcher pEntityMatcher)

public void callOnChildren (IEntityParameterCallable pEntityParameterCallable)

public void clearEntityModifiers ()

public void clearUpdateHandlers ()

public float[] convertLocalToSceneCoordinates (float[] pCoordinates, float[] pReuse)

public float[] convertLocalToSceneCoordinates (float[] pCoordinates)

public float[] convertLocalToSceneCoordinates (float pX, float pY)

public float[] convertLocalToSceneCoordinates (float pX, float pY, float[] pReuse)

public float[] convertSceneToLocalCoordinates (float pX, float pY)

public float[] convertSceneToLocalCoordinates (float[] pCoordinates)

public float[] convertSceneToLocalCoordinates (float pX, float pY, float[] pReuse)

public float[] convertSceneToLocalCoordinates (float[] pCoordinates, float[] pReuse)

public boolean detachChild (IEntity pEntity)

WARNING: This function should be called from within postRunnable(Runnable) which is registered to a Scene or the Engine itself, because otherwise it may throw an IndexOutOfBoundsException in the Update-Thread or the GL-Thread!

public IEntity detachChild (IEntityMatcher pEntityMatcher)

WARNING: This function should be called from within postRunnable(Runnable) which is registered to a Scene or the Engine itself, because otherwise it may throw an IndexOutOfBoundsException in the Update-Thread or the GL-Thread!

public boolean detachChildren (IEntityMatcher pEntityMatcher)

WARNING: This function should be called from within postRunnable(Runnable) which is registered to a Scene or the Engine itself, because otherwise it may throw an IndexOutOfBoundsException in the Update-Thread or the GL-Thread!

public void detachChildren ()

public boolean detachSelf ()

public void dispose ()

public float getAlpha ()

public float getBlue ()

public IEntity getChild (int pIndex)

public IEntity getChild (IEntityMatcher pEntityMatcher)

public int getChildCount ()

public int getChildIndex (IEntity pEntity)

public Color getColor ()

public IEntity getFirstChild ()

public float getGreen ()

public float getInitialX ()

public float getInitialY ()

public IEntity getLastChild ()

public Transformation getLocalToParentTransformation ()

public Transformation getLocalToSceneTransformation ()

public IEntity getParent ()

public Transformation getParentToLocalTransformation ()

public float getRed ()

public float getRotation ()

public float getRotationCenterX ()

public float getRotationCenterY ()

public float getScaleCenterX ()

public float getScaleCenterY ()

public float getScaleX ()

public float getScaleY ()

public float[] getSceneCenterCoordinates ()

public Transformation getSceneToLocalTransformation ()

public float getSkewCenterX ()

public float getSkewCenterY ()

public float getSkewX ()

public float getSkewY ()

public Object getUserData ()

public float getX ()

public float getY ()

public int getZIndex ()

public boolean hasParent ()

public boolean isChildrenIgnoreUpdate ()

public boolean isChildrenVisible ()

public boolean isCulled (Camera pCamera)

Will only be performed if isCullingEnabled() is true.

Parameters
pCamera the currently active camera to perform culling checks against.
Returns
  • true when this object is visible by the Camera, false otherwise.

public boolean isCullingEnabled ()

public boolean isDisposed ()

public boolean isIgnoreUpdate ()

public boolean isRotated ()

public boolean isRotatedOrScaledOrSkewed ()

public boolean isScaled ()

public boolean isSkewed ()

public boolean isVisible ()

public void onAttached ()

public void onDetached ()

public final void onDraw (GLState pGLState, Camera pCamera)

public final void onUpdate (float pSecondsElapsed)

public L query (IEntityMatcher pEntityMatcher, L pResult)

public ArrayList<IEntity> query (IEntityMatcher pEntityMatcher)

public L queryForSubclass (IEntityMatcher pEntityMatcher, L pResult)

public ArrayList<S> queryForSubclass (IEntityMatcher pEntityMatcher)

public void registerEntityModifier (IEntityModifier pEntityModifier)

public void registerUpdateHandler (IUpdateHandler pUpdateHandler)

public void reset ()

public void setAlpha (float pAlpha)

Parameters
pAlpha from 0.0f (transparent) to 1.0f (opaque)

public boolean setChildIndex (IEntity pEntity, int pIndex)

public void setChildrenIgnoreUpdate (boolean pChildrenIgnoreUpdate)

public void setChildrenVisible (boolean pChildrenVisible)

public void setColor (float pRed, float pGreen, float pBlue)

Parameters
pRed from 0.0f to 1.0f
pGreen from 0.0f to 1.0f
pBlue from 0.0f to 1.0f

public void setColor (Color pColor)

public void setColor (float pRed, float pGreen, float pBlue, float pAlpha)

Parameters
pRed from 0.0f to 1.0f
pGreen from 0.0f to 1.0f
pBlue from 0.0f to 1.0f
pAlpha from 0.0f (transparent) to 1.0f (opaque)

public void setCullingEnabled (boolean pCullingEnabled)

public void setIgnoreUpdate (boolean pIgnoreUpdate)

public void setInitialPosition ()

public void setParent (IEntity pEntity)

public void setPosition (IEntity pOtherEntity)

public void setPosition (float pX, float pY)

public void setRotation (float pRotation)

public void setRotationCenter (float pRotationCenterX, float pRotationCenterY)

public void setRotationCenterX (float pRotationCenterX)

public void setRotationCenterY (float pRotationCenterY)

public void setScale (float pScale)

public void setScale (float pScaleX, float pScaleY)

public void setScaleCenter (float pScaleCenterX, float pScaleCenterY)

public void setScaleCenterX (float pScaleCenterX)

public void setScaleCenterY (float pScaleCenterY)

public void setScaleX (float pScaleX)

public void setScaleY (float pScaleY)

public void setSkew (float pSkew)

public void setSkew (float pSkewX, float pSkewY)

public void setSkewCenter (float pSkewCenterX, float pSkewCenterY)

public void setSkewCenterX (float pSkewCenterX)

public void setSkewCenterY (float pSkewCenterY)

public void setSkewX (float pSkewX)

public void setSkewY (float pSkewY)

public void setUserData (Object pUserData)

public void setVisible (boolean pVisible)

public void setZIndex (int pZIndex)

public void sortChildren ()

Immediately sorts the IEntitys based on their ZIndex. Sort is stable.

public void sortChildren (Comparator<IEntity> pEntityComparator)

Sorts the IEntitys based on the Comparator supplied. Sort is stable.

public void sortChildren (boolean pImmediate)

Sorts the IEntitys based on their ZIndex. Sort is stable. In contrast to sortChildren() this method is particularly useful to avoid multiple sorts per frame.

Parameters
pImmediate if true, the sorting is executed immediately. If false the sorting is executed before the next (visible) drawing of the children of this IEntity.

public boolean swapChildren (int pIndexA, int pIndexB)

public boolean swapChildren (IEntity pEntityA, IEntity pEntityB)

public void toString (StringBuilder pStringBuilder)

public String toString ()

public boolean unregisterEntityModifier (IEntityModifier pEntityModifier)

public boolean unregisterEntityModifiers (IEntityModifier.IEntityModifierMatcher pEntityModifierMatcher)

public boolean unregisterUpdateHandler (IUpdateHandler pUpdateHandler)

public boolean unregisterUpdateHandlers (IUpdateHandler.IUpdateHandlerMatcher pUpdateHandlerMatcher)

Protected Methods

protected void applyRotation (GLState pGLState)

protected void applyScale (GLState pGLState)

protected void applySkew (GLState pGLState)

protected void applyTranslation (GLState pGLState)

protected void draw (GLState pGLState, Camera pCamera)

Parameters
pGLState the currently active GLState i.e. to apply transformations to.
pCamera the currently active Camera i.e. to be used for culling.

protected void finalize ()

Throws
Throwable

protected void onApplyTransformations (GLState pGLState)

protected void onManagedDraw (GLState pGLState, Camera pCamera)

protected void onManagedUpdate (float pSecondsElapsed)

protected void onUpdateColor ()

protected void postDraw (GLState pGLState, Camera pCamera)

Parameters
pGLState the currently active GLState i.e. to apply transformations to.
pCamera the currently active Camera i.e. to be used for culling.

protected void preDraw (GLState pGLState, Camera pCamera)

Parameters
pGLState the currently active GLState i.e. to apply transformations to.
pCamera the currently active Camera i.e. to be used for culling.