nicolasgramlich / AndEngine

Free Android 2D OpenGL Game Engine
http://www.andengine.org
Apache License 2.0
3.17k stars 1.35k forks source link

Rotated sprite, flip vertically/horizontal messed up #220

Open Matthewek opened 11 years ago

Matthewek commented 11 years ago

If sprites TEXTURE REGION is rotated , and than you try to flip your sprite, you will receive following result:

Assumption: sprite`s texture region X is rotated

sprite with texture region X, is set to be flipped vertically - results as flipped horizontally

sprite with texture region X, is set to be flipped horizontally - results as flipped vertically

Temporary solution would be changing setFlippedHorizontal method from Sprite class to:

public void setFlippedHorizontal(final boolean pFlippedHorizontal) {

    if (getTextureRegion().isRotated())
    {
        if(this.mFlippedVertical != pFlippedHorizontal) 
            this.mFlippedVertical = pFlippedHorizontal;
    }
    else
    {
        if(this.mFlippedHorizontal != pFlippedHorizontal) 
            this.mFlippedHorizontal = pFlippedHorizontal;
    }
    this.onUpdateTextureCoordinates();
}

But I believe its just not right solution (work though) I believe its something messed with onUpdateTextureCoordinates() but I am little bit confused now with ISpriteVertexBufferObject