Exemplo n.º 1
0
 private void KeyDownUpProcess(KeyEventArgs e)
 {
     switch (e.KeyCode)
     {
     case Keys.Escape:
     {
         //isDragging = !isDragging;
         if (CoordinateTimer.Enabled)
         {
             CoordinateTimer.Stop();
         }
         else
         {
             CoordinateTimer.Start();
         }
         if (cursorhidden)
         {
             Cursor.Show();
             cursorhidden = false;
         }
         else
         {
             Cursor.Hide();
             cursorhidden = true;
         }
         fireOK           = false;
         redDot.BackColor = Color.Yellow;
         break;
     }
     }
 }
Exemplo n.º 2
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.º 3
0
        private void redDot_MouseDown(object sender, MouseEventArgs e)
        {
            isDragging = true;
            CoordinateTimer.Start();

            currentX = e.X;
            currentY = e.Y;
        }