public Atari2600ControllerDeck(Atari2600ControllerTypes controller1, Atari2600ControllerTypes controller2) { Port1 = ControllerCtors[controller1](1); Port2 = ControllerCtors[controller2](2); Definition = new("Atari 2600 Basic Controller") { BoolButtons = Port1.Definition.BoolButtons .Concat(Port2.Definition.BoolButtons) .Concat(new[] { "Reset", "Select", "Power", "Toggle Left Difficulty", "Toggle Right Difficulty" }) .ToList() }; foreach (var kvp in Port1.Definition.Axes) { Definition.Axes.Add(kvp); } foreach (var kvp in Port2.Definition.Axes) { Definition.Axes.Add(kvp); } Definition.MakeImmutable(); }
public Atari2600ControllerDeck(Atari2600ControllerTypes controller1, Atari2600ControllerTypes controller2) { Port1 = (IPort)Activator.CreateInstance(Implementors[(int)controller1], 1); Port2 = (IPort)Activator.CreateInstance(Implementors[(int)controller2], 2); Definition = new ControllerDefinition { Name = "Atari 2600 Basic Controller", BoolButtons = Port1.Definition.BoolButtons .Concat(Port2.Definition.BoolButtons) .Concat(new[] { "Reset", "Select", "Power", "Toggle Left Difficulty", "Toggle Right Difficulty" }) .ToList() }; foreach (var kvp in Port1.Definition.Axes) { Definition.Axes.Add(kvp); } foreach (var kvp in Port2.Definition.Axes) { Definition.Axes.Add(kvp); } }
private static PadSchema PadSchemaFromSetting(Atari2600ControllerTypes type, int controller) { return(type switch { Atari2600ControllerTypes.Unplugged => null, Atari2600ControllerTypes.Joystick => StandardController(controller), Atari2600ControllerTypes.Paddle => PaddleController(controller), Atari2600ControllerTypes.BoostGrip => BoostGripController(controller), Atari2600ControllerTypes.Driving => DrivingController(controller), _ => null });
private static PadSchema PadSchemaFromSetting(Atari2600ControllerTypes type, int controller) { switch (type) { default: case Atari2600ControllerTypes.Unplugged: return(null); case Atari2600ControllerTypes.Joystick: return(StandardController(controller)); case Atari2600ControllerTypes.Paddle: return(PaddleController(controller)); } }