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); } }
public static void DrawSimpleRect(IBatchRenderer sbatch, FRectangle bounds, Color color) { StaticTextures.ThrowIfNotInitialized(); sbatch.Draw( StaticTextures.SinglePixel.Texture, bounds.Round(), StaticTextures.SinglePixel.Bounds, color); }