Esempio n. 1
0
        protected override Quad ComputeScreenSpaceDrawQuad()
        {
            if (EdgeSmoothness == Vector2.Zero)
            {
                inflationAmount = Vector2.Zero;
                return(base.ComputeScreenSpaceDrawQuad());
            }
            Debug.Assert(
                EdgeSmoothness.X <= MAX_EDGE_SMOOTHNESS &&
                EdgeSmoothness.Y <= MAX_EDGE_SMOOTHNESS,
                $@"May not smooth more than {MAX_EDGE_SMOOTHNESS} or will leak neighboring textures in atlas.");

            Vector3 scale = DrawInfo.MatrixInverse.ExtractScale();

            inflationAmount = new Vector2(scale.X * EdgeSmoothness.X, scale.Y * EdgeSmoothness.Y);
            return(ToScreenSpace(DrawRectangle.Inflate(inflationAmount)));
        }
Esempio n. 2
0
        protected override Quad ComputeScreenSpaceDrawQuad()
        {
            if (EdgeSmoothness == Vector2.Zero)
            {
                inflationAmount = Vector2.Zero;
                return(base.ComputeScreenSpaceDrawQuad());
            }

            if (EdgeSmoothness.X > MAX_EDGE_SMOOTHNESS || EdgeSmoothness.Y > MAX_EDGE_SMOOTHNESS)
            {
                throw new InvalidOperationException($"May not smooth more than {MAX_EDGE_SMOOTHNESS} or will leak neighboring textures in atlas. Tried to smooth by ({EdgeSmoothness.X}, {EdgeSmoothness.Y}).");
            }

            Vector3 scale = DrawInfo.MatrixInverse.ExtractScale();

            inflationAmount = new Vector2(scale.X * EdgeSmoothness.X, scale.Y * EdgeSmoothness.Y);
            return(ToScreenSpace(DrawRectangle.Inflate(inflationAmount)));
        }
Esempio n. 3
0
 public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)
 // This probably shouldn't exist as is, but the columns in the stage are separated by a 1px border
 => DrawRectangle.Inflate(new Vector2(Stage.COLUMN_SPACING / 2, 0)).Contains(ToLocalSpace(screenSpacePos));