Exemplo n.º 1
0
        protected override int BeforeDraw(IRenderer painter, Sprite sprite, TextureDrawInfo drawInfo)
        {
            int cell = sprite.Cell;

            DrawInfo.FlipOffsetsOnly = false;
            DrawInfo.FlipX           = false;
            DrawInfo.FlipY           = false;

            switch (FlipBehavior)
            {
            case TextureFlipBehavior.FlipWhenFacingLeft:
                DrawInfo.FlipX = (Parent.Direction == Direction.Left);
                break;

            case TextureFlipBehavior.FlipWhenFacingRight:
                DrawInfo.FlipX = (Parent.Direction == Direction.Right);
                break;

            case TextureFlipBehavior.NextRowWhenFacingLeft:
                if (Parent.Direction == Direction.Left)
                {
                    cell                    += sprite.Texture.Columns;
                    DrawInfo.FlipX           = true;
                    DrawInfo.FlipOffsetsOnly = true;
                }
                break;

            case TextureFlipBehavior.NextRowWhenRacingRight:
                if (Parent.Direction == Direction.Right)
                {
                    cell                    += sprite.Texture.Columns;
                    DrawInfo.FlipX           = true;
                    DrawInfo.FlipOffsetsOnly = true;
                }
                break;
            }


            return(cell);
        }
Exemplo n.º 2
0
 protected virtual int BeforeDraw(IRenderer painter, Sprite sprite, TextureDrawInfo drawInfo)
 {
     return(Sprite.Cell);
 }
Exemplo n.º 3
0
 public Sprite(TextureInfo texture)
 {
     Texture  = texture;
     DrawInfo = new TextureDrawInfo();
 }