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); }
protected virtual int BeforeDraw(IRenderer painter, Sprite sprite, TextureDrawInfo drawInfo) { return(Sprite.Cell); }
public Sprite(TextureInfo texture) { Texture = texture; DrawInfo = new TextureDrawInfo(); }