Example #1
0
        public void Start()
        {
            if (btn_GetPos.Text != "已定位")
            {
                return;
            }

            btn_Start.Text = "运行中";
            isRun          = true;


            Bitmap   b = new Bitmap(gameWidth, gameHeight, PixelFormat.Format32bppArgb);
            Graphics g = Graphics.FromImage(b);

            for (int i = 0; i < circleCenter.Length; i++)
            {
                //g.CopyFromScreen(startXY + circleCenter[i] - radiusOutV, circleCenter[i] - radiusOutV, radiusOutV * 2);
                g.CopyFromScreen(gameX, gameY, 0, 0, new Size(gameWidth, gameHeight));
            }
            for (int i = 0; i < circleCenter.Length; i++)
            {
                g.DrawEllipse(new Pen(Color.Red), new Rectangle(circleCenter[i] - radiusOutV, radiusOutV * 2));
                g.DrawEllipse(new Pen(Color.Red), new Rectangle(circleCenter[i] - radiusInV, radiusInV * 2));
            }
            radiusRange = new bool[radiusOutside * 2, radiusOutside * 2];
            int sum = 0;

            for (int i = 0; i < radiusRange.GetLength(0); i++)
            {
                for (int t = 0; t < radiusRange.GetLength(1); t++)
                {
                    Vector2Int p = new Vector2Int(i, t) - radiusOutV;
                    radiusRange[i, t] = p.Length <radiusOutside && p.Length> radiusInside;
                    sum += radiusRange[i, t] ? 1 : 0;
                }
            }
            radiusRangeSize  = sum;
            radiusRangeSize /= radiusPointInterval * radiusPointInterval;

            Console.WriteLine(radiusRangeSize);
            pictureBox1.Image = b;


            for (int i = 0; i < targetColor.GetLength(0); i++)
            {
                for (int t = 0; t < targetColor.GetLength(1); t++)
                {
                    Console.WriteLine(targetColor[i, t]);
                }
            }

            new Thread(ThreadPlay).Start();
            new Thread(ThreadPercent).Start();
            ssl.Start();
        }
Example #2
0
File: Test.cs Project: CID6/D2D-App
        public static void DXCaptureScreenTest()
        {
            List <double> lista = new List <double>();

            var screenStateLogger = new ScreenStateLogger();

            screenStateLogger.ScreenRefreshed += (sender, data) =>
            {
            };
            screenStateLogger.Start();
            Thread.Sleep(1000);
            screenStateLogger.Stop();

            //for(int i=0; i < 10; i++)
            //{
            //    Console.WriteLine(lista[i]);
            //}

            //TimeSpan timeToScreenCapture = sw.Elapsed;

            //Console.WriteLine("Screen: {0}ms", timeToScreenCapture.TotalMilliseconds);

            Console.ReadLine();
        }