예제 #1
0
 private void translatePosition(ref Vector2 position)
 {
     if (Camera != null)
     {
         position = Camera.TranslateVector(position);
     }
 }
예제 #2
0
        public void Draw(Skeleton skeleton, Color color)
        {
            beginSkeletonRenderer();

            Vector4 colorBefore = new Vector4(skeleton.R, skeleton.G, skeleton.B, skeleton.A);

            updateColor(ref color);
            tintSkeleton(skeleton, color);

            if (Camera != null)
            {
                float   previousX      = skeleton.RootBone.X;
                float   previousY      = skeleton.RootBone.Y;
                float   previousScaleX = skeleton.RootBone.ScaleX;
                float   previousScaleY = skeleton.RootBone.ScaleY;
                Vector2 position       = Camera.TranslateVector(new Vector2(previousX, previousY));
                skeleton.RootBone.X       = position.X;
                skeleton.RootBone.Y       = position.Y;
                skeleton.RootBone.ScaleX *= Camera.Scale.X;
                skeleton.RootBone.ScaleY *= Camera.Scale.Y;
                skeleton.UpdateWorldTransform();
                skeletonRenderer.Draw(skeleton);
                skeleton.RootBone.X      = previousX;
                skeleton.RootBone.Y      = previousY;
                skeleton.RootBone.ScaleX = previousScaleX;
                skeleton.RootBone.ScaleY = previousScaleY;
                skeleton.UpdateWorldTransform();
            }
            else
            {
                skeletonRenderer.Draw(skeleton);
            }

            skeleton.R = colorBefore.X;
            skeleton.G = colorBefore.Y;
            skeleton.B = colorBefore.Z;
            skeleton.A = colorBefore.W;
        }