public class

Entity

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

Class Overview

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

Summary

Fields
protected float mAlpha
protected float mBlue
protected SmartList<IEntity> mChildren
protected boolean mChildrenIgnoreUpdate
protected boolean mChildrenVisible
protected float mGreen
protected boolean mIgnoreUpdate
protected float mRed
protected float mRotation
protected float mRotationCenterX
protected float mRotationCenterY
protected float mScaleCenterX
protected float mScaleCenterY
protected float mScaleX
protected float mScaleY
protected boolean mVisible
protected float mX
protected float mY
protected int mZIndex
Public Constructors
Entity()
Entity(float pX, float pY)
Public Methods
void attachChild(IEntity pEntity)
boolean attachChild(IEntity pEntity, int pIndex)
void callOnChildren(IEntity.IEntityCallable pEntityCallable)
void callOnChildren(IEntity.IEntityMatcher pEntityMatcher, IEntity.IEntityCallable pEntityCallable)
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(IEntity.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 detachChildren(IEntity.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 detachSelf()
IEntity findChild(IEntity.IEntityMatcher pEntityMatcher)
float getAlpha()
float getBlue()
IEntity getChild(int pIndex)
int getChildCount()
int getChildIndex(IEntity pEntity)
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()
Object getUserData()
float getX()
float getY()
int getZIndex()
boolean hasParent()
boolean isChildrenIgnoreUpdate()
boolean isChildrenVisible()
boolean isIgnoreUpdate()
boolean isRotated()
boolean isScaled()
boolean isVisible()
void onAttached()
void onDetached()
final void onDraw(GL10 pGL, Camera pCamera)
void onManagedDrawChildren(GL10 pGL, Camera pCamera)
final void onUpdate(float pSecondsElapsed)
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(float pRed, float pGreen, float pBlue, float pAlpha)
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 setUserData(Object pUserData)
void setVisible(boolean pVisible)
void setZIndex(int pZIndex)
void sortChildren()
Sorts the IEntitys based on their ZIndex.
void sortChildren(Comparator<IEntity> pEntityComparator)
Sorts the IEntitys based on the Comparator supplied.
boolean swapChildren(IEntity pEntityA, IEntity pEntityB)
boolean swapChildren(int pIndexA, int pIndexB)
boolean unregisterEntityModifier(IEntityModifier pEntityModifier)
boolean unregisterEntityModifiers(IEntityModifier.IEntityModifierMatcher pEntityModifierMatcher)
boolean unregisterUpdateHandler(IUpdateHandler pUpdateHandler)
boolean unregisterUpdateHandlers(IUpdateHandler.IUpdateHandlerMatcher pUpdateHandlerMatcher)
Protected Methods
void applyRotation(GL10 pGL)
void applyScale(GL10 pGL)
void applyTranslation(GL10 pGL)
void doDraw(GL10 pGL, Camera pCamera)
void onApplyTransformations(GL10 pGL)
void onDrawChildren(GL10 pGL, Camera pCamera)
void onManagedDraw(GL10 pGL, Camera pCamera)
void onManagedUpdate(float pSecondsElapsed)
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.anddev.andengine.engine.handler.IUpdateHandler
From interface org.anddev.andengine.entity.IEntity
From interface org.anddev.andengine.opengl.IDrawable

Fields

protected float mAlpha

protected float mBlue

protected SmartList<IEntity> mChildren

protected boolean mChildrenIgnoreUpdate

protected boolean mChildrenVisible

protected float mGreen

protected boolean mIgnoreUpdate

protected float mRed

protected float mRotation

protected float mRotationCenterX

protected float mRotationCenterY

protected float mScaleCenterX

protected float mScaleCenterY

protected float mScaleX

protected float mScaleY

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 void attachChild (IEntity pEntity)

public boolean attachChild (IEntity pEntity, int pIndex)

public void callOnChildren (IEntity.IEntityCallable pEntityCallable)

public void callOnChildren (IEntity.IEntityMatcher pEntityMatcher, IEntity.IEntityCallable pEntityCallable)

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 (IEntity.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 detachChildren (IEntity.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 detachSelf ()

public IEntity findChild (IEntity.IEntityMatcher pEntityMatcher)

public float getAlpha ()

public float getBlue ()

public IEntity getChild (int pIndex)

public int getChildCount ()

public int getChildIndex (IEntity pEntity)

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 Object getUserData ()

public float getX ()

public float getY ()

public int getZIndex ()

public boolean hasParent ()

public boolean isChildrenIgnoreUpdate ()

public boolean isChildrenVisible ()

public boolean isIgnoreUpdate ()

public boolean isRotated ()

public boolean isScaled ()

public boolean isVisible ()

public void onAttached ()

public void onDetached ()

public final void onDraw (GL10 pGL, Camera pCamera)

public void onManagedDrawChildren (GL10 pGL, Camera pCamera)

public final void onUpdate (float pSecondsElapsed)

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 (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 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 setUserData (Object pUserData)

public void setVisible (boolean pVisible)

public void setZIndex (int pZIndex)

public void sortChildren ()

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 boolean swapChildren (IEntity pEntityA, IEntity pEntityB)

public boolean swapChildren (int pIndexA, int pIndexB)

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 (GL10 pGL)

protected void applyScale (GL10 pGL)

protected void applyTranslation (GL10 pGL)

protected void doDraw (GL10 pGL, Camera pCamera)

Parameters
pGL the OpenGL GL1.0 Context (potentially higher than 1.0) to use for drawing.
pCamera the currently active Camera i.e. to be used for culling.

protected void onApplyTransformations (GL10 pGL)

protected void onDrawChildren (GL10 pGL, Camera pCamera)

protected void onManagedDraw (GL10 pGL, Camera pCamera)

protected void onManagedUpdate (float pSecondsElapsed)