Exemplo n.º 1
0
        public FPSAim(String vcd)
        {
            InitializeComponent();

              VideoCaptureDevice videoSource = new VideoCaptureDevice(vcd, new Size(320, 240), false);
              OpenVideoSource(videoSource);

              redDot.Location = new Point(gridBox.Width / 2 + gridBox.Left, gridBox.Height / 2 + gridBox.Top);
              servos = new Servos();
              redDot.Location = servos.GetPorportionalMathPosition(gridBox.Bounds);
              redDot.Location = new Point(redDot.Location.X - REDDOT_OFFSET_X, redDot.Location.Y - REDDOT_OFFSET_Y);
              label1.Text = "(-" + servos.CenterServosPosition.X + "," + servos.CenterServosPosition.Y + ")";
              textBoxXServo.Text = servos.ShootingRange.Width.ToString();
              textBoxYServo.Text = servos.ShootingRange.Height.ToString();
              textBoxXCoord.Text = servos.ServosPosition.X.ToString();
              textBoxYCoord.Text = servos.ServosPosition.Y.ToString();

              Packet packet = new Packet(servos.CenterServosPosition);
              packet.setFireOff();
              this.sendData(packet);
              Cursor.Hide();
              cursorhidden = true;
              CoordinateTimer.Start();

              //Point camwindowcenter = new Point(gridBox.PointToScreen(new Point(0, 0)).X , gridBox.PointToScreen(new Point(0, 0)).Y );
              //Cursor.Position = camwindowcenter;
              currentX = Cursor.Position.X;
              currentY = Cursor.Position.Y;
              lastX = 0;
              lastY = 0;
        }
Exemplo n.º 2
0
        public RemoteAim(String vcd)
        {
            InitializeComponent();

              VideoCaptureDevice videoSource = new VideoCaptureDevice(vcd, new Size(320, 240), false);
              OpenVideoSource(videoSource);

              redDot.Location = new Point(gridBox.Width / 2 + gridBox.Left, gridBox.Height / 2 + gridBox.Top);
              servos = new Servos();
              XTextBox.Text = servos.GetMathPosition().X.ToString();
              YTextBox.Text = servos.GetMathPosition().Y.ToString();
              redDot.Location = servos.GetPorportionalMathPosition(gridBox.Bounds);
              redDot.Location = new Point(redDot.Location.X - REDDOT_OFFSET_X, redDot.Location.Y - REDDOT_OFFSET_Y);
              label1.Text = "(-" + servos.CenterServosPosition.X + "," + servos.CenterServosPosition.Y + ")";
              PosIncTextBox.Text = positionIncrement.ToString();
              textBoxXServo.Text = servos.ShootingRange.Width.ToString();
              textBoxYServo.Text = servos.ShootingRange.Height.ToString();
              textBoxXCoord.Text = servos.ServosPosition.X.ToString();
              textBoxYCoord.Text = servos.ServosPosition.Y.ToString();

              Packet packet = new Packet(servos.CenterServosPosition);
              packet.setFireOff();
              this.sendData(packet);
        }