Ejemplo n.º 1
0
        public void FillCircle(FPoint center, float radius, int sides, Color color)
        {
#if DEBUG
            IncRenderSpriteCount(sides);
#endif

            float angle      = FloatMath.TAU / sides;
            float sideWidth  = FloatMath.Asin(angle / 2) * 2 * radius;
            float rectHeight = FloatMath.Sin(FloatMath.RAD_POS_090 - angle / 2) * radius;


            var r = new FRectangle(center.X - sideWidth / 2, center.Y, sideWidth, rectHeight);

            for (int i = 0; i < sides; i++)
            {
                internalBatch.Draw(
                    StaticTextures.SinglePixel.Texture,
                    null,
                    r.Round(),
                    StaticTextures.SinglePixel.Bounds,
                    new Vector2(0.5f, 0),
                    angle * i,
                    Vector2.One,
                    color);
            }
        }
		public override void FillCircle(Vector2 center, float radius, int sides, Color color)
		{
#if DEBUG
			IncRenderSpriteCount(sides);
#endif

			float angle = FloatMath.TAU / sides;
			float sideWidth = FloatMath.Asin(angle / 2) * 2 * radius;
			float rectHeight = FloatMath.Sin(FloatMath.RAD_POS_090 - angle / 2) * radius;

			
			var r = new FRectangle(center.X - sideWidth/2, center.Y, sideWidth, rectHeight);
			
			for (int i = 0; i < sides; i++)
			{
				internalBatch.Draw(
					StaticTextures.SinglePixel.Texture,
					null,
					r.Round(),
					StaticTextures.SinglePixel.Bounds,
					new Vector2(0.5f, 0),
					angle * i,
					Vector2.One, 
					color);
			}
		}
Ejemplo n.º 3
0
		public static void DrawSimpleRect(IBatchRenderer sbatch, FRectangle bounds, Color color)
		{
			StaticTextures.ThrowIfNotInitialized();

			sbatch.Draw(
				StaticTextures.SinglePixel.Texture,
				bounds.Round(),
				StaticTextures.SinglePixel.Bounds,
				color);
		}