public class Entity extends java.lang.Object implements IEntity
IUpdateHandler.IUpdateHandlerMatcherIDisposable.AlreadyDisposedException| Modifier and Type | Field and Description |
|---|---|
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 int |
mTag |
protected boolean |
mVisible |
protected float |
mX |
protected float |
mY |
protected int |
mZIndex |
TAG_INVALID| Modifier and Type | Method and Description |
|---|---|
protected void |
applyRotation(GLState pGLState) |
protected void |
applyScale(GLState pGLState) |
protected void |
applySkew(GLState pGLState) |
protected void |
applyTranslation(GLState pGLState) |
void |
attachChild(IEntity pEntity) |
void |
callOnChildren(IEntityParameterCallable pEntityParameterCallable) |
void |
callOnChildren(IEntityParameterCallable pEntityParameterCallable,
IEntityMatcher pEntityMatcher) |
void |
clearEntityModifiers() |
void |
clearUpdateHandlers() |
float[] |
convertLocalToSceneCoordinates(float[] pCoordinates) |
float[] |
convertLocalToSceneCoordinates(float[] pCoordinates,
float[] pReuse) |
float[] |
convertLocalToSceneCoordinates(float pX,
float pY) |
float[] |
convertLocalToSceneCoordinates(float pX,
float pY,
float[] pReuse) |
float[] |
convertSceneToLocalCoordinates(float[] pCoordinates) |
float[] |
convertSceneToLocalCoordinates(float[] pCoordinates,
float[] pReuse) |
float[] |
convertSceneToLocalCoordinates(float pX,
float pY) |
float[] |
convertSceneToLocalCoordinates(float pX,
float pY,
float[] pReuse) |
boolean |
detachChild(IEntity pEntity)
WARNING: This function should be called from within
RunnableHandler.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
RunnableHandler.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(int pTag)
WARNING: This function should be called from within
RunnableHandler.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(IEntityMatcher pEntityMatcher)
WARNING: This function should be called from within
RunnableHandler.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() |
void |
dispose() |
protected void |
draw(GLState pGLState,
Camera pCamera) |
protected void |
finalize() |
float |
getAlpha() |
float |
getBlue() |
IEntity |
getChildByIndex(int pIndex) |
IEntity |
getChildByMatcher(IEntityMatcher pEntityMatcher) |
IEntity |
getChildByTag(int pTag) |
int |
getChildCount() |
Color |
getColor() |
int |
getEntityModifierCount() |
IEntity |
getFirstChild() |
float |
getGreen() |
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() |
float[] |
getSceneCenterCoordinates(float[] pReuse) |
Transformation |
getSceneToLocalTransformation() |
float |
getSkewCenterX() |
float |
getSkewCenterY() |
float |
getSkewX() |
float |
getSkewY() |
int |
getTag() |
int |
getUpdateHandlerCount() |
java.lang.Object |
getUserData() |
float |
getX() |
float |
getY() |
int |
getZIndex() |
boolean |
hasParent() |
boolean |
isChildrenIgnoreUpdate() |
boolean |
isChildrenVisible() |
boolean |
isCulled(Camera pCamera)
Will only be performed if
IEntity.isCullingEnabled() is true. |
boolean |
isCullingEnabled() |
boolean |
isDisposed() |
boolean |
isIgnoreUpdate() |
boolean |
isRotated() |
boolean |
isRotatedOrScaledOrSkewed() |
boolean |
isScaled() |
boolean |
isSkewed() |
boolean |
isVisible() |
protected void |
onApplyTransformations(GLState pGLState) |
void |
onAttached() |
void |
onDetached() |
void |
onDraw(GLState pGLState,
Camera pCamera) |
protected void |
onManagedDraw(GLState pGLState,
Camera pCamera) |
protected void |
onManagedUpdate(float pSecondsElapsed) |
void |
onUpdate(float pSecondsElapsed) |
protected void |
onUpdateColor() |
protected void |
postDraw(GLState pGLState,
Camera pCamera) |
protected void |
preDraw(GLState pGLState,
Camera pCamera) |
java.util.ArrayList<IEntity> |
query(IEntityMatcher pEntityMatcher) |
<L extends java.util.List<IEntity>> |
query(IEntityMatcher pEntityMatcher,
L pResult) |
IEntity |
queryFirst(IEntityMatcher pEntityMatcher) |
<S extends IEntity> |
queryFirstForSubclass(IEntityMatcher pEntityMatcher) |
<S extends IEntity> |
queryForSubclass(IEntityMatcher pEntityMatcher) |
<L extends java.util.List<S>,S extends IEntity> |
queryForSubclass(IEntityMatcher pEntityMatcher,
L pResult) |
void |
registerEntityModifier(IEntityModifier pEntityModifier) |
void |
registerUpdateHandler(IUpdateHandler pUpdateHandler) |
void |
reset() |
void |
setAlpha(float pAlpha) |
void |
setBlue(float pBlue) |
void |
setChildrenIgnoreUpdate(boolean pChildrenIgnoreUpdate) |
void |
setChildrenVisible(boolean pChildrenVisible) |
void |
setColor(Color pColor) |
void |
setColor(float pRed,
float pGreen,
float pBlue) |
void |
setColor(float pRed,
float pGreen,
float pBlue,
float pAlpha) |
void |
setCullingEnabled(boolean pCullingEnabled) |
void |
setGreen(float pGreen) |
void |
setIgnoreUpdate(boolean pIgnoreUpdate) |
void |
setParent(IEntity pEntity) |
void |
setPosition(float pX,
float pY) |
void |
setPosition(IEntity pOtherEntity) |
void |
setRed(float pRed) |
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 |
setTag(int pTag) |
void |
setUserData(java.lang.Object pUserData) |
void |
setVisible(boolean pVisible) |
void |
setX(float pX) |
void |
setY(float pY) |
void |
setZIndex(int pZIndex) |
void |
sortChildren()
Immediately sorts the
IEntitys based on their ZIndex. |
void |
sortChildren(boolean pImmediate)
Sorts the
IEntitys based on their ZIndex. |
void |
sortChildren(IEntityComparator pEntityComparator)
Sorts the
IEntitys based on the Comparator supplied. |
java.lang.String |
toString() |
void |
toString(java.lang.StringBuilder pStringBuilder) |
boolean |
unregisterEntityModifier(IEntityModifier pEntityModifier) |
boolean |
unregisterEntityModifiers(IEntityModifier.IEntityModifierMatcher pEntityModifierMatcher) |
boolean |
unregisterUpdateHandler(IUpdateHandler pUpdateHandler) |
boolean |
unregisterUpdateHandlers(IUpdateHandler.IUpdateHandlerMatcher pUpdateHandlerMatcher) |
protected boolean mDisposed
protected boolean mVisible
protected boolean mCullingEnabled
protected boolean mIgnoreUpdate
protected boolean mChildrenVisible
protected boolean mChildrenIgnoreUpdate
protected boolean mChildrenSortPending
protected int mTag
protected int mZIndex
protected Color mColor
protected float mX
protected float mY
protected float mRotation
protected float mRotationCenterX
protected float mRotationCenterY
protected float mScaleX
protected float mScaleY
protected float mScaleCenterX
protected float mScaleCenterY
protected float mSkewX
protected float mSkewY
protected float mSkewCenterX
protected float mSkewCenterY
protected void onUpdateColor()
public boolean isDisposed()
isDisposed in interface IDisposablepublic void setVisible(boolean pVisible)
setVisible in interface IEntitypublic boolean isCullingEnabled()
isCullingEnabled in interface IEntitypublic void setCullingEnabled(boolean pCullingEnabled)
setCullingEnabled in interface IEntitypublic boolean isCulled(Camera pCamera)
IEntityIEntity.isCullingEnabled() is true.public boolean isChildrenVisible()
isChildrenVisible in interface IEntitypublic void setChildrenVisible(boolean pChildrenVisible)
setChildrenVisible in interface IEntitypublic boolean isIgnoreUpdate()
isIgnoreUpdate in interface IEntitypublic void setIgnoreUpdate(boolean pIgnoreUpdate)
setIgnoreUpdate in interface IEntitypublic boolean isChildrenIgnoreUpdate()
isChildrenIgnoreUpdate in interface IEntitypublic void setChildrenIgnoreUpdate(boolean pChildrenIgnoreUpdate)
setChildrenIgnoreUpdate in interface IEntitypublic void setPosition(IEntity pOtherEntity)
setPosition in interface IEntitypublic void setPosition(float pX,
float pY)
setPosition in interface IEntitypublic float getRotation()
getRotation in interface IEntitypublic void setRotation(float pRotation)
setRotation in interface IEntitypublic float getRotationCenterX()
getRotationCenterX in interface IEntitypublic float getRotationCenterY()
getRotationCenterY in interface IEntitypublic void setRotationCenterX(float pRotationCenterX)
setRotationCenterX in interface IEntitypublic void setRotationCenterY(float pRotationCenterY)
setRotationCenterY in interface IEntitypublic void setRotationCenter(float pRotationCenterX,
float pRotationCenterY)
setRotationCenter in interface IEntitypublic void setScale(float pScaleX,
float pScaleY)
public float getScaleCenterX()
getScaleCenterX in interface IEntitypublic float getScaleCenterY()
getScaleCenterY in interface IEntitypublic void setScaleCenterX(float pScaleCenterX)
setScaleCenterX in interface IEntitypublic void setScaleCenterY(float pScaleCenterY)
setScaleCenterY in interface IEntitypublic void setScaleCenter(float pScaleCenterX,
float pScaleCenterY)
setScaleCenter in interface IEntitypublic float getSkewCenterX()
getSkewCenterX in interface IEntitypublic float getSkewCenterY()
getSkewCenterY in interface IEntitypublic void setSkewCenterX(float pSkewCenterX)
setSkewCenterX in interface IEntitypublic void setSkewCenterY(float pSkewCenterY)
setSkewCenterY in interface IEntitypublic void setSkewCenter(float pSkewCenterX,
float pSkewCenterY)
setSkewCenter in interface IEntitypublic boolean isRotatedOrScaledOrSkewed()
isRotatedOrScaledOrSkewed in interface IEntitypublic void setRed(float pRed)
public void setGreen(float pGreen)
public void setBlue(float pBlue)
public void setAlpha(float pAlpha)
public void setColor(float pRed,
float pGreen,
float pBlue)
public void setColor(float pRed,
float pGreen,
float pBlue,
float pAlpha)
public int getChildCount()
getChildCount in interface IEntitypublic IEntity getChildByTag(int pTag)
getChildByTag in interface IEntitypublic IEntity getChildByIndex(int pIndex)
getChildByIndex in interface IEntitypublic IEntity getChildByMatcher(IEntityMatcher pEntityMatcher)
getChildByMatcher in interface IEntitypublic IEntity getFirstChild()
getFirstChild in interface IEntitypublic IEntity getLastChild()
getLastChild in interface IEntitypublic java.util.ArrayList<IEntity> query(IEntityMatcher pEntityMatcher)
query in interface IEntityIEntityMatcher.public IEntity queryFirst(IEntityMatcher pEntityMatcher)
queryFirst in interface IEntityIEntityMatcher or null if none matches..public <S extends IEntity> S queryFirstForSubclass(IEntityMatcher pEntityMatcher)
queryFirstForSubclass in interface IEntityIEntityMatcher or null if none matches..public <L extends java.util.List<IEntity>> L query(IEntityMatcher pEntityMatcher, L pResult)
query in interface IEntitypResult - the List to put the result into.IEntityMatcher.public <S extends IEntity> java.util.ArrayList<S> queryForSubclass(IEntityMatcher pEntityMatcher) throws java.lang.ClassCastException
queryForSubclass in interface IEntityIEntityMatcher.java.lang.ClassCastException - when the supplied IEntityMatcher matched an IEntity that was not of the requested subtype.public <L extends java.util.List<S>,S extends IEntity> L queryForSubclass(IEntityMatcher pEntityMatcher, L pResult) throws java.lang.ClassCastException
queryForSubclass in interface IEntitypResult - the List to put the result into.IEntityMatcher.java.lang.ClassCastException - when the supplied IEntityMatcher matched an IEntity that was not of the requested subtype.public boolean detachSelf()
detachSelf in interface IEntitypublic void detachChildren()
detachChildren in interface IEntitypublic void attachChild(IEntity pEntity) throws java.lang.IllegalStateException
attachChild in interface IEntityjava.lang.IllegalStateExceptionpublic void sortChildren()
IEntityIEntitys based on their ZIndex. Sort is stable.sortChildren in interface IEntitypublic void sortChildren(boolean pImmediate)
IEntityIEntitys based on their ZIndex. Sort is stable.
In contrast to IEntity.sortChildren() this method is particularly useful to avoid multiple sorts per frame.sortChildren in interface IEntitypImmediate - 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 void sortChildren(IEntityComparator pEntityComparator)
IEntityIEntitys based on the Comparator supplied. Sort is stable.sortChildren in interface IEntitypublic boolean detachChild(IEntity pEntity)
IEntityRunnableHandler.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!detachChild in interface IEntitypublic IEntity detachChild(int pTag)
IEntityRunnableHandler.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!detachChild in interface IEntitypublic IEntity detachChild(IEntityMatcher pEntityMatcher)
IEntityRunnableHandler.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!detachChild in interface IEntitypublic boolean detachChildren(IEntityMatcher pEntityMatcher)
IEntityRunnableHandler.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!detachChildren in interface IEntitypublic void callOnChildren(IEntityParameterCallable pEntityParameterCallable)
callOnChildren in interface IEntitypublic void callOnChildren(IEntityParameterCallable pEntityParameterCallable, IEntityMatcher pEntityMatcher)
callOnChildren in interface IEntitypublic void registerUpdateHandler(IUpdateHandler pUpdateHandler)
registerUpdateHandler in interface IEntitypublic boolean unregisterUpdateHandler(IUpdateHandler pUpdateHandler)
unregisterUpdateHandler in interface IEntitypublic boolean unregisterUpdateHandlers(IUpdateHandler.IUpdateHandlerMatcher pUpdateHandlerMatcher)
unregisterUpdateHandlers in interface IEntitypublic int getUpdateHandlerCount()
getUpdateHandlerCount in interface IEntitypublic void clearUpdateHandlers()
clearUpdateHandlers in interface IEntitypublic void registerEntityModifier(IEntityModifier pEntityModifier)
registerEntityModifier in interface IEntitypublic boolean unregisterEntityModifier(IEntityModifier pEntityModifier)
unregisterEntityModifier in interface IEntitypublic boolean unregisterEntityModifiers(IEntityModifier.IEntityModifierMatcher pEntityModifierMatcher)
unregisterEntityModifiers in interface IEntitypublic int getEntityModifierCount()
getEntityModifierCount in interface IEntitypublic void clearEntityModifiers()
clearEntityModifiers in interface IEntitypublic float[] getSceneCenterCoordinates()
getSceneCenterCoordinates in interface IEntitypublic float[] getSceneCenterCoordinates(float[] pReuse)
getSceneCenterCoordinates in interface IEntitypReuse - must be of length 2.pReuse as a convenience.public Transformation getLocalToParentTransformation()
getLocalToParentTransformation in interface IEntitypublic Transformation getParentToLocalTransformation()
getParentToLocalTransformation in interface IEntitypublic Transformation getLocalToSceneTransformation()
getLocalToSceneTransformation in interface IEntitypublic Transformation getSceneToLocalTransformation()
getSceneToLocalTransformation in interface IEntitypublic float[] convertLocalToSceneCoordinates(float pX,
float pY)
convertLocalToSceneCoordinates in interface IEntitypublic float[] convertLocalToSceneCoordinates(float pX,
float pY,
float[] pReuse)
convertLocalToSceneCoordinates in interface IEntitypReuse - must be of length 2.pReuse as a convenience.public float[] convertLocalToSceneCoordinates(float[] pCoordinates)
convertLocalToSceneCoordinates in interface IEntitypCoordinates - must be of length 2.public float[] convertLocalToSceneCoordinates(float[] pCoordinates,
float[] pReuse)
convertLocalToSceneCoordinates in interface IEntitypCoordinates - must be of length 2.pReuse - must be of length 2.pReuse as a convenience.public float[] convertSceneToLocalCoordinates(float pX,
float pY)
convertSceneToLocalCoordinates in interface IEntitypublic float[] convertSceneToLocalCoordinates(float pX,
float pY,
float[] pReuse)
convertSceneToLocalCoordinates in interface IEntitypReuse - must be of length 2.pReuse as a convenience.public float[] convertSceneToLocalCoordinates(float[] pCoordinates)
convertSceneToLocalCoordinates in interface IEntitypCoordinates - must be of length 2.public float[] convertSceneToLocalCoordinates(float[] pCoordinates,
float[] pReuse)
convertSceneToLocalCoordinates in interface IEntitypCoordinates - must be of length 2.pReuse - must be of length 2.pReuse as a convenience.public void onAttached()
onAttached in interface IEntitypublic void onDetached()
onDetached in interface IEntitypublic java.lang.Object getUserData()
getUserData in interface IEntitypublic void setUserData(java.lang.Object pUserData)
setUserData in interface IEntitypublic final void onDraw(GLState pGLState, Camera pCamera)
onDraw in interface IDrawHandlerpublic final void onUpdate(float pSecondsElapsed)
onUpdate in interface IUpdateHandlerpublic void reset()
reset in interface IUpdateHandlerpublic void dispose()
dispose in interface IDisposableprotected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic java.lang.String toString()
toString in class java.lang.Objectpublic void toString(java.lang.StringBuilder pStringBuilder)
protected void onApplyTransformations(GLState pGLState)
protected void applyTranslation(GLState pGLState)
protected void applyRotation(GLState pGLState)
protected void applySkew(GLState pGLState)
protected void applyScale(GLState pGLState)
protected void onManagedUpdate(float pSecondsElapsed)