void OnChangeReportType(object Sender, WiimoteExtensionChangedEventArgs Args) { if (Args.ExtensionType == ExtensionType.ClassicController) { FRemote.SetReportType(InputReport.IRExtensionAccel, true); } if (Args.ExtensionType == ExtensionType.BalanceBoard) { FRemote.SetReportType(InputReport.IRExtensionAccel, true); } if (Args.ExtensionType == ExtensionType.Guitar) { FRemote.SetReportType(InputReport.IRExtensionAccel, true); } if (Args.ExtensionType == ExtensionType.Nunchuk) { FRemote.SetReportType(InputReport.IRExtensionAccel, true); } // if (Args.ExtensionType == ExtensionType.MotionPlus) { // FRemote.SetReportType(InputReport.IRExtensionAccel, true); // } if (Args.ExtensionType == ExtensionType.None) { FRemote.SetReportType(InputReport.IRAccel, true); } FRemote.GetStatus(); FInvalidate = true; }
/// <summary> /// Plugin entry point /// </summary> public override void Load() { try { remote = new Wiimote(); remote.Connect(); remote.SetReportType(Wiimote.InputReport.IRAccel, true); remote.GetStatus(); remote.SetLEDs(true, false, false, false); remote.WiimoteChanged += new WiimoteChangedEventHandler(OnWiimoteChanged); for (int i = 0; i < 4; i++) { wiimotePointsNormalized[i] = new Point2D(); } m_keyHandler = new KeyEventHandler(keyUp); Global.worldWindow.KeyUp += m_keyHandler; World.Settings.AllowNegativeTilt = false; World.Settings.CameraHeadTracking = false; } catch (Exception e) { MessageBox.Show("Cannot find a wii remote: " + e.Message); remote = null; } }
/// <summary> /// Plugin entry point /// </summary> public override void Load() { try { remote = new Wiimote(); remote.Connect(); remote.SetReportType(Wiimote.InputReport.IRAccel, true); remote.GetStatus(); remote.SetLEDs(true, false, false, false); remote.WiimoteChanged += new WiimoteChangedEventHandler(OnWiimoteChanged); for (int i = 0; i < 4; i++) { wiimotePointsNormalized[i] = new Point2D(); } m_enableMenuItem = new MenuItem(); m_enableMenuItem.Text = "Enable Headtracking\t*"; m_enableMenuItem.Click += new System.EventHandler(enableMenuItem_Click); ParentApplication.ToolsMenu.MenuItems.Add(m_enableMenuItem); m_keyHandler = new KeyEventHandler(keyUp); ParentApplication.WorldWindow.KeyUp += m_keyHandler; World.Settings.AllowNegativeTilt = false; World.Settings.CameraHeadTracking = false; } catch (Exception e) { MessageBox.Show("Cannot find a wii remote: " + e.Message); remote = null; } }
public void Enable() { wm.Connect(); wm.SetReportType(InputReport.IRAccel, true); wm.GetStatus(); wm.SetLEDs(true, false, false, false); }
void ConnectBalanceBoard(bool WasJustConnected) { bool Connected = true; try { bb = new Wiimote(); bb.Connect(); bb.SetLEDs(1); bb.GetStatus(); } catch { Connected = false; } if (!Connected || bb.WiimoteState.ExtensionType != ExtensionType.BalanceBoard) { if (ConnectionManager.ElevateProcessNeedRestart()) { Shutdown(); return; } if (cm == null) { cm = new ConnectionManager(); } cm.ConnectNextWiiMote(); return; } if (cm != null) { cm.Cancel(); cm = null; } lblWeight.Text = "..."; lblQuality.Text = ""; lblUnit.Content = ""; ZeroedWeight = 0.0f; int InitWeightCount = 0; for (int CountMax = (WasJustConnected ? 100 : 50); InitWeightCount < CountMax || bb.WiimoteState.BalanceBoardState.WeightKg == 0.0f; InitWeightCount++) { if (bb.WiimoteState.BalanceBoardState.WeightKg < -200) { break; } ZeroedWeight += bb.WiimoteState.BalanceBoardState.WeightKg; bb.GetStatus(); } ZeroedWeight /= InitWeightCount; //start with half full quality bar HistoryCursor = HistoryBest = History.Length / 2; for (int i = 0; i < History.Length; i++) { History[i] = (i > HistoryCursor ? float.MinValue : ZeroedWeight); } }
static void ConnectBalanceBoard() { // Connect the Wii Balance Board to the computer. bool Connected = true; try { balanceBoard = new Wiimote(); balanceBoard.Connect(); balanceBoard.SetLEDs(1); balanceBoard.GetStatus(); } catch { Connected = false; } if (!Connected || balanceBoard.WiimoteState.ExtensionType != ExtensionType.BalanceBoard) { // Close application if a device is not connected or the connected device is not a balance board. if (ConnectionManager.ElevateProcessNeedRestart()) { Shutdown(); return; } if (connectionManager == null) { connectionManager = new ConnectionManager(); } connectionManager.ConnectNextWiiMote(); return; } if (connectionManager != null) { connectionManager.Cancel(); connectionManager = null; } form.Refresh(); }
void ConnectBalanceBoard(bool WasJustConnected) { bool Connected = true; try { bb = new Wiimote(); bb.Connect(); bb.SetLEDs(1); bb.GetStatus(); } catch { Connected = false; } if (!Connected || bb.WiimoteState.ExtensionType != ExtensionType.BalanceBoard) { if (ConnectionManager.ElevateProcessNeedRestart()) { Shutdown(); return; } if (cm == null) { cm = new ConnectionManager(); } cm.ConnectNextWiiMote(); return; } if (cm != null) { cm.Cancel(); cm = null; } f.Refresh(); }