// Gets the gamepad with the given player index public static Gamepad getGamepad(int playerIndex) { Sdl.SDL_Quit(); gamepad= null; Sdl.SDL_Init(Sdl.SDL_INIT_EVERYTHING); return getGamepadNoQuit(playerIndex); }
// Initiates the input internal static void init(Game pmGame) { game= pmGame; Sdl.SDL_Init(Sdl.SDL_INIT_JOYSTICK); game.window.viewport.LostFocus+= onLostFocus; game.window.viewport.GotFocus+= onGotFocus; bFocused= true; pUseFocus= true; mhelper= new MouseHelper(game.window.viewport); khelper= new KeyboardHelper(game.window.viewport); gamepadDetector= new FList<GamepadInfo>(); gamepadDetector.add(new GamepadInfo(15, 0, 3, typeof(Xbox360Gamepad))); gamepadDetector.add(new GamepadInfo(12, 1, 2, typeof(PS2Gamepad))); if(Sdl.SDL_NumJoysticks()> 0) { gamepad= getGamepadNoQuit(0); } }
// Refreshes the gamepads, finding new ones or kicking out old ones public static void refreshGamepads() { gamepad= getGamepad(0); }