当前位置: 首页>>代码示例>>C#>>正文


C# SpriteBatch.DrawCircle方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.SpriteBatch.DrawCircle方法的典型用法代码示例。如果您正苦于以下问题:C# SpriteBatch.DrawCircle方法的具体用法?C# SpriteBatch.DrawCircle怎么用?C# SpriteBatch.DrawCircle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.Graphics.SpriteBatch的用法示例。


在下文中一共展示了SpriteBatch.DrawCircle方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

        public override void Draw(SpriteBatch sp)
        {
            sp.DrawCircle(GetCenter().X, GetCenter().Y, Radius, 10, Color.White);

            for (int i = 0; i < _axes.Count; i++)
            {
                float a = _axes[i].Y / _axes[i].X;
                var x = new Vector2(GetCenter().X - (float)(Radius * Math.Cos(a)), GetCenter().Y - (float)(Radius * Math.Sin(a)));
                var y = new Vector2(GetCenter().X + (float)(Radius * Math.Cos(a)), GetCenter().Y + (float)(Radius * Math.Sin(a)));

                sp.DrawLine(x, y, Color.Red);
            }
        }
开发者ID:Noxalus,项目名称:Danmaku-no-Kyojin,代码行数:13,代码来源:CollisionCircle.cs

示例2: Draw

        public void Draw(SpriteBatch spriteBatch, Vector2 centerPosition)
        {
            spriteBatch.Draw(TextureAtlas.Texture,
                             centerPosition,
                             TextureAtlas.FrameRectangle,
                             origin: Origin,
                             scale: Scale,
                             rotation: Rotation,
                             color: Color,
                             effects: SpriteEffect,
                             layerDepth: 0.0f);

            spriteBatch.DrawCircle(centerPosition, 1, Color.RoyalBlue);
        }
开发者ID:gmoller,项目名称:SpaceDefender,代码行数:14,代码来源:Sprite.cs

示例3: Draw

        public virtual void Draw(SpriteBatch spriteBatch)
        {
            if (IsAlive)
            {
                Sprite.Draw(spriteBatch, CenterPosition);

                if (Globals.ShowBounds)
                {
                    // BoundingCircle - green
                    spriteBatch.DrawCircle(new Vector2(BoundingCircle.Center.X, BoundingCircle.Center.Y), BoundingCircle.Radius, Color.Green, 1000);

                    // Bounding Rectangle - yellow
                    spriteBatch.DrawRectangle(new Rectangle((int)BoundingRectangle.Origin.X, (int)BoundingRectangle.Origin.Y, (int)BoundingRectangle.Size.X, (int)BoundingRectangle.Size.Y), Color.Yellow, false);

                    // Rectangle around entire sprite - red
                    TextureAtlas atlas = Sprite.TextureAtlas;
                    spriteBatch.DrawRectangle(new Rectangle((int)TopLeftPosition.X, (int)TopLeftPosition.Y, (int)((atlas.SingleTextureWidth) * Sprite.Scale.X), (int)(atlas.SingleTextureHeight * Sprite.Scale.Y)), Color.Red, false);
                }
            }
        }
开发者ID:gmoller,项目名称:SpaceDefender,代码行数:20,代码来源:MyDrawableGameComponent.cs

示例4: Draw

        public override void Draw(SpriteBatch spriteBatch)
        {
            var tex = Texture;

            var pos = Pos - new Vector2(tex.Width / 2, tex.Height / 2);
            spriteBatch.Draw(tex, pos, Color.White);

            if (!Game.drawVisualHelpers.IsNone)
            {
                spriteBatch.DrawLine(Pos, Master.Pos, Color.Red);
                spriteBatch.DrawCircle(Pos, ProximityRadius, 16, Color.Yellow);
            }
        }
开发者ID:GretelF,项目名称:squircle,代码行数:13,代码来源:TriggerObjects.cs

示例5: DrawSelf

        protected override void DrawSelf(GameTime gameTime, SpriteBatch spriteBatch)
        {
            var center = GlobalPosition + Transform + ContentSize / 2;

            if (HasBorder)
            {
                spriteBatch.DrawCircle(center, Radius + BorderSize, Radius, Color.Black, BorderSize);
            }
            spriteBatch.DrawCircle(center, Radius, Radius, ColorProperty, Radius);
        }
开发者ID:xxy1991,项目名称:cozy,代码行数:10,代码来源:CozyCircle.cs

示例6: Draw

        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);

            spriteBatch.Begin(
                 SpriteSortMode.BackToFront,
                 BlendState.AlphaBlend,
                 null,
                 null,
                 null,
                 null,
                 Camera.Transform);

            var cnt = 0;
            foreach (var chain in chains)
            {
                var thickness = cnt == _chainIndex
                    ? 4
                    : 2;

                var chainPixels = chain.Select(
                    delegate(WorldCollisionGeometrySegment x)
                    {
                        x.EndPoint = PhysicsConstants.MetersToPixels(x.EndPoint);
                        return x;
                    });

                foreach (var link in chainPixels.Take(chain.Count - 1).Zip(chainPixels.Skip(1), Tuple.Create))
                {
                    var color = link.Item2.IsOneWay
                        ? Color.Red
                        : Color.Orange;

                    spriteBatch.DrawLine(
                        TextureCache.GetResource("blank"),
                        link.Item1.EndPoint,
                        link.Item2.EndPoint,
                        thickness,
                        color);
                }

                chainPixels.Where(x => x.EndPoint != highlighted)
                    .ForEach(x => spriteBatch.DrawCircle(TextureCache, x.EndPoint, new Vector2(6, 6), Color.White));

                cnt++;
            }

            if (highlighted != null)
                spriteBatch.DrawCircle(TextureCache, PhysicsConstants.MetersToPixels(highlighted ?? Vector2.Zero), new Vector2(10, 10), Color.LightYellow);

            spriteBatch.End();
        }
开发者ID:pquinn,项目名称:time-sink,代码行数:52,代码来源:GeometryPlacementState.cs

示例7: Draw

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(this.texture, guidePosition, guideSourceRect, Color.White);
            //spriteBatch.Draw(this.texture, guidePosition, Color.White);

            // DEBUG: Draw locations of buttons and tabs
            if (Settings.SHOW_HITBOXES)
            {
                Vector2 openButtonPosition, closeButtonPosition, tab1, tab2, tab3, tab4, tabSize;
                tabSize = new Vector2(Settings.CALLOUT_TAB_WIDTH, Settings.CALLOUT_TAB_HEIGHT);
                if (this.IsLeftward)
                {
                    openButtonPosition = Settings.CALLOUT_OPEN_BUTTON_LEFT;
                    closeButtonPosition = Settings.CALLOUT_CLOSE_BUTTON_LEFT;
                    if (this.IsUpsideDown)
                    {
                        tab1 = -Settings.CALLOUT_TAB1_BUTTON;
                        tab2 = -Settings.CALLOUT_TAB2_BUTTON;
                        tab3 = -Settings.CALLOUT_TAB3_BUTTON;
                        tab4 = -Settings.CALLOUT_TAB4_BUTTON;
                    }
                    else
                    {
                        tab1 = Settings.CALLOUT_TAB1_BUTTON_LEFT;
                        tab2 = Settings.CALLOUT_TAB2_BUTTON_LEFT;
                        tab3 = Settings.CALLOUT_TAB3_BUTTON_LEFT;
                        tab4 = Settings.CALLOUT_TAB4_BUTTON_LEFT;
                    }
                }
                else
                {
                    openButtonPosition = Settings.CALLOUT_OPEN_BUTTON;
                    closeButtonPosition = Settings.CALLOUT_CLOSE_BUTTON;
                    if (this.IsUpsideDown)
                    {
                        tab1 = -Settings.CALLOUT_TAB1_BUTTON_LEFT;
                        tab2 = -Settings.CALLOUT_TAB2_BUTTON_LEFT;
                        tab3 = -Settings.CALLOUT_TAB3_BUTTON_LEFT;
                        tab4 = -Settings.CALLOUT_TAB4_BUTTON_LEFT;
                    }
                    else
                    {
                        tab1 = Settings.CALLOUT_TAB1_BUTTON;
                        tab2 = Settings.CALLOUT_TAB2_BUTTON;
                        tab3 = Settings.CALLOUT_TAB3_BUTTON;
                        tab4 = Settings.CALLOUT_TAB4_BUTTON;
                    }
                }
                if (this.CurrentState == Guide.GuideState.CLOSED)
                {
                    spriteBatch.DrawCircle(this.ParentZoomCircle.position + openButtonPosition, Settings.CALLOUT_DETECTION_RADIUS, 64, Color.Pink);
                }
                else if (this.CurrentState == Guide.GuideState.OPEN)
                {
                    spriteBatch.DrawCircle(this.ParentZoomCircle.position + closeButtonPosition, Settings.CALLOUT_DETECTION_RADIUS, 64, Color.Pink);
                    spriteBatch.DrawRectangle(this.ParentZoomCircle.position + new Vector2(tab1.X - tabSize.X / 2, tab1.Y - tabSize.Y / 2), tabSize, Color.Pink, 1f);
                    spriteBatch.DrawRectangle(this.ParentZoomCircle.position + new Vector2(tab2.X - tabSize.X / 2, tab2.Y - tabSize.Y / 2), tabSize, Color.Pink, 1f);
                    spriteBatch.DrawRectangle(this.ParentZoomCircle.position + new Vector2(tab3.X - tabSize.X / 2, tab3.Y - tabSize.Y / 2), tabSize, Color.Pink, 1f);
                    spriteBatch.DrawRectangle(this.ParentZoomCircle.position + new Vector2(tab4.X - tabSize.X / 2, tab4.Y - tabSize.Y / 2), tabSize, Color.Pink, 1f);
                }
            }
        }
开发者ID:javidhsueh,项目名称:planktonpopulations,代码行数:62,代码来源:Guide.cs

示例8: OnDraw

 protected override void OnDraw(SpriteBatch batch)
 {
     batch.Start();
     batch.DrawCircle(new Vector2(640, 360), 20, 48, Color.Red);
     batch.End();
 }
开发者ID:WoLfulus,项目名称:Double,代码行数:6,代码来源:SceneSplash.cs

示例9: Render

 public void Render(SpriteBatch b)
 {
     b.DrawCircle(Position, 5f, 200, Team.TeamColor);
     b.DrawCircle(Position, Range, 300, Team.TeamColor);
     Health.DrawHealthBar(new Vector2(Position.X - 25, Position.Y - 20), b);
 }
开发者ID:blackdragon723,项目名称:rpgsim,代码行数:6,代码来源:Unit.cs

示例10: Draw

 public void Draw(SpriteBatch spriteBatch)
 {
     // fancy drawing here
     // spriteBatch.DrawRectangle(new Vector2(this.x - 5, this.y - 5), new Vector2(10, 10), Color.Red);
     spriteBatch.DrawCircle(this.x, this.y, 2f, 20, Color.Red, 5f);
 }
开发者ID:QSilver,项目名称:MonoBlob,代码行数:6,代码来源:Blob.cs

示例11: Draw

        public void Draw(SpriteBatch batch, Texture2D Graphic)
        {
            if (Opacity <= 0) return;

            switch (Shape)
            {
                case ParticleShape.Circle:
                    batch.DrawCircle(Position, CurrentSize, 20, Color.FromNonPremultiplied(BackColor.R, BackColor.G, BackColor.B, Opacity), CurrentSize);
                    break;

                case ParticleShape.Square:
                    batch.DrawRectangle(new Rectangle((Int32)Position.X, (Int32)Position.Y, (Int32)CurrentSize, (Int32)CurrentSize), Color.FromNonPremultiplied(BackColor.R, BackColor.G, BackColor.B, Opacity), CurrentSize);
                    break;

                case ParticleShape.Texture:
                    batch.Draw(Graphic, Position, Graphic.Bounds, Color.FromNonPremultiplied(255, 255, 255, Opacity));
                    break;

                default:
                    break;
            }
        }
开发者ID:rykdesjardins,项目名称:pixel-lion,代码行数:22,代码来源:ParticleEngine.cs

示例12: Update

        public void Update()
        {
            graphicsDevice.SetRenderTarget(clockTarget);
            graphicsDevice.Clear(Color.Black);
            SpriteBatch spriteBatch = new SpriteBatch(graphicsDevice);
            spriteBatch.Begin();
            //spriteBatch.Begin(SpriteSortMode.Deferred, BlendState, SamplerState.LinearClamp, null, null);
            float timelineX = Settings.TIMELINE_CIRCULAR_RADIUS * 2;
            float timelineY = Settings.TIMELINE_CIRCULAR_RADIUS * 2;
            Vector2 timelineCenterPosition = new Vector2(timelineX, timelineY);
            spriteBatch.DrawCircle(timelineX, timelineY, (float)Settings.TIMELINE_CIRCULAR_RADIUS, 64, Color.Gray, 1.0F);
            float playPositionAngle = ((float)player.PlayPosition.Ticks % ((float)video.Duration.Ticks / 6.0F)) / ((float)video.Duration.Ticks / 6.0F) * 2.0F * (float)Math.PI + (float)Math.PI * 3.0F / 2.0F;
            playPositionAngle = playPositionAngle % ((float)Math.PI * 2);
            spriteBatch.DrawLine(new Vector2(timelineX, timelineY), Settings.TIMELINE_CIRCULAR_RADIUS, playPositionAngle, Color.White);

            for (int i = 0; i < 13; i += 1) // iterate over a year in increments of 1 month
            {
                double monthAngle = i / 12.0 * 2.0 * Math.PI + (float)Math.PI * 3.0F / 2.0F;
                monthAngle = monthAngle % (Math.PI * 2);
                Vector2 monthPosition = new Vector2((float)Math.Cos(monthAngle) * (Settings.TIMELINE_CIRCULAR_RADIUS - 10), (float)Math.Sin(monthAngle) * (Settings.TIMELINE_CIRCULAR_RADIUS - 10)) + timelineCenterPosition;
                Color monthNameColor = Color.Gray;
                if (Math.Abs(monthAngle - playPositionAngle) <= (Math.PI * 2.0 / 12.0) || Math.Abs(monthAngle + (Math.PI * 2) - playPositionAngle) <= (Math.PI * 2.0 / 12.0))
                    monthNameColor = Color.White;
                if (i % 3 == 0)
                {
                    spriteBatch.DrawLine(monthPosition, 10.0F, (float)monthAngle, monthNameColor);
                    float fontOffsetX = PlanktonPopulations.mediumFont.MeasureString(MonthNamesShort[i]).X / 2;
                    float fontOffsetY = PlanktonPopulations.mediumFont.MeasureString(MonthNamesShort[i]).Y / 2;
                    Vector2 monthNamePosition = new Vector2((float)Math.Cos(monthAngle) * (Settings.TIMELINE_CIRCULAR_RADIUS + 20) - fontOffsetX, (float)Math.Sin(monthAngle) * (Settings.TIMELINE_CIRCULAR_RADIUS + 12 + 20 * (float)Math.Abs(Math.Cos(monthAngle))) - fontOffsetY) + timelineCenterPosition;
                    spriteBatch.DrawString(PlanktonPopulations.mediumFont, MonthNamesShort[i], monthNamePosition, monthNameColor);
                }
            }
            spriteBatch.End();
            graphicsDevice.SetRenderTarget(null);
            clockTexture = (Texture2D)clockTarget;
        }
开发者ID:javidhsueh,项目名称:planktonpopulations,代码行数:36,代码来源:Timeline.cs

示例13: Draw

        public void Draw(SpriteBatch spritebatch)
        {
            if (_path.Count > 0)
            {
                foreach (Tile tile in _path)
                {
                    spritebatch.DrawCircle(tile.Center, 4, 10, Color.Yellow, 1.5f);
                }

                spritebatch.DrawCircle(_path.Last.Value.Center, 4, 10, Color.Red, 2.0f);
            }
        }
开发者ID:MitchJH,项目名称:BaseBuilder,代码行数:12,代码来源:CrewMember.cs

示例14: DrawShape

        public void DrawShape(scDebugData debugData, SpriteBatch spriteBatch, scShape shape, scTransform transform)
        {
            switch (shape.ShapeType)
            {
                case scShapeType.Circle:
                {
                    var circle = (scCircleShape)shape;
                    spriteBatch.DrawCircle(transform.position + circle.localPosition, circle.radius, debugData.CircleShapeSides, debugData.CircleShapeColor);
                    break;
                }
                case scShapeType.Rectangle:
                {
                    var rectangle = (scRectangleShape)shape;

                    var A = transform.position + rectangle.vertices[0].Rotate(transform.rotation.radians);
                    var B = transform.position + rectangle.vertices[1].Rotate(transform.rotation.radians);
                    var C = transform.position + rectangle.vertices[2].Rotate(transform.rotation.radians);
                    var D = transform.position + rectangle.vertices[3].Rotate(transform.rotation.radians);

                    spriteBatch.DrawLine(A, B, debugData.RectangleShapeColor);
                    spriteBatch.DrawLine(B, C, debugData.RectangleShapeColor);
                    spriteBatch.DrawLine(C, D, debugData.RectangleShapeColor);
                    spriteBatch.DrawLine(D, A, debugData.RectangleShapeColor);

                    break;
                }
                case scShapeType.Edge:
                {
                    var edge = (scEdgeShape)shape;
                    var start = scTransformUtils.applyTransform(transform, edge.start);
                    var end = scTransformUtils.applyTransform(transform, edge.end);
                    spriteBatch.DrawLine(start, end, debugData.EdgeShapeColor);
                    break;
                }
            }
        }
开发者ID:GretelF,项目名称:squircle,代码行数:36,代码来源:PhysicsWorldDebugRenderer.cs


注:本文中的Microsoft.Xna.Framework.Graphics.SpriteBatch.DrawCircle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。