Ejemplo n.º 1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (!leaveTrail)
            {
                ClearScreen();
            }
            switch (CS)
            {
            case CurrentSimulation.SteeringBehaviours:
                if (sBC != null)
                {
                    sBC.Step();
                }
                break;

            case CurrentSimulation.EString:
                newPoint = new Point(80 + (EString.generationCount * 2), 450 - (EString.errorCount * 2));
                g.DrawLine(boldPen, oldPoint, newPoint);
                oldPoint = newPoint;
                g.DrawString("E Strings", new Font(FontFamily.GenericSansSerif, 14), Brushes.White, new PointF(20, 20));
                g.DrawString("Target String: " + EString.target, new Font(FontFamily.GenericSansSerif, 20), Brushes.PaleGoldenrod, new PointF(20, 50));
                g.DrawString("Error Graph", new Font(FontFamily.GenericSansSerif, 20), Brushes.Yellow, new PointF(180, 180));
                g.DrawLine(arrowPen, axisPoints[1], axisPoints[0]);
                g.DrawLine(arrowPen, axisPoints[1], axisPoints[2]);
                g.DrawString("Y", this.Font, Brushes.White, new PointF(axisPoints[0].X - 30, axisPoints[0].Y));
                g.DrawString("X", this.Font, Brushes.White, new PointF(axisPoints[2].X - 10, axisPoints[2].Y + 25));
                g.DrawString("0", this.Font, Brushes.White, new PointF(axisPoints[1].X - 10, axisPoints[1].Y + 10));
                break;

            case CurrentSimulation.Ants:
                if (world != null)
                {
                    world.Step();
                }
                break;

            default:
                break;
            }
            DrawTitle();
            grafx.Render(Graphics.FromHwnd(mainPanel.Handle));
        }
Ejemplo n.º 2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (seconds > 58) //1)
            {
                // seconds = 59;
                seconds = 0;

                if (minutes == 59)
                {
                    //minutes = 59;
                    minutes = 0;
                    if (hours >= 0)
                    {
                        hours += 1;//hours -= 1;
                    }
                }
                else
                {
                    minutes += 1;// minutes -= 1;
                }
            }
            else
            {
                seconds += 1;// seconds -= 1;
            }
            label1.Text = "Countdown Timer " + hours.ToString() + " : " + minutes.ToString() + " : " + seconds.ToString();

            if (!leaveTrail)
            {
                ClearScreen();
            }
            switch (CS)
            {
            case CurrentSimulation.SteeringBehaviours:
                if (sBC != null)
                {
                    sBC.Step();
                }
                break;

            case CurrentSimulation.EString:
                newPoint = new Point(80 + (EString.generationCount * 2), 450 - (EString.errorCount * 2));
                g.DrawLine(boldPen, oldPoint, newPoint);
                oldPoint = newPoint;
                g.DrawString("E Strings", new Font(FontFamily.GenericSansSerif, 14), Brushes.White, new PointF(20, 20));
                g.DrawString("Target String: " + EString.target, new Font(FontFamily.GenericSansSerif, 20), Brushes.PaleGoldenrod, new PointF(20, 50));
                g.DrawString("Error Graph", new Font(FontFamily.GenericSansSerif, 20), Brushes.Yellow, new PointF(180, 180));
                g.DrawLine(arrowPen, axisPoints[1], axisPoints[0]);
                g.DrawLine(arrowPen, axisPoints[1], axisPoints[2]);
                g.DrawString("Y", this.Font, Brushes.White, new PointF(axisPoints[0].X - 30, axisPoints[0].Y));
                g.DrawString("X", this.Font, Brushes.White, new PointF(axisPoints[2].X - 10, axisPoints[2].Y + 25));
                g.DrawString("0", this.Font, Brushes.White, new PointF(axisPoints[1].X - 10, axisPoints[1].Y + 10));
                break;

            case CurrentSimulation.Ants:
                if (world != null)
                {
                    //   world.Step();
                }
                break;

            default:
                break;
            }
            DrawTitle();
            grafx.Render(Graphics.FromHwnd(mainPanel.Handle));
        }