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);
            }
        }
        public override void Draw(SpriteBatch sp)
        {
            Vector2 previousPosition = GetPosition(Vertices[0]);

            for (int i = 1; i <= Vertices.Count; i++)
            {
                Vector2 position = GetPosition(i == Vertices.Count ? Vertices[0] : Vertices[i]);

                sp.DrawLine(
                    previousPosition.X,
                    previousPosition.Y,
                    position.X,
                    position.Y, Color.White);

                Vector2 axis = Vector2.Normalize(position - previousPosition);

                sp.DrawLine(
                    previousPosition.X - ((previousPosition.X - position.X) / 2), previousPosition.Y - ((previousPosition.Y - position.Y) / 2),
                    (previousPosition.X) + axis.Y * 2000, (previousPosition.Y) - axis.X * 2000,
                    Color.Red);

                if (_circleAxes.Count > 0)
                {
                    sp.DrawLine(
                        previousPosition.X, previousPosition.Y,
                        (previousPosition.X) + _circleAxes[i - 1].X * 2000, (previousPosition.Y) - _circleAxes[i - 1].Y * -2000,
                        Color.Red);
                }

                previousPosition = position;
            }
        }
        public void Draw(GameTime gameTime, GraphicsDevice graphicsDevice, SpriteBatch spriteBatch)
        {
            switch (_currentMap)
            {
                case SimulationScreenMap.Urban: _playerGame.UrbanMap.Draw(gameTime); break;
                case SimulationScreenMap.Country: _playerGame.CountryMap.Draw(gameTime); break;
                case SimulationScreenMap.Ocean: _playerGame.OceanMap.Draw(gameTime); break;
            }

            spriteBatch.DrawLine(150, 0, 150, graphicsDevice.Viewport.Height, Color.White);
            spriteBatch.DrawLine(0, graphicsDevice.Viewport.Height - 100, graphicsDevice.Viewport.Width,
                graphicsDevice.Viewport.Height - 100, Color.White);

            /* Area selection */
            Rectangle areaSelectionUrban = new Rectangle(5, graphicsDevice.Viewport.Height - 148, 43, 43);
            Rectangle areaSelectionCountry = new Rectangle(53, graphicsDevice.Viewport.Height - 148, 43, 43);
            Rectangle areaSelectionOcean = new Rectangle(101, graphicsDevice.Viewport.Height - 148, 43, 43);
            spriteBatch.DrawRectangle(0, graphicsDevice.Viewport.Height - 174, 150, 75, Color.White);
            spriteBatch.FillRectangle(areaSelectionUrban, (_currentMap == SimulationScreenMap.Urban ?
                Color.LightGray : Color.Gray));
            spriteBatch.DrawRectangle(areaSelectionUrban, Color.White);
            spriteBatch.FillRectangle(areaSelectionCountry, (_currentMap == SimulationScreenMap.Country ?
                Color.LightGray : Color.Gray));
            spriteBatch.DrawRectangle(areaSelectionCountry, Color.White);
            spriteBatch.FillRectangle(areaSelectionOcean, (_currentMap == SimulationScreenMap.Ocean ?
                Color.LightGray : Color.Gray));
            spriteBatch.DrawRectangle(areaSelectionOcean, Color.White);
        }
Example #4
0
 public static void Draw( this Rectangle rectangle, SpriteBatch spriteBatch )
 {
     spriteBatch.DrawLine( new Vector2( rectangle.X, rectangle.Y ),
         new Vector2( rectangle.X + rectangle.Width, rectangle.Y ), Color.Black );
     spriteBatch.DrawLine( new Vector2( rectangle.X + rectangle.Width, rectangle.Y ),
         new Vector2( rectangle.X + rectangle.Width, rectangle.Y + rectangle.Height ), Color.Black );
     spriteBatch.DrawLine( new Vector2( rectangle.X + rectangle.Width, rectangle.Y + rectangle.Height ),
         new Vector2( rectangle.X, rectangle.Y + rectangle.Height ), Color.Black );
     spriteBatch.DrawLine( new Vector2( rectangle.X, rectangle.Y + rectangle.Height ),
         new Vector2( rectangle.X, rectangle.Y ), Color.Black );
 }
        public void Draw(SortedDictionary<Identifier512, Peer> peers, SpriteBatch batch, Texture2D whitePixel)
        {
            var start = GetPosition(Start, peers);

            batch.DrawLine(whitePixel, start, GetPosition(Target, peers), 2, Color.Black);

            if (contacted != null)
                foreach (var c in contacted)
                    batch.DrawLine(whitePixel, start, GetPosition(c, peers), 2, Color.Yellow);

            if (heap != null)
                foreach (var h in heap)
                    batch.DrawLine(whitePixel, start, GetPosition(h, peers), 2, Color.Green);
        }
Example #6
0
 public void Draw(SpriteBatch spriteBatch, Color colour)
 {
     foreach(Vector2[] v in Edges)
     {
         spriteBatch.DrawLine(v[0], v[1], colour);
     }
 }
        public override void Draw(SpriteBatch sp)
        {
            if (Vertices.Count == 0)
                return;

            Vector2 previousPosition = GetWorldPosition(Vertices[0]);

            for (int i = 1; i <= Vertices.Count; i++)
            {
                Vector2 position = GetWorldPosition(i == Vertices.Count ? Vertices[0] : Vertices[i]);

                sp.DrawLine(
                    previousPosition.X,
                    previousPosition.Y,
                    position.X,
                    position.Y, Color.Red);

                /*
                Vector2 axis = Vector2.Normalize(position - previousPosition);
                sp.DrawLine(
                    (previousPosition.X + position.X) / 2f,
                    (previousPosition.Y + position.Y) / 2f,
                    (previousPosition.X) + axis.Y * 2000,
                    (previousPosition.Y) - axis.X * 2000,
                    Color.Red);
                */

                previousPosition = position;
            }
        }
Example #8
0
        /// <summary>
        /// Called when drawing the HUD component.
        /// </summary>
        /// <param name="batch">The sprite batch instance.</param>
        /// <param name="position"></param>
        protected override void OnDraw(SpriteBatch batch, Vector2 position)
        {
            if (this.Visible)
            {
                // Background
                batch.Draw(this.texture, new Rectangle((int)position.X, (int)position.Y, (int)this.Size.X, (int)this.Size.Y), this.color);

                // Borders
                batch.DrawLine(position, position + new Vector2(this.Size.X, 0), Color.Black); // topl -> topr
                batch.DrawLine(position + new Vector2(this.Size.X, 0), position + new Vector2(this.Size.X, this.Size.Y), Color.Black); // topr -> botr
                batch.DrawLine(position + new Vector2(this.Size.X, this.Size.Y), position + new Vector2(0, this.Size.Y), Color.Black); // botr -> botl
                batch.DrawLine(position + new Vector2(0, this.Size.Y), position, Color.Black); // botl -> topl

                // Font
                var size = this.font.Content.MeasureString(this.Text);
                batch.DrawFont(this.font.Content, position + (this.Size / 2) - new Vector2(0, size.Y / 2), FontAlignment.Center, Color.White, this.Text);
            }
        }
Example #9
0
        /// <summary>
        /// Draw grid.
        /// </summary>
        public void Draw(SpriteBatch spriteBatch)
        {
            // Draw columns
            for (int i = 1; i < _size.X; i++)
            {
                spriteBatch.DrawLine(1, Color.Gray,
                    _position + new Vector2(i * _cellSize, 0),
                    _position + new Vector2(i * _cellSize, _cellSize * _size.Y));
            }

            // Draw rows
            for (int i = 1; i < _size.Y; i++)
            {
                 spriteBatch.DrawLine(1, Color.Gray,
                    _position + new Vector2(0, i * _cellSize),
                    _position + new Vector2(_cellSize * _size.X, i * _cellSize));
            }
        }
        public void Draw( EditableCube.Face face, SpriteBatch spriteBatch, GameTime gameTime )
        {
            if ( !Started || face != mFace )
                return;

            Color color = ValidLine
                          ? new Color( 0, 0, 0, 255 )
                          : new Color( 0, 0, 0, 128 );

            spriteBatch.DrawLine( mLine, mTexture, color, 10 );
        }
Example #11
0
        public override void Draw(SpriteBatch batch)
        {
            if (Points.Empty()) return;

            var v2First = Points.First();
            var v2A     = v2First;
            foreach (var v2B in Points.Skip(1))
            {
                batch.DrawLine(v2A, v2B, Colour, Thickness, 0, Texture);
                v2A = v2B;
            }

            batch.DrawText(Font, Label, v2First, Colour.Invert());
        }
Example #12
0
        public void Draw(SpriteBatch batch)
        {
            if (!IsVisible) return;
            if (Vertices.Count == 0) return;

            switch (Type)
            {
                case PrimitiveType.Pixel:
                    batch.PutPixel(Vertices[0], Color);
                    break;
                case PrimitiveType.Line:
                    batch.DrawLine(Vertices[0], Vertices[1], Color, Thickness);
                    break;
            }
        }
 public void Draw(SpriteBatch sb, GameTime gameTime)
 {
     foreach (Enemy e in Enemies)
     {
         e.Draw(sb, gameTime);
         if (e != closestEnemy) continue;
         sb.DrawRectangle(e.HitBox, Color.Red);
     /*
         Stencil.Write("D: " + Math.Round((e.Center - player.Center).Length(), 1, MidpointRounding.AwayFromZero), sb, e.X + 4, e.Y + e.Height - 3, 0.5f);
         Stencil.Write("A: " + Math.Round(MathHelper.ToDegrees(player.Center.Angle(e.Center)), 1, MidpointRounding.AwayFromZero), sb, e.X + 4, e.Y + e.Height + 9, 0.5f);
         Stencil.Write("L: " + e.Health, sb, e.X + 4, e.Y + e.Height + 21, 0.5F);
     */
         if (e.Center.Y > 0)
             sb.DrawLine(e.Center, player.Center, Color.Red);
     }
 }
 public void DrawLinks(SpriteBatch batch, ContentManager content, IDictionary<Identifier512, Peer> peers)
 {
     for (int i = 0; i < buckets.Length; i++)
     {
         if (buckets[i] != null)
         {
             for (int j = 0; j < buckets[i].Length; j++)
             {
                 Peer otherPeer;
                 if (peers.TryGetValue(buckets[i][j], out otherPeer) && otherPeer.Position != Vector2.Zero)
                 {
                     batch.DrawLine(content.Load<Texture2D>("WhitePixel"), Position, otherPeer.Position, 1, Color.White);
                 }
             }
         }
     }
 }
Example #15
0
        public LightningTexture(GraphicsDevice device, int width, int height)
            : base(device, width, height)
        {
            anim = new AnimatedLightning(Vector2.Zero, new Vector2(width, height), 45, MathHelper.ToRadians(45), 0.7f, 5, 1, 10);

            var sb = new SpriteBatch(device);
            var target = new RenderTarget2D(GraphicsDevice, 50, 100, false
                , GraphicsDevice.PresentationParameters.BackBufferFormat
                , GraphicsDevice.PresentationParameters.DepthStencilFormat);
            var oldTargets = GraphicsDevice.GetRenderTargets();
            GraphicsDevice.SetRenderTarget(target);
            sb.Begin();
            foreach (var segment in anim.Segments)
            {
                sb.DrawLine(segment.From, segment.To, segment.Color);
            }
            sb.End();
            GraphicsDevice.SetRenderTargets(oldTargets);
            Color[] data = new Color[target.Width * target.Height];
            target.GetData<Color>(data);
            this.SetData<Color>(data);
        }
Example #16
0
        /// <summary>
        /// Called when drawing the HUD component.
        /// </summary>
        /// <param name="batch">The sprite batch instance.</param>
        /// <param name="position"></param>
        protected override void OnDraw(SpriteBatch batch, Vector2 position)
        {
            if (this.Visible)
            {
                // Background

                batch.Draw(this.texture, new Rectangle((int)position.X, (int)position.Y, (int)this.Size.X, (int)this.Size.Y), this.color);

                // Borders
                batch.DrawLine(position, position + new Vector2(this.Size.X, 0), Color.Black, 2);
                batch.DrawLine(position + new Vector2(this.Size.X, 0), position + new Vector2(this.Size.X, this.Size.Y), Color.Black, 2);
                batch.DrawLine(position + new Vector2(this.Size.X, this.Size.Y), position + new Vector2(0, this.Size.Y), Color.Black, 2);
                batch.DrawLine(position + new Vector2(0, this.Size.Y), position, Color.Black, 2);

                batch.EnableScissor(new Rectangle((int)position.X + 2, (int)position.Y + 2, (int)this.Size.X - 4, (int)this.Size.Y - 4));
                {
                    var text = this.Password ? (this.Text.Length > 0 ? Enumerable.Repeat("*", this.Text.Length).Aggregate((s, n) => s + n) : "") : this.Text;
                    var size = this.font.Content.MeasureString(this.Text);
                    var pos = position + new Vector2(5, (this.Size.Y - size.Y) / 2);
                    if (size.X > this.Size.X - 10)
                    {
                        pos.X = (pos.X + this.Size.X - 10) - size.X;
                    }
                    batch.DrawString(this.font.Content, text, pos, Color.Black);
                }
                batch.DisableScissor();
            }
        }
        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();
        }
Example #18
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            // spriteBatch.Draw(texture, Position, coinRect, Color.White);
            if(faceDir == FaceDir.left)
            spriteBatch.Draw(texture, ConvertUnits.ToDisplayUnits(rigidbody.Position), rect, Color.White, rigidbody.Rotation, new Vector2(rect.Width / 2.0f, rect.Height / 2.0f), 1f, SpriteEffects.None, 1f);
            else if (faceDir == FaceDir.right)
                spriteBatch.Draw(texture, ConvertUnits.ToDisplayUnits(rigidbody.Position), rect, Color.White, rigidbody.Rotation, new Vector2(rect.Width / 2.0f, rect.Height / 2.0f), 1f, SpriteEffects.FlipHorizontally, 1f);
            //base.Draw(spriteBatch);


#if DEBUG
            SpriteBatchEx.GraphicsDevice = Game1.graphics.GraphicsDevice;

            spriteBatch.DrawLine(ConvertUnits.ToDisplayUnits(rigidbody.Position), ConvertUnits.ToDisplayUnits(rigidbody.Position + new Vector2(distanceUp/2, -distanceUp)), Color.Yellow);
            spriteBatch.DrawLine(ConvertUnits.ToDisplayUnits(rigidbody.Position), ConvertUnits.ToDisplayUnits(rigidbody.Position + new Vector2(0, -distanceUp)), Color.Yellow);
            spriteBatch.DrawLine(ConvertUnits.ToDisplayUnits(rigidbody.Position), ConvertUnits.ToDisplayUnits(rigidbody.Position + new Vector2(-distanceUp/2, -distanceUp)), Color.Yellow);

            if (faceDir == FaceDir.right)
                spriteBatch.DrawLine(ConvertUnits.ToDisplayUnits(rigidbody.Position), ConvertUnits.ToDisplayUnits(rigidbody.Position + new Vector2(distance, 0)), Color.BlueViolet);
            else if (faceDir == FaceDir.left)
                spriteBatch.DrawLine(ConvertUnits.ToDisplayUnits(rigidbody.Position), ConvertUnits.ToDisplayUnits(rigidbody.Position + new Vector2(-distance, 0)), Color.BlueViolet);
#endif

        }
Example #19
0
        protected override void Draw(DeltaGameTime time, SpriteBatch spriteBatch)
        {
            Vector2 offset = new Vector2(_sheet.Width / 2, _sheet.Height / 2);
            spriteBatch.Draw(_sheet, Position, null, Color.White, _rotation + MathHelper.Pi * 0.5f, offset, 1, SpriteEffects.None, 0);

            Vector2 direction = Velocity;
            direction.Normalize();
            if (_isLeftCooldown)
                spriteBatch.DrawLine(Position, _rotation, 500, Color.DarkGreen.SetAlpha(HUD.LeftFillPercent), HUD.LeftFillPercent * 20);
            else if (_isRightCooldown)
                spriteBatch.DrawLine(Position, _rotation, 500, Color.DarkGreen.SetAlpha(HUD.RightFillPercent), HUD.RightFillPercent * 20);
        }
Example #20
0
        /// <summary>
        /// Draw.
        /// </summary>
        public void Draw(SpriteBatch spriteBatch)
        {
            var from = _waypoints.Peek();

            // TODO
            foreach (var point in _waypoints)
            {
                spriteBatch.DrawLine(3, Color.Green,
                    _board.Position + from * new Vector2(26, 26),
                    _board.Position + point * new Vector2(26, 26));
                from = point;
            }

            spriteBatch.Draw(_eraser, _board.Position + _pos * new Vector2(26, 26) + new Vector2(0, - 26), Color.White);
        }
Example #21
0
        public void Draw(SpriteBatch spriteBatch)
        {
            screenSize = new Vector2(1024,768);

            int width = points.GetLength(0);
            int height = points.GetLength(1);
            Color color = new Color(30, 30, 139, 85);	// dark blue

            for (int y = 1; y < height; y++)
            {
                for (int x = 1; x < width; x++)
                {
                    Vector2 left = new Vector2(), up = new Vector2();
                    Vector2 p = ToVec2(points[x, y].Position);
                    if (x > 1)
                    {
                        left = ToVec2(points[x - 1, y].Position);
                        float thickness = y % 3 == 1 ? 3f : 1f;

                        // use Catmull-Rom interpolation to help smooth bends in the grid
                        int clampedX = Math.Min(x + 1, width - 1);
                        Vector2 mid = Vector2.CatmullRom(ToVec2(points[x - 2, y].Position), left, p, ToVec2(points[clampedX, y].Position), 0.5f);

                        // If the grid is very straight here, draw a single straight line. Otherwise, draw lines to our
                        // new interpolated midpoint
                        if (Vector2.DistanceSquared(mid, (left + p) / 2) > 1)
                        {
                            spriteBatch.DrawLine(left, mid, color, thickness);
                            spriteBatch.DrawLine(mid, p, color, thickness);
                        }
                        else
                            spriteBatch.DrawLine(left, p, color, thickness);
                    }
                    if (y > 1)
                    {
                        up = ToVec2(points[x, y - 1].Position);
                        float thickness = x % 3 == 1 ? 3f : 1f;
                        int clampedY = Math.Min(y + 1, height - 1);
                        Vector2 mid = Vector2.CatmullRom(ToVec2(points[x, y - 2].Position), up, p, ToVec2(points[x, clampedY].Position), 0.5f);

                        if (Vector2.DistanceSquared(mid, (up + p) / 2) > 1)
                        {
                            spriteBatch.DrawLine(up, mid, color, thickness);
                            spriteBatch.DrawLine(mid, p, color, thickness);
                        }
                        else
                            spriteBatch.DrawLine(up, p, color, thickness);
                    }

                    // Add interpolated lines halfway between our point masses. This makes the grid look
                    // denser without the cost of simulating more springs and point masses.
                    if (x > 1 && y > 1)
                    {
                        Vector2 upLeft = ToVec2(points[x - 1, y - 1].Position);
                        spriteBatch.DrawLine(0.5f * (upLeft + up), 0.5f * (left + p), color, 1f);	// vertical line
                        spriteBatch.DrawLine(0.5f * (upLeft + left), 0.5f * (up + p), color, 1f);	// horizontal line
                    }
                }
            }
        }
Example #22
0
        /// <summary>
        /// Draw
        /// </summary>
        /// <param name="batch"></param>
        /// <param name="position"></param>
        protected override void OnDraw(SpriteBatch batch, Vector2 position)
        {
            if (this.Visible)
            {
                // Background
                batch.Draw(this.texture, new Rectangle((int)position.X, (int)position.Y, (int)this.Size.X, (int)this.Size.Y), this.color);

                // Borders
                batch.DrawLine(position, position + new Vector2(this.Size.X, 0), Color.Black, 2);
                batch.DrawLine(position + new Vector2(this.Size.X, 0), position + new Vector2(this.Size.X, this.Size.Y), Color.Black, 2);
                batch.DrawLine(position + new Vector2(this.Size.X, this.Size.Y), position + new Vector2(0, this.Size.Y), Color.Black, 2);
                batch.DrawLine(position + new Vector2(0, this.Size.Y), position, Color.Black, 2);

                batch.EnableScissor(new Rectangle((int)position.X + 2, (int)position.Y + 2, (int)this.Size.X - 2, (int)this.Size.Y - 2));
                {
                    batch.Draw(this.texture, new Rectangle(0, 0, 1, 1), Color.White * 0.0f);

                    var lastPosition = position + new Vector2(2, this.Size.Y - 2);
                    for (int i = this.messages.Count - 1; i >= 0; i--)
                    {
                        var text = this.messages[i];
                        var size = this.font.Content.MeasureText(text);
                        lastPosition.Y -= size.Y;
                        batch.DrawString(this.font.Content, text, lastPosition, Color.Black);
                    }
                }
                batch.DisableScissor();
            }
        }
Example #23
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);
            }
        }
Example #24
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            var pos = Pos;
            spriteBatch.Draw(_texture,
                             pos,
                             null,
                             DrawColor,
                             Body.transform.rotation.radians,
                             new Vector2(_texture.Width / 2, _texture.Height / 2),
                             1.0f,
                             SpriteEffects.None,
                             0.0f);

            if (State.IsInactive) { return; }

            if (!Game.drawVisualHelpers.IsNone)
            {
                spriteBatch.DrawLine(pos, WaypointStart, Color.Blue);
                spriteBatch.DrawLine(pos, WaypointEnd, Color.Blue);
                if(!IsAtTarget) spriteBatch.DrawLine(pos, Target, Color.Red);
            }
        }
Example #25
0
        public void Draw(GameTime gameTime, GraphicsDevice graphicsDevice, SpriteBatch spriteBatch)
        {
            Map currentMap = null;
            switch (_currentMap)
            {
                case SimulationScreenMap.Urban:
                    currentMap = _playerGame.UrbanMap;
                    break;
                case SimulationScreenMap.Country:
                    currentMap = _playerGame.CountryMap;
                    break;
                case SimulationScreenMap.Ocean:
                    currentMap = _playerGame.OceanMap;
                    break;
            }
            graphicsDevice.Clear(currentMap.BackgroundColor);
            currentMap.Draw(gameTime, spriteBatch, mapWindow, skin);
            if (currentMap.BuildingPlacementInfo != null)
            {
                Vector2 currentReasonLocation = new Vector2(GlobalSettings.ScreenWidth - 250, 100);
                foreach (string cannotPlaceReason in currentMap.BuildingPlacementInfo.ReasonsCannotPlace)
                {
                    string reason = "• " + cannotPlaceReason;
                    string[] lines = skin.Fonts[13].WordWrap(reason, 240);
                    foreach (string line in lines)
                    {
                        spriteBatch.DrawString(skin.Fonts[13], line, currentReasonLocation, Color.Red);
                        currentReasonLocation.Y += skin.Fonts[13].MeasureString(line).Y;
                    }
                }
            }

            /* Interface/Backdrops */
            spriteBatch.Draw(skin.SimulationScreenInterface, new Rectangle(0, 0, GlobalSettings.ScreenWidth,
                GlobalSettings.ScreenHeight), Color.White);

            /* Minimap */
            spriteBatch.Draw(currentMap.Minimap, minimapWindow, null, Color.White, MathHelper.PiOver4,
                Vector2.Zero, SpriteEffects.None, 0);
            spriteBatch.DrawLine(minimapVertices[0], minimapVertices[1], Color.Black);
            spriteBatch.DrawLine(minimapVertices[1], minimapVertices[2], Color.Black);
            spriteBatch.DrawLine(minimapVertices[2], minimapVertices[3], Color.Black);
            spriteBatch.DrawLine(minimapVertices[3], minimapVertices[0], Color.Black);

            /* Screen Items */
            if (outputText != null)
                spriteBatch.DrawString(outputText, new Vector2(mapWindow.X + 10,
                    mapWindow.Y + 10), Color.Black);

            List<ScreenItem> orderedScreenItems = controls.List.OrderBy<ScreenItem, int>(item => item.Layer).ToList<ScreenItem>();
            List<ScreenItem> itemsUnderMouse = new List<ScreenItem>();
            foreach (ScreenItem screenItem in orderedScreenItems)
            {
                if (screenItem == null || !screenItem.Visible)
                    continue;
                screenItem.Draw(gameTime, spriteBatch);
                if (screenItem.GetMouseOver())
                    itemsUnderMouse.Add(screenItem);
            }
            if (itemsUnderMouse.Count > 0 && itemsUnderMouse[itemsUnderMouse.Count - 1].Visible &&
                itemsUnderMouse[itemsUnderMouse.Count - 1].HasTooltip)
                itemsUnderMouse[itemsUnderMouse.Count - 1].DrawTooltip(spriteBatch, graphicsDevice);
        }
        public override void Draw(SpriteBatch spriteBatch)
        {
       
                if (playerDir == PlayerDir.left)
                    spriteBatch.Draw(texture, ConvertUnits.ToDisplayUnits(rigidbody.Position), playerRect, Color.White, 0f,
                        new Vector2(playerRect.Width / 2.0f, playerRect.Height / 2.0f), 1f, SpriteEffects.FlipHorizontally, LayerDepth);
                else if (playerDir == PlayerDir.right)
                    spriteBatch.Draw(texture, ConvertUnits.ToDisplayUnits(rigidbody.Position), playerRect, Color.White, 0f,
                        new Vector2(playerRect.Width / 2.0f, playerRect.Height / 2.0f), 1f, SpriteEffects.None, LayerDepth);
            //base.Draw(spriteBatch);
            if (!killed)
            {
#if DEBUG
                SpriteBatchEx.GraphicsDevice = Game1.graphics.GraphicsDevice;
                spriteBatch.DrawLine(ConvertUnits.ToDisplayUnits(rigidbody.Position), ConvertUnits.ToDisplayUnits(rigidbody.Position + new Vector2(0, distance)), Color.Red);
#endif
            }

        }
Example #27
0
        public void Draw(SpriteBatch batch)
        {
            if (IsAlive)
            {
                var color = Faction == Faction.Ally ? Color.Blue : Color.Red;
                batch.DrawRect(Position, 20, color);

                if (currentTarget != null)
                {
                    if (!currentTarget.Faction.IsHostile(Faction))
                        color = Color.Green;

                    var dir = currentTarget.Position - Position;
                    //dir.Normalize();
                    dir *= (AP / 100);

                    batch.DrawLine(Position, Position + dir, color, 2);
                }

            }
        }
        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;
        }
        public void Draw(SpriteBatch spriteBatch)
        {
            // Draw a playback circle if specified
            if (Settings.TIMELINE_CIRCULAR)
            {
                float timelineX = graphicsDevice.Viewport.X + Settings.TIMELINE_CIRCULAR_X - Settings.TIMELINE_CIRCULAR_RADIUS * 2;
                float timelineY = graphicsDevice.Viewport.Y + graphicsDevice.Viewport.Height - Settings.TIMELINE_CIRCULAR_Y - Settings.TIMELINE_CIRCULAR_RADIUS * 2;
                Vector2 clockPosition = new Vector2(timelineX, timelineY);
                spriteBatch.Draw(clockTexture, clockPosition, Color.White);
                if (Settings.TIMELINE_MIRROR)
                {
                    timelineX = graphicsDevice.Viewport.Width - Settings.TIMELINE_CIRCULAR_X;
                    timelineY = graphicsDevice.Viewport.Y + Settings.TIMELINE_CIRCULAR_Y;
                    clockPosition = new Vector2(timelineX, timelineY);
                    spriteBatch.Draw(clockTexture, clockPosition, null, Color.White, (float)Math.PI, new Vector2(Settings.TIMELINE_CIRCULAR_RADIUS * 2, Settings.TIMELINE_CIRCULAR_RADIUS * 2), 1f, SpriteEffects.None, 0f);
                }
            }
            if (Settings.TIMELINE_LINEAR)
            {
                // Draw a playback timeline
                float timelineX1 = graphicsDevice.Viewport.X + Settings.TIMELINE_X;
                float timelineX2 = graphicsDevice.Viewport.X + graphicsDevice.Viewport.Width - Settings.TIMELINE_X;
                float timelineY1 = graphicsDevice.Viewport.Y + graphicsDevice.Viewport.Height - Settings.TIMELINE_Y;
                float timelineY2 = timelineY1;
                spriteBatch.DrawLine(timelineX1, timelineY1, timelineX2, timelineY2, Color.Gray);

                // Draw a line indicating current playback time
                float playPositionNormalized = (float)player.PlayPosition.Ticks / (float)video.Duration.Ticks;
                if (Settings.TIMELINE_ONE_YEAR)
                    playPositionNormalized = ((float)player.PlayPosition.Ticks % ((float)video.Duration.Ticks / 6)) / ((float)video.Duration.Ticks / 6);
                float scrubberX = playPositionNormalized * (timelineX2 - timelineX1) + timelineX1;
                spriteBatch.DrawLine(scrubberX, timelineY1 + Settings.TIMELINE_SCRUBBER_HEIGHT / 2, scrubberX, timelineY1 - Settings.TIMELINE_SCRUBBER_HEIGHT / 2, Color.White, Settings.TIMELINE_SCRUBBER_WIDTH);

                // Draw hash marks for months and write month names
                if (Settings.TIMELINE_ONE_YEAR)
                {
                    int monthCounter = 0;
                    for (int i = 0; i < 13; i++) // iterate over entire timespan in increments of 1 month
                    {
                        float monthPositionNormalized = i / 12.0F;
                        float monthX = monthPositionNormalized * (timelineX2 - timelineX1) + timelineX1;
                        spriteBatch.DrawLine(monthX, timelineY1 + Settings.TIMELINE_MONTH_HASH_HEIGHT / 2, monthX, timelineY1 - Settings.TIMELINE_MONTH_HASH_HEIGHT / 2, Color.Gray);
                        float fontOffsetX = PlanktonPopulations.mediumFont.MeasureString(MonthNamesShort[monthCounter]).X / 2;
                        float fontOffsetY = PlanktonPopulations.mediumFont.MeasureString(MonthNamesShort[monthCounter]).Y;
                        Color monthNameColor = Color.Gray;
                        if (Math.Abs(monthPositionNormalized - playPositionNormalized) < (1.0 / 12.0))
                            monthNameColor = Color.White;
                        spriteBatch.DrawString(PlanktonPopulations.mediumFont, MonthNamesShort[monthCounter], new Vector2(monthX - fontOffsetX, timelineY1 - Settings.TIMELINE_MONTH_NAME_OFFSET - fontOffsetY), monthNameColor);
                        if (monthCounter >= (MonthNamesShort.Length - 1))
                            monthCounter = 0;
                        else
                            monthCounter++;
                    }
                }
                else
                {
                    int monthCounter = 0;
                    for (int i = 52704; i < 210385; i += 6570) // iterate over entire timespan in increments of 3 months
                    {
                        float monthPositionNormalized = (i - 52704.0F) / (210384.0F - 52704.0F);
                        float monthX = monthPositionNormalized * (timelineX2 - timelineX1) + timelineX1;
                        spriteBatch.DrawLine(monthX, timelineY1 + Settings.TIMELINE_MONTH_HASH_HEIGHT / 2, monthX, timelineY1 - Settings.TIMELINE_MONTH_HASH_HEIGHT / 2, Color.Gray);
                        float fontOffsetX = PlanktonPopulations.mediumFont.MeasureString(FourMonthNames[monthCounter]).X / 2;
                        float fontOffsetY = PlanktonPopulations.mediumFont.MeasureString(FourMonthNames[monthCounter]).Y;
                        Color monthNameColor = Color.Gray;
                        if (Math.Abs(monthPositionNormalized - playPositionNormalized) < (1.0 / 24.0))
                            monthNameColor = Color.White;
                        spriteBatch.DrawString(PlanktonPopulations.mediumFont, FourMonthNames[monthCounter], new Vector2(monthX - fontOffsetX, timelineY1 - Settings.TIMELINE_MONTH_NAME_OFFSET - fontOffsetY), monthNameColor);
                        if (monthCounter >= (FourMonthNames.Length - 1))
                            monthCounter = 0;
                        else
                            monthCounter++;
                    }
                }
            }
            if (Settings.TIMELINE_MONTHNAME)
            {
                Vector2 screenMax = new Vector2(Settings.RESOLUTION_X, Settings.RESOLUTION_Y);
                // entire dataset spans 6 years, figure out which month we're in
                float yearProportion = ((float)player.PlayPosition.Ticks % ((float)video.Duration.Ticks / 6.0F)) / ((float)video.Duration.Ticks / 6.0F);
                int monthIndex = (int)Math.Floor(yearProportion * 12);

                // If static, draw a triangle indicating what part of the year we're in
                float markerXPos = yearProportion * Settings.TIMELINE_MONTHNAME_STATIC_SPACING * 12 + (Settings.RESOLUTION_X - Settings.TIMELINE_MONTHNAME_STATIC_SPACING * 12) / 2;
                float markerYPos = Settings.RESOLUTION_Y - Settings.TIMELINE_MONTHNAME_Y + Settings.TIMELINE_MONTHNAME_STATIC_MARKER_OFFSET;
                int markerHeight = 8;
                int markerWidth = 4;
                for (int i = 0; i < markerWidth; i++)
                {
                    spriteBatch.DrawLine(new Vector2(markerXPos, markerYPos), new Vector2(markerXPos - markerWidth / 2 + i, markerYPos + markerHeight), Color.White);
                }
                if (Settings.TIMELINE_MIRROR)
                {
                    markerXPos = Settings.RESOLUTION_X - markerXPos;
                    markerYPos = Settings.RESOLUTION_Y - markerYPos;
                    for (int i = 0; i < markerWidth; i++)
                    {
                        spriteBatch.DrawLine(new Vector2(markerXPos, markerYPos), new Vector2(markerXPos - markerWidth / 2 + i, markerYPos - markerHeight), Color.White);
                    }
                }

                // figure out where in that month we are
                float monthProportion = yearProportion % (1f / 12f) / (1f / 12f);
                //int colorByte = (int) MathHelper.Lerp(255F, 0F, monthProportion);
                //Color monthNameColor = new Color(255, 255, 255, colorByte);

                Color currentMonthColor = Settings.TIMELINE_MONTHNAME_CURRENT_COLOR;
                Color backgroundMonthColor = Settings.TIMELINE_MONTHNAME_OTHER_COLOR;
                Vector3 bgColorVector = backgroundMonthColor.ToVector3();
                Vector3 currentColorVector = currentMonthColor.ToVector3();
                Vector2 mediumFontSize = PlanktonPopulations.mediumFont.MeasureString(monthNames[monthIndex]);
                Vector2 largeFontSize = PlanktonPopulations.largeFont.MeasureString(monthNames[monthIndex]);
                float minScale = mediumFontSize.X / largeFontSize.X;
                float scale = 1;

                // Calculate x-position of center of current month name
                float xPos = (float)Settings.RESOLUTION_X / 2 + (float)Settings.TIMELINE_MONTHNAME_CENTER_WIDTH / 2 - monthProportion * (float)Settings.TIMELINE_MONTHNAME_CENTER_WIDTH;
                Vector2 position = new Vector2(xPos, Settings.RESOLUTION_Y - Settings.TIMELINE_MONTHNAME_Y);

                // Check if growing or shrinking
                if (xPos > (Settings.RESOLUTION_X / 2 + Settings.TIMELINE_MONTHNAME_CENTER_WIDTH / 2 - Settings.TIMELINE_MONTHNAME_CENTER_TRANSITION_WIDTH))
                {
                    float proportion = (Settings.RESOLUTION_X / 2 + Settings.TIMELINE_MONTHNAME_CENTER_WIDTH / 2 - xPos) / Settings.TIMELINE_MONTHNAME_CENTER_TRANSITION_WIDTH;
                    scale = MathHelper.SmoothStep(minScale, 1, proportion);
                    //currentMonthColor = Color.Lerp(backgroundMonthColor, currentMonthColor, proportion);
                    currentMonthColor = new Color(Vector3.SmoothStep(bgColorVector, currentColorVector, proportion));
                }
                else if (xPos < (Settings.RESOLUTION_X / 2 - Settings.TIMELINE_MONTHNAME_CENTER_WIDTH / 2 + Settings.TIMELINE_MONTHNAME_CENTER_TRANSITION_WIDTH))
                {
                    float proportion = (xPos - (Settings.RESOLUTION_X / 2 - Settings.TIMELINE_MONTHNAME_CENTER_WIDTH / 2)) / Settings.TIMELINE_MONTHNAME_CENTER_TRANSITION_WIDTH;
                    scale = MathHelper.Lerp(minScale, 1, proportion);
                    currentMonthColor = Color.Lerp(backgroundMonthColor, currentMonthColor, proportion);
                }
                Vector2 offset;
                if (Settings.TIMELINE_MONTHNAME_EXPAND_FROM_BASELINE)
                {
                    offset = largeFontSize * scale / 2;
                    offset.Y = largeFontSize.Y * scale - mediumFontSize.Y / 2;

                    // Try to keep enlarging fonts at the same baseline as the smaller background fonts
                    float proportion = (scale - minScale) / (1 - minScale);
                    offset.Y -= proportion * largeFontSize.Y * 0.12f; // Last term is percent of large font height that baseline is at; 12% seems to work for Explo font
                }
                else
                {
                    offset = largeFontSize * scale / 2;
                }
                if (Settings.TIMELINE_MONTHNAME_STATIC)
                {
                    position.X = staticXPositions[monthIndex];
                }
                spriteBatch.DrawString(PlanktonPopulations.largeFont, monthNames[monthIndex], position - offset, currentMonthColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);
                if (Settings.TIMELINE_MIRROR)
                    spriteBatch.DrawString(PlanktonPopulations.largeFont, monthNames[monthIndex], screenMax - (position - offset), currentMonthColor, (float)Math.PI, Vector2.Zero, scale, SpriteEffects.None, 0);

                // Calculate positions of month names to the right of center
                float otherXPos = (float)Settings.RESOLUTION_X / 2 + (float)Settings.TIMELINE_MONTHNAME_CENTER_WIDTH / 2 + (1 - monthProportion) * (float)Settings.TIMELINE_MONTHNAME_SPACING;
                int otherMonthIndex = (monthIndex + 1) % 12;
                Color otherMonthColor;
                while ((otherXPos < Settings.RESOLUTION_X - Settings.TIMELINE_MONTHNAME_BLANK_EDGE_WIDTH) || (Settings.TIMELINE_MONTHNAME_STATIC && otherMonthIndex > monthIndex))
                {
                    mediumFontSize = PlanktonPopulations.mediumFont.MeasureString(monthNames[otherMonthIndex]);
                    largeFontSize = PlanktonPopulations.largeFont.MeasureString(monthNames[otherMonthIndex]);
                    minScale = mediumFontSize.X / largeFontSize.X;
                    scale = minScale;
                    position.X = otherXPos;
                    // Check if fading in
                    if (otherXPos > (Settings.RESOLUTION_X - Settings.TIMELINE_MONTHNAME_BLANK_EDGE_WIDTH - Settings.TIMELINE_MONTHNAME_EDGE_TRANSITION_WIDTH))
                    {
                        otherMonthColor = Color.Lerp(Color.Black, backgroundMonthColor, (float)(Settings.RESOLUTION_X - otherXPos - Settings.TIMELINE_MONTHNAME_BLANK_EDGE_WIDTH) / (float)Settings.TIMELINE_MONTHNAME_EDGE_TRANSITION_WIDTH);
                    }
                    // Check if enlarging
                    //else if ((otherXPos - RESOLUTION_X/2) < (centerWidth/2)) {
                    //    float proportion = (centerWidth/2 - (otherXPos - RESOLUTION_X/2)) / centerTransitionWidth;
                    //    scale = MathHelper.Lerp(minScale, 1, proportion);
                    //    otherMonthColor = Color.Lerp(currentMonthColor, backgroundMonthColor, proportion);
                    //}
                    else
                    {
                        otherMonthColor = backgroundMonthColor;
                    }
                    if (Settings.TIMELINE_MONTHNAME_STATIC)
                    {
                        position.X = staticXPositions[otherMonthIndex];
                        otherMonthColor = backgroundMonthColor;
                    }
                    spriteBatch.DrawString(PlanktonPopulations.largeFont, monthNames[otherMonthIndex], position - largeFontSize * scale / 2, otherMonthColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);
                    if (Settings.TIMELINE_MIRROR)
                        spriteBatch.DrawString(PlanktonPopulations.largeFont, monthNames[otherMonthIndex], screenMax - (position - largeFontSize * scale / 2), otherMonthColor, (float)Math.PI, Vector2.Zero, scale, SpriteEffects.None, 0);

                    otherMonthIndex = (otherMonthIndex + 1) % 12;
                    otherXPos += Settings.TIMELINE_MONTHNAME_SPACING;
                }

                // Calculate positions of month names to the left of center
                otherXPos = (float)Settings.RESOLUTION_X / 2 - (float)Settings.TIMELINE_MONTHNAME_CENTER_WIDTH / 2 - monthProportion * (float)Settings.TIMELINE_MONTHNAME_SPACING;
                otherMonthIndex = (monthIndex - 1);
                if (otherMonthIndex < 0)
                    otherMonthIndex += 12;
                while ((otherXPos > Settings.TIMELINE_MONTHNAME_BLANK_EDGE_WIDTH) || (Settings.TIMELINE_MONTHNAME_STATIC && otherMonthIndex < monthIndex))
                {
                    mediumFontSize = PlanktonPopulations.mediumFont.MeasureString(monthNames[otherMonthIndex]);
                    largeFontSize = PlanktonPopulations.largeFont.MeasureString(monthNames[otherMonthIndex]);
                    minScale = mediumFontSize.X / largeFontSize.X;
                    scale = minScale;
                    position.X = otherXPos;
                    // Check if fading out
                    if (otherXPos < (Settings.TIMELINE_MONTHNAME_EDGE_TRANSITION_WIDTH + Settings.TIMELINE_MONTHNAME_BLANK_EDGE_WIDTH))
                    {
                        otherMonthColor = Color.Lerp(Color.Black, backgroundMonthColor, (float)(otherXPos - Settings.TIMELINE_MONTHNAME_BLANK_EDGE_WIDTH) / (float)Settings.TIMELINE_MONTHNAME_EDGE_TRANSITION_WIDTH);
                    }
                    // Check if shrinking
                    //else if (otherXPos > RESOLUTION_X / 2 - centerWidth / 2 - centerTransitionWidth)
                    //{
                    //    float proportion = (RESOLUTION_X / 2 - centerWidth / 2 - otherXPos) / centerTransitionWidth;
                    //    scale = MathHelper.Lerp(1, minScale, proportion);
                    //    otherMonthColor = Color.Lerp(currentMonthColor, backgroundMonthColor, proportion);
                    //}
                    else
                    {
                        otherMonthColor = backgroundMonthColor;
                    }
                    if (Settings.TIMELINE_MONTHNAME_STATIC)
                    {
                        position.X = staticXPositions[otherMonthIndex];
                        otherMonthColor = backgroundMonthColor;
                    }
                    spriteBatch.DrawString(PlanktonPopulations.largeFont, monthNames[otherMonthIndex], position - largeFontSize * scale / 2, otherMonthColor, 0, Vector2.Zero, scale, SpriteEffects.None, 0);
                    if (Settings.TIMELINE_MIRROR)
                        spriteBatch.DrawString(PlanktonPopulations.largeFont, monthNames[otherMonthIndex], screenMax - (position - largeFontSize * scale / 2), otherMonthColor, (float)Math.PI, Vector2.Zero, scale, SpriteEffects.None, 0);

                    otherMonthIndex = (otherMonthIndex - 1);
                    if (otherMonthIndex < 0)
                        otherMonthIndex += 12;
                    otherXPos -= Settings.TIMELINE_MONTHNAME_SPACING;
                }
            }
        }
Example #30
0
        private void DrawDebugVisuals(SpriteBatch batch, IRenderAwareComponent component, GameTime gameTime)
        {
            var topLeft = new Vector2(component.Transform.Bounds.Left, component.Transform.Bounds.Top);
            var bottomLeft = new Vector2(component.Transform.Bounds.Left, component.Transform.Bounds.Bottom);
            var topRight = new Vector2(component.Transform.Bounds.Right, component.Transform.Bounds.Top);
            var bottomRight = new Vector2(component.Transform.Bounds.Right, component.Transform.Bounds.Bottom);

            batch.DrawLine(2f, Color.Fuchsia, topLeft, topRight);
            batch.DrawLine(2f, Color.Fuchsia, topRight, bottomRight);
            batch.DrawLine(2f, Color.Fuchsia, bottomRight, bottomLeft);
            batch.DrawLine(2f, Color.Fuchsia, bottomLeft, topLeft);
        }