Esempio n. 1
0
        public TabletConnection(IInputDevice tablet, WirelessReceiver receiver, int index)
        {
            Tablet = tablet;
              Receiver = receiver;
              ReceiverIndex = index;

              Settings = new TabletSettings();
        }
Esempio n. 2
0
        public Xbox360InputDevice(WirelessReceiver receiver, int index, WirelessReceiver.DeviceInformation info)
        {
            ButtonState = new TabletButtonState();
              DPadState = new TabletDPadState();
              AccelerometerData = new TabletAccelerometerData();

              _index = index;
              _receiver = receiver;
              Info = info;
              _receiver.EventDataReceived += _receiver_EventDataReceived;
        }
Esempio n. 3
0
        public static void Stop()
        {
            //Dispose of the PS3 tablet
              foreach (var t in Tablets)
              {
            var ps3 = t.Tablet as PS3InputDevice;

            if (ps3 != null)
              ps3.Dispose();
              }

              //Dispose of the Xbox 360 wireless USB receiver
              if (Receiver != null)
              {
            Receiver.Dispose();
            Receiver = null;
              }

              Tablets.Clear();

              PPJoyInterface.CloseAllHandles();
        }
Esempio n. 4
0
        public static void Start(Options options)
        {
            Stop();

              _frmOptions = options;
              _keyCounters = new Dictionary<TabletOptionButton.TabletButton, Dictionary<int, int>>();
              foreach (TabletOptionButton.TabletButton button in Enum.GetValues(typeof(TabletOptionButton.TabletButton)))
            _keyCounters.Add(button, new Dictionary<int, int>());
              _modifierCounters = new Dictionary<Keypress.ModifierKeyCode, int>();
              foreach (Keypress.ModifierKeyCode code in Enum.GetValues(typeof(Keypress.ModifierKeyCode)))
            _modifierCounters.Add(code, 0);

              //Set up Xbox 360 USB wireless receiver
              if (Receiver == null || !Receiver.IsReceiverConnected)
              {
            Receiver = new Xbox360USB.WirelessReceiver();
            Receiver.DeviceConnected += Receiver_DeviceConnected;
            Receiver.DeviceDisconnected += Receiver_DeviceDisconnected;
            Receiver.Start();
              }

              //Set up the PS3 tablet dongle
              var conn = new TabletConnection((new PS3InputDevice()) as IInputDevice);
              conn.ButtonStateChanged += _ButtonStateChanged;
              conn.DPadStateChanged += _DPadStateChanged;
              conn.Settings = TabletSettings.LoadSettings(GetSettingsFileName(false, true, null));
              Tablets.Add(conn);

              //Set up the Wii tablet(s)
              var devices = WiiInputDevice.GetAllDevices();
              int i = 0;
              foreach (var dev in devices)
              {
            conn = new TabletConnection((new WiiInputDevice(dev, i)));
            conn.ButtonStateChanged += _ButtonStateChanged;
            conn.DPadStateChanged += _DPadStateChanged;
            conn.Settings = TabletSettings.LoadSettings(GetSettingsFileName(true, false, null));
            Tablets.Add(conn);
            i++;
              }

              //Set up the event timer
              _timer = new System.Threading.Timer(new TimerCallback(_HandleTabletEvents), null, 0, 1);
        }