/// <summary> /// Returns the current Nintendo Controller state. /// </summary> /// <returns></returns> public NintendoControllerState GetState() { var state = this._previousState; if (--this._debounce <= 0) { if (this._controller.QueryDevice()) { state = new NintendoControllerState(this._controller.ControllerInput); } else { state = NintendoControllerState.Disconnected; } this._debounce = DEBOUNCE_PERIOD; this._previousState = state; } return(state); }
/// <summary> /// Initializes a new instance of the <see cref="NintendoController"/> class. /// </summary> /// <param name="game">The game.</param> public NintendoController(Game game) { this._controller = new UsbSingleNintendoController(game.Window.Handle); this._previousState = NintendoControllerState.Disconnected; }