/// <summary> /// Normally for internal use only; call if user has attached new Gamepads, /// or detached Gamepads you want discarded /// Otherwise, loaded once on first Gamepad request and does not reflect changes in gamepad attachment /// TODO: Do this better /// </summary> public static void ReloadGamepads() { // gamepads generally misidentified as Joysticks in DirectInput... get both DeviceList gamepadInstanceList = Manager.GetDevices(DeviceType.Gamepad, EnumDevicesFlags.AttachedOnly); DeviceList joystickInstanceList = Manager.GetDevices(DeviceType.Joystick, EnumDevicesFlags.AttachedOnly); gamepads = new List <DirectInputGamepad>(gamepadInstanceList.Count + joystickInstanceList.Count); foreach (DeviceInstance deviceInstance in gamepadInstanceList) { DirectInputGamepad gamepad = new DirectInputGamepad(deviceInstance.InstanceGuid); gamepads.Add(gamepad); } foreach (DeviceInstance deviceInstance in joystickInstanceList) { DirectInputGamepad gamepad = new DirectInputGamepad(deviceInstance.InstanceGuid); gamepads.Add(gamepad); } }
/// <summary> /// Normally for internal use only; call if user has attached new Gamepads, /// or detached Gamepads you want discarded /// Otherwise, loaded once on first Gamepad request and does not reflect changes in gamepad attachment /// TODO: Do this better /// </summary> public static void ReloadGamepads() { // gamepads generally misidentified as Joysticks in DirectInput... get both DeviceList gamepadInstanceList = Manager.GetDevices(DeviceType.Gamepad, EnumDevicesFlags.AttachedOnly); DeviceList joystickInstanceList = Manager.GetDevices(DeviceType.Joystick, EnumDevicesFlags.AttachedOnly); gamepads = new List<DirectInputGamepad>(gamepadInstanceList.Count + joystickInstanceList.Count); foreach (DeviceInstance deviceInstance in gamepadInstanceList) { DirectInputGamepad gamepad = new DirectInputGamepad(deviceInstance.InstanceGuid); gamepads.Add(gamepad); } foreach (DeviceInstance deviceInstance in joystickInstanceList) { DirectInputGamepad gamepad = new DirectInputGamepad(deviceInstance.InstanceGuid); gamepads.Add(gamepad); } }
public UserCode() { joy = JoystickInput.Hook; output = new OutputWindow(); output.Show(); }