private void DoButtonUpdate(CWIID_BTN buttons) { var state = new WiimoteState(); state.ButtonState.A = (buttons & CWIID_BTN.A) != 0; state.ButtonState.B = (buttons & CWIID_BTN.B) != 0; state.ButtonState.One = (buttons & CWIID_BTN.BTN1) != 0; state.ButtonState.Two = (buttons & CWIID_BTN.BTN2) != 0; state.ButtonState.Up = (buttons & CWIID_BTN.UP) != 0; state.ButtonState.Down = (buttons & CWIID_BTN.DOWN) != 0; state.ButtonState.Left = (buttons & CWIID_BTN.LEFT) != 0; state.ButtonState.Right = (buttons & CWIID_BTN.RIGHT) != 0; state.ButtonState.Plus = (buttons & CWIID_BTN.PLUS) != 0; state.ButtonState.Minus = (buttons & CWIID_BTN.MINUS) != 0; state.ButtonState.Home = (buttons & CWIID_BTN.HOME) != 0; var handler = WiimoteChanged; if (handler != null) { handler(this, new WiimoteChangedEventArgs(state)); } }
/// <summary> /// Constructor /// </summary> /// <param name="ws">Wiimote state</param> public WiimoteChangedEventArgs(WiimoteState ws) { WiimoteState = ws; }