示例#1
0
        public static void DrawHollowRect(this Batcher batcher, float x, float y, float width, float height,
                                          Color color, float thickness = 1)
        {
            var tl = Vector2Ext.Round(new Vector2(x, y));
            var tr = Vector2Ext.Round(new Vector2(x + width, y));
            var br = Vector2Ext.Round(new Vector2(x + width, y + height));
            var bl = Vector2Ext.Round(new Vector2(x, y + height));

            batcher.SetIgnoreRoundingDestinations(true);
            batcher.DrawLine(tl, tr, color, thickness);
            batcher.DrawLine(tr, br, color, thickness);
            batcher.DrawLine(br, bl, color, thickness);
            batcher.DrawLine(bl, tl, color, thickness);
            batcher.SetIgnoreRoundingDestinations(false);
        }
示例#2
0
        public static Point RoundToPoint(this Vector2 vec)
        {
            var roundedVec = Vector2Ext.Round(vec);

            return(new Point((int)roundedVec.X, (int)roundedVec.Y));
        }