public WiimoteControl(int id, Wiimote wiimote) { this.Wiimote = wiimote; this.Status = new WiimoteStatus(); this.Status.ID = id; this.handlerFactory = new HandlerFactory(); this.keyMapper = new WiiKeyMapper(id,handlerFactory); this.keyMapper.OnButtonDown += WiiButton_Down; this.keyMapper.OnButtonUp += WiiButton_Up; this.keyMapper.OnConfigChanged += WiiKeyMap_ConfigChanged; this.keyMapper.OnRumble += WiiKeyMap_OnRumble; }
public WiimoteControl(int id, Wiimote wiimote) { this.Wiimote = wiimote; this.Status = new WiimoteStatus(); this.Status.ID = id; this.handlerFactory = new HandlerFactory(); this.keyMapper = new WiiKeyMapper(id, handlerFactory); this.keyMapper.OnButtonDown += WiiButton_Down; this.keyMapper.OnButtonUp += WiiButton_Up; this.keyMapper.OnConfigChanged += WiiKeyMap_ConfigChanged; this.keyMapper.OnRumble += WiiKeyMap_OnRumble; }
public WiimoteControl(int id, Wiimote wiimote) { this.Wiimote = wiimote; this.Status = new WiimoteStatus(); this.Status.ID = id; lastpoint = new CursorPos(0, 0, 0); this.screenBounds = Util.ScreenBounds; ulong touchStartID = (ulong)(id - 1) * 4 + 1; //This'll make sure the touch point IDs won't be the same. DuoTouch uses a span of 4 IDs. this.duoTouch = new DuoTouch(this.screenBounds, Properties.Settings.Default.pointer_positionSmoothing, touchStartID); this.keyMapper = new WiiKeyMapper(id); this.keyMapper.OnButtonDown += WiiButton_Down; this.keyMapper.OnButtonUp += WiiButton_Up; this.keyMapper.OnConfigChanged += WiiKeyMap_ConfigChanged; this.keyMapper.OnRumble += WiiKeyMap_OnRumble; this.inputSimulator = new InputSimulator(); this.screenPositionCalculator = new ScreenPositionCalculator(); this.useCustomCursor = Settings.Default.pointer_customCursor; if (this.useCustomCursor) { Color myColor = CursorColor.getColor(this.Status.ID); this.masterCursor = new D3DCursor((this.Status.ID - 1) * 2, myColor); this.slaveCursor = new D3DCursor((this.Status.ID - 1) * 2 + 1, myColor); masterCursor.Hide(); slaveCursor.Hide(); D3DCursorWindow.Current.AddCursor(masterCursor); D3DCursorWindow.Current.AddCursor(slaveCursor); this.keyMapper.SendConfigChangedEvt(); } }
public void updateStatus(WiimoteStatus status) { //this.lbId.Content = "" + status.ID; if (this.battery != status.Battery) { this.battery = status.Battery; this.setBattery(status.Battery); } if (this.powersave != status.InPowerSave) { this.powersave = status.InPowerSave; if (status.InPowerSave) { this.lbStatus.Foreground = Brushes.White; this.lbStatus.Content = "sleepmode"; } else { this.lbStatus.Foreground = new SolidColorBrush(Color.FromRgb(91,255,0)); this.lbStatus.Content = "connected"; } } }
public WiimoteControl(int id, Wiimote wiimote) { this.Wiimote = wiimote; this.Status = new WiimoteStatus(); this.Status.ID = id; lastpoint = new CursorPos(0,0,0); this.screenBounds = Util.ScreenBounds; ulong touchStartID = (ulong)(id - 1) * 4 + 1; //This'll make sure the touch point IDs won't be the same. DuoTouch uses a span of 4 IDs. this.duoTouch = new DuoTouch(this.screenBounds, Properties.Settings.Default.pointer_positionSmoothing, touchStartID); this.keyMapper = new WiiKeyMapper(id); this.keyMapper.OnButtonDown += WiiButton_Down; this.keyMapper.OnButtonUp += WiiButton_Up; this.keyMapper.OnConfigChanged += WiiKeyMap_ConfigChanged; this.keyMapper.OnRumble += WiiKeyMap_OnRumble; this.inputSimulator = new InputSimulator(); this.screenPositionCalculator = new ScreenPositionCalculator(); this.useCustomCursor = Settings.Default.pointer_customCursor; if (this.useCustomCursor) { Color myColor = CursorColor.getColor(this.Status.ID); this.masterCursor = new D3DCursor((this.Status.ID-1)*2,myColor); this.slaveCursor = new D3DCursor((this.Status.ID-1)*2+1,myColor); masterCursor.Hide(); slaveCursor.Hide(); D3DCursorWindow.Current.AddCursor(masterCursor); D3DCursorWindow.Current.AddCursor(slaveCursor); this.keyMapper.SendConfigChangedEvt(); } }
/// <summary> /// This is called when the battery state changes. /// </summary> /// <param name="obj"></param> private void pWiiProvider_OnStatusUpdate(WiimoteStatus status) { // Dispatch it. Dispatcher.BeginInvoke(new Action(delegate() { statusStackMutex.WaitOne(); foreach(UIElement child in this.statusStack.Children) { WiimoteStatusUC uc = (WiimoteStatusUC)child; if (uc.ID == status.ID) { uc.updateStatus(status); } } statusStackMutex.ReleaseMutex(); }), null); }