public GamepadInterface(Robot r)
 {
     robot              = r;
     gamepad            = new GamepadXBox();
     analog             = new AnalogGamepad(gamepad);
     timer              = new Timer();
     timer.Interval     = 10;
     timer.Enabled      = true;
     enabled            = false;
     timer.Tick        += analog.Update;
     analog.StartEvent += Connect;
     analog.StopEvent  += Disconnect;
 }
 public GamepadMenu(GamepadXBox g, ToolStripMenuItem m)
 {
     gamepad      = g;
     _menu        = m;
     _mode        = new ToolStripMenuItem("Mode", null, null, "mode");
     _gamepad     = new ToolStripMenuItem("Gamepad", null, null, "gamepad");
     _gamepad1    = new ToolStripMenuItem("One", null, Choose, "gp0");
     _gamepad2    = new ToolStripMenuItem("Two", null, Choose, "gp1");
     _gamepad3    = new ToolStripMenuItem("Three", null, Choose, "gp2");
     _gamepad4    = new ToolStripMenuItem("Four", null, Choose, "gp3");
     _gamepads[0] = _gamepad1;
     _gamepads[1] = _gamepad2;
     _gamepads[2] = _gamepad3;
     _gamepads[3] = _gamepad4;
     _default     = new ToolStripMenuItem("Default", null, modeDefault, "default");
     _marioKart   = new ToolStripMenuItem("Mario Kart", null, modeMario, "mario");
     _marioPlus   = new ToolStripMenuItem("Mario Kart 2", null, modeMarioPlus, "marioPlus");
     _halo        = new ToolStripMenuItem("Halo", null, modeHalo, "halo");
     _tank        = new ToolStripMenuItem("Tank", null, modeTank, "tank");
     _options     = new ToolStripMenuItem("Options", null, null, "options");
     _boost       = new ToolStripMenuItem("Boost", null, optionBoost, "boost");
     _exponential = new ToolStripMenuItem("Exponential", null, optionExponential, "Exponential");
     _digital     = new ToolStripMenuItem("Digital", null, modeDigital, "digital");
     _enable      = new ToolStripMenuItem("Connect", null, Enable, "enable");
     _menu.DropDownItems.Add(_gamepad);
     _gamepad.DropDownItems.Add(_gamepad1);
     _gamepad.DropDownItems.Add(_gamepad2);
     _gamepad.DropDownItems.Add(_gamepad3);
     _gamepad.DropDownItems.Add(_gamepad4);
     _menu.DropDownItems.Add(_mode);
     _mode.DropDownItems.Add(_default);
     _mode.DropDownItems.Add(_halo);
     _mode.DropDownItems.Add(_tank);
     _mode.DropDownItems.Add(_marioKart);
     _mode.DropDownItems.Add(_marioPlus);
     _menu.DropDownItems.Add(_options);
     _options.DropDownItems.Add(_boost);
     _options.DropDownItems.Add(_exponential);
     _options.DropDownItems.Add(_digital);
     _menu.DropDownItems.Add(_enable);
     _default.Checked      = true;
     _digital.Checked      = false;
     _exponential.Checked  = true;
     _menu.DropDownOpened += updateMenus;
 }
示例#3
0
 public AnalogGamepad(GamepadXBox g)
 {
     gamepad = g;
     setDefault();
 }