Esempio n. 1
0
        public override void Draw(float delta)
        {
            var maxHeight = Height * 0.66f;

            History.Add(GetCpuUsage(Timing.TotalFramesRendered));
            if (History.Count > Width)
            {
                History.RemoveAt(0);
            }

            Art.Background(Paint.CornflowerBlue);
            Art.Fill(Paint.White);
            Art.Stroke(Paint.Black);
            Art.StrokeWeight(1);

            Art.BeginShape();

            for (var i = 0; i < History.Count; i++)
            {
                var p = (float)History[i];
                var x = ((float)i).Map(0, History.Count, 0, Width);
                var y = p.Map(0, 100, Height, maxHeight);
                Art.Vertex(x, y);
            }

            Art.Vertex(Width, Height);
            Art.Vertex(0, Height);

            Art.EndShape(EndShapeType.Close);

            Art.Line(0, maxHeight, Width, maxHeight);
        }
Esempio n. 2
0
        private void Draw(float delta)
        {
            Art.Graphics.ScaleTransform(100, 100);
            Art.Background(PColor.CornflowerBlue);

            Art.Stroke(PColor.Black);
            Art.StrokeWeight(0.2f);
            Art.NoFill();

            var size = (float)Client.Arena.Size;

            Art.BeginShape();
            Art.Vertex(0, 0);
            Art.Vertex(size, 0);
            Art.Vertex(size, size);
            Art.Vertex(0, size);
            Art.EndShape(EndShapeType.Close);

            Art.NoStroke();
            Client.Arena.Obstacles.ForEach(o =>
            {
                Art.Fill(PColor.Grey);
                Art.Circle((float)o.Position.X, (float)o.Position.Y, 0.5f);
                Art.Fill(PColor.Black);
                Art.Text(o.ID, (float)o.Position.X, (float)o.Position.Y);
            });

            if (Client.Arena.ClientBot is object)
            {
                Art.Fill(PColor.White);
                Art.Circle((float)Client.Arena.ClientBot.Position.X, (float)Client.Arena.ClientBot.Position.Y, 0.5f);
                Art.Fill(PColor.Black);
                Art.Text("BOT\n" + Client.Arena.ClientBot.ID, (float)Client.Arena.ClientBot.Position.X, (float)Client.Arena.ClientBot.Position.Y);
            }
        }