예제 #1
1
        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);
            }
        }
예제 #2
0
        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);
        }
        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);
                }
            }
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
파일: CozyCircle.cs 프로젝트: xxy1991/cozy
        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);
        }
예제 #6
0
        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();
        }
예제 #7
0
        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);
                }
            }
        }
예제 #8
0
 protected override void OnDraw(SpriteBatch batch)
 {
     batch.Start();
     batch.DrawCircle(new Vector2(640, 360), 20, 48, Color.Red);
     batch.End();
 }
예제 #9
0
 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);
 }
예제 #10
0
파일: Blob.cs 프로젝트: QSilver/MonoBlob
 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);
 }
예제 #11
0
        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;
            }
        }
예제 #12
0
        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;
        }
예제 #13
0
        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);
            }
        }
예제 #14
0
        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;
                }
            }
        }