Exemplo n.º 1
0
        public void Draw(RTSWorld world, GameContext context, XnaGraphics graphics)
        {
            this.Update(world, context);

            graphics.DrawStringLeft(0, 0, world.ActiveLevel.GetType().Name);
            graphics.DrawStringLeft(0, 32, this.m_Tick.ToString());

            if (this.m_LastMousePoint.HasValue && this.m_CurrentMousePoint.HasValue)
            {
                graphics.DrawRectangle(this.m_LastMousePoint.Value, this.m_CurrentMousePoint.Value, Color.LimeGreen);
            }

            foreach (Unit u in this.Selected)
            {
                Rectangle bb = new Rectangle((int)u.X, (int)u.Y - 1, u.Width + 1, u.Height + 1);
                if (u.Team != null)
                {
                    graphics.DrawRectangle(bb, u.Team.Color);
                }
                else
                {
                    graphics.DrawRectangle(bb, Color.LimeGreen);
                }
            }

            // Draw chat.
            int a = 16;

            for (int i = this.m_ChatMessages.Count - 1; i >= Math.Max(this.m_ChatMessages.Count - 11, 0); i--)
            {
                if (i < this.m_ChatMessages.Count)
                {
                    graphics.DrawStringLeft(0, context.Graphics.GraphicsDevice.Viewport.Height - a, this.m_ChatMessages[i]);
                }
                a += 16;
            }

            // Draw graph.
            if (this.m_GraphFrames.Count > 1)
            {
                for (int i = 1; i < this.m_GraphFrames.Count; i++)
                {
                    graphics.DrawLine(i - 1, (float)this.m_GraphFrames[i - 1], i, (float)this.m_GraphFrames[i], 1, Color.Lime);
                }
            }

            // Add frame information.
            if (this.m_GraphFrames.Count > 200)
            {
                this.m_GraphFrames.RemoveAt(0);
            }
            this.m_GraphFrames.Add(context.GameTime.ElapsedGameTime.TotalMilliseconds);

            this.m_Tick++;
        }
Exemplo n.º 2
0
        //****************************************************************
        // Painting - Methods for painting a PImage.
        //****************************************************************

        /// <summary>
        /// Overridden.  See <see cref="PNode.Paint">PNode.Paint</see>.
        /// </summary>
        protected override void Paint(PPaintContext paintContext)
        {
            if (rect != null)
            {
                RectangleFx b = Bounds;
                XnaGraphics g = paintContext.Graphics;

                g.DrawRectangle(this.Brush, rect);
            }
        }
Exemplo n.º 3
0
 protected void DrawDebugPathFindingGrid(GameContext context, XnaGraphics graphics)
 {
     for (int x = 0; x < this.m_PathFindingGrid.GetLength(0); x++)
     {
         for (int y = 0; y < this.m_PathFindingGrid.GetLength(1); y++)
         {
             if (this.m_PathFindingGrid[x, y] == (byte)PathFinderHelper.BLOCKED_TILE)
             {
                 graphics.DrawRectangle(new Rectangle(x * 16, y * 16, 16, 16), new Color(255, 0, 0, 128));
             }
             else if (this.m_PathFindingGrid[x, y] == (byte)PathFinderHelper.EMPTY_TILE)
             {
                 graphics.DrawRectangle(new Rectangle(x * 16, y * 16, 16, 16), new Color(0, 255, 0, 128));
             }
             else
             {
                 graphics.DrawRectangle(new Rectangle(x * 16, y * 16, 16, 16), new Color(0, 0, 255, 128));
             }
         }
     }
 }
Exemplo n.º 4
0
        public static void Draw(GameContext context, RPGWorld world)
        {
            XnaGraphics g = new XnaGraphics(context);

            g.FillRectangle(new Rectangle(0, 0, 300, 200), Color.Black);
            g.DrawRectangle(new Rectangle(0, 0, 300, 200), Color.Gray);
            g.DrawStringLeft(20, 20, "Render targets used: " + RenderTargetFactory.RenderTargetsUsed);
            g.DrawStringLeft(20, 20 + 16, "Render targets memory: " + RenderTargetFactory.RenderTargetMemory / (1 * 1024 * 1024) + "MB");
            if (world != null)
            {
                TimeSpan ts = new TimeSpan((long)((RPGWorld.AUTOSAVE_LIMIT - world.m_AutoSave) / 60.0 * 10000000.0));
                g.DrawStringLeft(20, 20 + 32, "Autosave counter: " + ts.Minutes + "m" + ts.Seconds + "s");
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Override this method to change the way the bounds are painted when the debug bounds
        /// flag is set.
        /// </summary>
        /// <param name="paintContext">The paint context to use for painting debug information.</param>
        /// <param name="boundsPen">The pen to use for painting the bounds of a node.</param>
        /// <param name="nodeBounds">The bounds of the node to paint.</param>
        protected virtual void PaintDebugBounds(PPaintContext paintContext, System.Drawing.Pen boundsPen, RectangleFx nodeBounds)
        {
            XnaGraphics g = paintContext.Graphics;

            g.DrawRectangle(boundsPen, nodeBounds.X, nodeBounds.Y, nodeBounds.Width, nodeBounds.Height);
        }