public static DirectXControllerFunction Create(DirectXControllerInterface controllerInterface, Guid objectType, int objectNumber, JoystickState initialState) { DirectXControllerFunction function = null; if (objectType == ObjectGuid.Button) function = new DirectXControllerButton(controllerInterface, objectNumber, initialState); else if (objectType == ObjectGuid.Slider) function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Slider, objectNumber, initialState); else if (objectType == ObjectGuid.XAxis) function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.X, objectNumber, initialState); else if (objectType == ObjectGuid.YAxis) function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Y, objectNumber, initialState); else if (objectType == ObjectGuid.ZAxis) function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Z, objectNumber, initialState); else if (objectType == ObjectGuid.RxAxis) function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Rx, objectNumber, initialState); else if (objectType == ObjectGuid.RyAxis) function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Ry, objectNumber, initialState); else if (objectType == ObjectGuid.RzAxis) function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Rz, objectNumber, initialState); else if (objectType == ObjectGuid.PovController) function = new DirectXControllerPOVHat(controllerInterface, objectNumber, initialState); return function; }
public static DirectXControllerFunction CreateDummy(DirectXControllerInterface controllerInterface, string type, int objectNumber) { DirectXControllerFunction function = null; JoystickState state = new JoystickState(); switch (type) { case "X Axis": function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.X, objectNumber, state); break; case "Y Axis": function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Y, objectNumber, state); break; case "Z Axis": function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Z, objectNumber, state); break; case "X Rotation": function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Rx, objectNumber, state); break; case "Y Rotation": function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Ry, objectNumber, state); break; case "Z Rotation": function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Rz, objectNumber, state); break; case "Slider": function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Slider, objectNumber, state); break; case "Button": function = new DirectXControllerButton(controllerInterface, objectNumber, state); break; case "POV": function = new DirectXControllerPOVHat(controllerInterface, objectNumber); break; } return(function); }
public static DirectXControllerFunction Create(DirectXControllerInterface controllerInterface, Guid objectType, int objectNumber, JoystickState initialState) { DirectXControllerFunction function = null; if (objectType == ObjectGuid.Button) { function = new DirectXControllerButton(controllerInterface, objectNumber, initialState); } else if (objectType == ObjectGuid.Slider) { function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Slider, objectNumber, initialState); } else if (objectType == ObjectGuid.XAxis) { function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.X, objectNumber, initialState); } else if (objectType == ObjectGuid.YAxis) { function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Y, objectNumber, initialState); } else if (objectType == ObjectGuid.ZAxis) { function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Z, objectNumber, initialState); } else if (objectType == ObjectGuid.RxAxis) { function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Rx, objectNumber, initialState); } else if (objectType == ObjectGuid.RyAxis) { function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Ry, objectNumber, initialState); } else if (objectType == ObjectGuid.RzAxis) { function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Rz, objectNumber, initialState); } else if (objectType == ObjectGuid.PovController) { function = new DirectXControllerPOVHat(controllerInterface, objectNumber, initialState); } return(function); }
public static DirectXControllerFunction CreateDummy(DirectXControllerInterface controllerInterface, string type, int objectNumber) { DirectXControllerFunction function = null; JoystickState state = new JoystickState(); switch (type) { case "X Axis": function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.X, objectNumber, state); break; case "Y Axis": function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Y, objectNumber, state); break; case "Z Axis": function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Z, objectNumber, state); break; case "X Rotation": function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Rx, objectNumber, state); break; case "Y Rotation": function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Ry, objectNumber, state); break; case "Z Rotation": function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Rz, objectNumber, state); break; case "Slider": function = new DirectXControllerAxis(controllerInterface, DirectXControllerAxis.AxisType.Slider, objectNumber, state); break; case "Button": function = new DirectXControllerButton(controllerInterface, objectNumber, state); break; case "POV": function = new DirectXControllerPOVHat(controllerInterface, objectNumber); break; } return function; }
private void UpdateControllerDisplay() { AxisPanel.Children.Clear(); ButtonPanel.Children.Clear(); _buttons.Clear(); DirectXControllerInterface controller = Interface as DirectXControllerInterface; if (controller != null) { foreach (DirectXControllerFunction function in controller.Functions) { DirectXControllerButton button = function as DirectXControllerButton; if (button != null) { ButtonIndicator indicator = new ButtonIndicator(); indicator.Width = 30; indicator.Height = 30; indicator.Label = (button.ObjectNumber + 1).ToString(); indicator.Margin = new Thickness(2); _buttons.Add(button, indicator); ButtonPanel.Children.Add(indicator); } DirectXControllerAxis axis = function as DirectXControllerAxis; if (axis != null) { AxisBar bar = new AxisBar(); bar.BarWidth = 30; bar.Height = 110; bar.Label = axis.Name; bar.BorderThickness = new Thickness(1d); bar.BorderBrush = Brushes.DarkGray; bar.Margin = new Thickness(10, 2, 0, 2); _axis.Add(axis, bar); AxisPanel.Children.Add(bar); } DirectXControllerPOVHat hat = function as DirectXControllerPOVHat; if (hat != null) { PointOfViewIndicator pov = new PointOfViewIndicator(); pov.Width = 60; pov.Height = 60; pov.Direction = POVDirection.Center; TextBlock label = new TextBlock(); label.Width = 60; label.Text = hat.Name; StackPanel panel = new StackPanel(); panel.Margin = new Thickness(10, 2, 0, 2); panel.Children.Add(pov); panel.Children.Add(label); _povs.Add(hat, pov); POVPanel.Children.Add(panel); } } if (_axis.Count > 0) { AxisGroup.Visibility = System.Windows.Visibility.Visible; } else { AxisGroup.Visibility = System.Windows.Visibility.Collapsed; } if (_buttons.Count > 0) { ButtonGroup.Visibility = System.Windows.Visibility.Visible; } else { ButtonGroup.Visibility = System.Windows.Visibility.Collapsed; } if (_povs.Count > 0) { POVGroup.Visibility = System.Windows.Visibility.Visible; } else { POVGroup.Visibility = System.Windows.Visibility.Collapsed; } } }