diff --git a/spine-csharp/src/Bone.cs b/spine-csharp/src/Bone.cs index d6d9662cd..b48b1a45c 100644 --- a/spine-csharp/src/Bone.cs +++ b/spine-csharp/src/Bone.cs @@ -150,7 +150,7 @@ namespace Spine { Bone parent = this.parent; if (parent == null) { // Root bone. - float rotationY = rotation + 90 + shearY, sx = skeleton.scaleX, sy = skeleton.scaleY; + float rotationY = rotation + 90 + shearY, sx = skeleton.ScaleX, sy = skeleton.ScaleY; a = MathUtils.CosDeg(rotation + shearX) * scaleX * sx; b = MathUtils.CosDeg(rotationY) * scaleY * sx; c = MathUtils.SinDeg(rotation + shearX) * scaleX * sy; @@ -212,15 +212,15 @@ namespace Spine { case TransformMode.NoScale: case TransformMode.NoScaleOrReflection: { float cos = MathUtils.CosDeg(rotation), sin = MathUtils.SinDeg(rotation); - float za = (pa * cos + pb * sin) / skeleton.scaleX; - float zc = (pc * cos + pd * sin) / skeleton.scaleY; + float za = (pa * cos + pb * sin) / skeleton.ScaleX; + float zc = (pc * cos + pd * sin) / skeleton.ScaleY; float s = (float)Math.Sqrt(za * za + zc * zc); if (s > 0.00001f) s = 1 / s; za *= s; zc *= s; s = (float)Math.Sqrt(za * za + zc * zc); if (data.transformMode == TransformMode.NoScale - && (pa * pd - pb * pc < 0) != (skeleton.scaleX < 0 != skeleton.scaleY < 0)) s = -s; + && (pa * pd - pb * pc < 0) != (skeleton.ScaleX < 0 != skeleton.ScaleY < 0)) s = -s; float r = MathUtils.PI / 2 + MathUtils.Atan2(zc, za); float zb = MathUtils.Cos(r) * s; @@ -237,10 +237,10 @@ namespace Spine { } } - a *= skeleton.scaleX; - b *= skeleton.scaleX; - c *= skeleton.scaleY; - d *= skeleton.scaleY; + a *= skeleton.ScaleX; + b *= skeleton.ScaleX; + c *= skeleton.ScaleY; + d *= skeleton.ScaleY; } public void SetToSetupPose () { diff --git a/spine-csharp/src/Skeleton.cs b/spine-csharp/src/Skeleton.cs index 47ae149dd..107a4e98a 100644 --- a/spine-csharp/src/Skeleton.cs +++ b/spine-csharp/src/Skeleton.cs @@ -44,7 +44,7 @@ namespace Spine { internal Skin skin; internal float r = 1, g = 1, b = 1, a = 1; internal float time; - internal float scaleX = 1, scaleY = 1; + private float scaleX = 1, scaleY = 1; internal float x, y; public SkeletonData Data { get { return data; } } @@ -64,7 +64,7 @@ namespace Spine { public float X { get { return x; } set { x = value; } } public float Y { get { return y; } set { y = value; } } public float ScaleX { get { return scaleX; } set { scaleX = value; } } - public float ScaleY { get { return scaleY; } set { scaleY = value; } } + public float ScaleY { get { return scaleY * (Bone.yDown ? -1 : 1); } set { scaleY = value; } } [Obsolete("Use ScaleX instead. FlipX is when ScaleX is negative.")] public bool FlipX { get { return scaleX < 0; } set { scaleX = value ? -1f : 1f; } } diff --git a/spine-monogame/example/ExampleGame.cs b/spine-monogame/example/ExampleGame.cs index 637940bc6..2651dbbb4 100644 --- a/spine-monogame/example/ExampleGame.cs +++ b/spine-monogame/example/ExampleGame.cs @@ -77,8 +77,7 @@ namespace Spine { AnimationStateData stateData = new AnimationStateData(skeleton.Data); state = new AnimationState(stateData); - // Flip the skeleton on the y-axis and center it within the viewport - skeleton.ScaleY = -1; + // Center within the viewport skeleton.X = game.GraphicsDevice.Viewport.Width / 2; skeleton.Y = game.GraphicsDevice.Viewport.Height; @@ -135,7 +134,6 @@ namespace Spine { AnimationStateData stateData = new AnimationStateData(skeleton.Data); state = new AnimationState(stateData); - skeleton.ScaleY = -1; skeleton.X = game.GraphicsDevice.Viewport.Width / 2 + 200; skeleton.Y = game.GraphicsDevice.Viewport.Height; @@ -182,7 +180,6 @@ namespace Spine { AnimationStateData stateData = new AnimationStateData(skeleton.Data); state = new AnimationState(stateData); - skeleton.ScaleY = -1; skeleton.X = game.GraphicsDevice.Viewport.Width / 2; skeleton.Y = game.GraphicsDevice.Viewport.Height; @@ -237,7 +234,6 @@ namespace Spine { AnimationStateData stateData = new AnimationStateData(skeleton.Data); state = new AnimationState(stateData); - skeleton.ScaleY = -1; skeleton.X = game.GraphicsDevice.Viewport.Width / 2; skeleton.Y = game.GraphicsDevice.Viewport.Height;