diff --git a/src/org/andengine/entity/Entity.java b/src/org/andengine/entity/Entity.java index dbfc92b69..458ff5acc 100644 --- a/src/org/andengine/entity/Entity.java +++ b/src/org/andengine/entity/Entity.java @@ -86,6 +86,7 @@ public void call(final IEntity pEntity) { protected float mHeight; protected float mRotation = IEntity.ROTATION_DEFAULT; + protected float mRotationOffset = IEntity.ROTATION_OFFSET_DEFAULT; protected float mRotationCenterX = IEntity.ROTATION_CENTER_X_DEFAULT; protected float mRotationCenterY = IEntity.ROTATION_CENTER_Y_DEFAULT; @@ -421,6 +422,16 @@ public void setRotation(final float pRotation) { this.mParentToLocalTransformationDirty = true; } + @Override + public float getRotationOffset() { + return this.mRotationOffset; + } + + @Override + public void setRotationOffset(final float pRotationOffset) { + this.mRotationOffset = pRotationOffset; + } + @Override public float getRotationCenterX() { return this.mRotationCenterX; @@ -1414,6 +1425,7 @@ public void reset() { this.mChildrenVisible = true; this.mChildrenIgnoreUpdate = false; + this.mRotationOffset = IEntity.ROTATION_OFFSET_DEFAULT; this.mRotation = 0; this.mScaleX = 1; this.mScaleY = 1; @@ -1550,7 +1562,7 @@ protected void applyTranslation(final GLState pGLState) { } protected void applyRotation(final GLState pGLState) { - final float rotation = this.mRotation; + final float rotation = this.mRotation + this.mRotationOffset; if (rotation != 0) { final float localRotationCenterX = this.mLocalRotationCenterX; diff --git a/src/org/andengine/entity/IEntity.java b/src/org/andengine/entity/IEntity.java index ab8b2779c..7807f0b44 100644 --- a/src/org/andengine/entity/IEntity.java +++ b/src/org/andengine/entity/IEntity.java @@ -37,6 +37,7 @@ public interface IEntity extends IDrawHandler, IUpdateHandler, IDisposable, ITou public static final float OFFSET_CENTER_Y_DEFAULT = 0.5f; public static final float ROTATION_DEFAULT = 0; + public static final float ROTATION_OFFSET_DEFAULT = 0; public static final float ROTATION_CENTER_X_DEFAULT = 0.5f; public static final float ROTATION_CENTER_Y_DEFAULT = 0.5f; @@ -115,6 +116,8 @@ public interface IEntity extends IDrawHandler, IUpdateHandler, IDisposable, ITou public boolean isRotated(); public float getRotation(); public void setRotation(final float pRotation); + public float getRotationOffset(); + public void setRotationOffset(final float pRotationOffset); public float getRotationCenterX(); public float getRotationCenterY(); diff --git a/src/org/andengine/entity/scene/menu/item/decorator/BaseMenuItemDecorator.java b/src/org/andengine/entity/scene/menu/item/decorator/BaseMenuItemDecorator.java index 55361136d..cf403568e 100644 --- a/src/org/andengine/entity/scene/menu/item/decorator/BaseMenuItemDecorator.java +++ b/src/org/andengine/entity/scene/menu/item/decorator/BaseMenuItemDecorator.java @@ -259,6 +259,16 @@ public void setRotation(final float pRotation) { this.mMenuItem.setRotation(pRotation); } + @Override + public float getRotationOffset() { + return this.mMenuItem.getRotationOffset(); + } + + @Override + public void setRotationOffset(final float pRotation) { + this.mMenuItem.setRotationOffset(pRotation); + } + @Override public float getRotationCenterX() { return this.mMenuItem.getRotationCenterX();