Putting It All Together
Now that we have our two small components, Warper and Calibration Form, we need to create our main form, which will manage these pieces, present a graphical control panel, step through the calibration process, initiate the warping calculation, and simulate the mouse. This may sound like a lot, but it is fairly straightforward administrative work.
To begin, we will add the visual components for the graphical user interface. Open up the form designer for Form1.cs/vb by double-clicking it in the Solution Explorer. For our battery monitor, we'll create a GroupBox with the label "Wiimote Battery". Inside of the GroupBox, add a ProgressBar named "pbBattery" and a Label named "lblBattery". These will provide a visual and textual representation of the battery level.
Below the GroupBox, add another Label named "lblIRVisible". This is a diagnostic tool to tell us whether the camera can see the IR pen, which will help us troubleshoot the visibility of the display.
Next, add another Label named "lblTrackingUtil". This is another diagnostic that provides feedback on the quality of the Wii remote placement. It calculates what percentage of the camera image is being utilized for tracking on the display, which roughly corresponds to the tracking quality.
Below this label, add a CheckBox to enable or disable control of the mouse cursor named "cbCursorControl". This helps prevent erratic cursor behavior when positioning the Wii remote and testing camera visibility.
Finally, add ...
Get Coding4Fun now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.