Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
 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
     });
Ejemplo n.º 4
0
        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));
            }
        }