Author Topic: Shortcuts for calibration, connecting etc...  (Read 3635 times)

Offline tyler9613

  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
on: September 22, 2009, 09:39:07 PM
Hello,

I'm trying (without very much success :[) to create a program in visual basic that is basically like a "control panel" for the wiimote whiteboard. Well, I'm done making all the buttons, the splash screen... Now, I just need to know how to link them to the various parts of different programs.

So, how would I go about doing this? I've made a button that says "Calibrate Whiteboard", and when they click on it, I'd like it to take them to a custom calibration screen that has a custom image/custom text on it.  How can I get it to work, and what software should I use to accomplish it?

And, just the same, I've made a "Connect to Whiteboard" Button. How could I get this to connect to the wiimote such as in Thex's WiimoteConnect program? I know that he does not release the source code for it, so is there an alternative that is? And then, how would I link it?

Thanks for all your help in advance,
Tyler



Offline KE7JLM

  • *
  • Posts: 14
  • Karma: +1/-0
    • View Profile
Reply #1 on: September 29, 2009, 11:30:18 PM
For connecting -

Code: [Select]
private void btnCalibrate_Click(object sender, EventArgs e)
        {
            if (sf == null)
            {
                cf = new CalibrationForm();
                cf.Show();

            }
            if (cf.IsDisposed)
            {
                cf = new CalibrationForm();
                cf.Show();
            }
            cursorControl = false;
            calibrationState = 1;
            doCalibration();
        }

      public void doCalibration(){
            if (cf == null)
                return;
            int x = 0;
            int y = 0;
            int size = 25;
            Pen p = new Pen(Color.Blue);
            switch (calibrationState)
            {
                case 1:
                    x = (int)(screenWidth * calibrationMargin);
                    y = (int)(screenHeight * calibrationMargin);
                    cf.showCalibration(x, y, size, p);
                    dstX[calibrationState - 1] = x;
                    dstY[calibrationState - 1] = y;
                    break;
                case 2:
                    x = screenWidth - (int)(screenWidth * calibrationMargin);
                    y = (int)(screenHeight * calibrationMargin);
                    cf.showCalibration(x, y, size, p);
                    dstX[calibrationState - 1] = x;
                    dstY[calibrationState - 1] = y;
                    break;
                case 3:
                    x = (int)(screenWidth * calibrationMargin);
                    y = screenHeight -(int)(screenHeight * calibrationMargin);
                    cf.showCalibration(x, y, size, p);
                    dstX[calibrationState - 1] = x;
                    dstY[calibrationState - 1] = y;
                    break;
                case 4:
                    x = screenWidth - (int)(screenWidth * calibrationMargin);
                    y = screenHeight -(int)(screenHeight * calibrationMargin);
                    cf.showCalibration(x, y, size, p);
                    dstX[calibrationState - 1] = x;
                    dstY[calibrationState - 1] = y;
                    break;
                case 5:
                    //compute warp
                    warper.setDestination(dstX[0], dstY[0], dstX[1], dstY[1], dstX[2], dstY[2], dstX[3], dstY[3]);
                    warper.setSource(srcX[0], srcY[0], srcX[1], srcY[1], srcX[2], srcY[2], srcX[3], srcY[3]);
                    warper.computeWarp();
                    BeginInvoke((MethodInvoker)delegate() { cf.Close();});
                    cf = null;
                    calibrationState = 0;
                    cursorControl = true;
                    BeginInvoke((MethodInvoker)delegate() { cbCursorControl.Checked = cursorControl; });
//                    saveCalibrationData();
                    UpdateTrackingUtilization();
                    break;
                default:
                    break;
            }

        }

I'd use Johnny Lees app, it works great and is open src.