public static void RunGame(XmlNode game) { XmlNode system = game.ParentNode; if (system.LocalName == "clones") { system = system.ParentNode.ParentNode; } switch (system.LocalName) { case "mame": MameController.RunGame(game); break; case "playstation": PlaystationController.RunGame(game); break; case "snes": SnesController.RunGame(game); break; case "genesis": GenesisController.RunGame(game); break; case "nes": NesController.RunGame(game); break; case "gameboy": GameboyController.RunGame(game); break; case "atari2600": Atari2600Controller.RunGame(game); break; } }
void InitController() { var slot = GamepadManager.GetSlot(ControllerId); if (!slot.IsConnected) { return; } if (SnesController.IsMatch(slot)) { var snes = new SnesController(slot); Jump = snes.B; Attack = snes.Y; Dodge = snes.R; ActivateUpgrade = snes.X; Guard = snes.L; Start = snes.Start; Direction = snes.Dpad; } else if (Xbox360Controller.IsMatch(slot)) { var xbox = new Xbox360Controller(slot); Jump = xbox.A; Attack = xbox.X; Dodge = xbox.RB; ActivateUpgrade = xbox.Y; Guard = xbox.LB; Start = xbox.Start; Direction = xbox.LeftStick; } else { throw new Exception("invalid controller woh"); } }
public ControllerSelect(MenuWorld parent, int playerSlot, int joyId) { var font = Library.GetFont("fonts/Laffayette_Comic_Pro.ttf"); changing = false; this.parent = parent; Height = FP.Height - 20; Width = 250; this.JoyId = joyId; this.PlayerSlot = playerSlot; Image = new Image(Library.GetTexture("menu.png")); Image.Color = new Color(Color = colors[PlayerSlot]); pressStart = new Text("PRESS START"); pressStart.Font = font; pressStart.X -= 80; pressStart.Y = Height - 100; pressStart.Size = 20; pressStart.Color = new Color(0); check = new Image(Library.GetTexture("ready.png")); check.CenterOO(); check.Y = Height * 0.75f; check.ScaleY = 0; OriginX = Width / 2; Image.OriginX = Image.Width / 2; var slot = GamepadManager.GetSlot(joyId); if (SnesController.IsMatch(slot)) { var snes = new SnesController(slot); confirm = new Image(Library.GetTexture("Snes_1.png")); Cursor = snes.Dpad; Start = snes.Start; Back = snes.A; Confirm = snes.B; } else if (Xbox360Controller.IsMatch(slot)) { var xbox = new Xbox360Controller(slot); confirm = new Image(Library.GetTexture("Xbox_1.png")); Cursor = xbox.LeftStick; Start = xbox.Start; Confirm = xbox.A; Back = xbox.B; } else { throw new Exception("Invalid gamepad type, sorry D:"); } AddComponent(Image); AddComponent(pressStart); if (wins.ContainsKey(JoyId)) { var score = new Text(wins[joyId].ToString("Wins: 0")); score.Font = font; score.Color = new Color(0); score.Size = 20; score.X = pressStart.X + 32; score.Y = pressStart.Y + score.Size; AddComponent(score); } }