コード例 #1
0
ファイル: FPSAim.cs プロジェクト: Tob1112/405sentry
        private void centerButton_Click(object sender, EventArgs e)
        {
            int x = 0;
            int y = 0;

            lastX = 0;
            lastY = 0;
            servos.ServosPosition = servos.ConvertPositionMathToServos(new Point(x, y));
            redDot.Location       = servos.GetPorportionalMathPosition(gridBox.Bounds);
            redDot.Location       = new Point(redDot.Location.X - REDDOT_OFFSET_X, redDot.Location.Y - REDDOT_OFFSET_Y);
            textBoxXCoord.Text    = servos.CenterServosPosition.X.ToString();
            textBoxYCoord.Text    = servos.CenterServosPosition.Y.ToString();
            Packet packet = new Packet(servos.CenterServosPosition);

            packet.setFireOff();
            this.sendData(packet);
        }
コード例 #2
0
ファイル: RemoteAim.cs プロジェクト: Tob1112/405sentry
        private void remoteAim()
        {
            int x = int.Parse(XTextBox.Text);
            int y = int.Parse(YTextBox.Text);

            servos.ServosPosition = servos.ConvertPositionMathToServos(new Point(x, y));
            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);
            Packet packet = new Packet(servos.ServosPosition);

            if (fireOK == true)
            {
                packet.setFireOn();
            }
            else
            {
                packet.setFireOff();
            }
            this.sendData(packet);
        }