/** * Find GamePadButton button by type in the list of configured buttons. * * @param buttonID Enum value identifying button to find. * @return Button or null. */ public GamePadButton FindButton(GamePadButtonIDs button) { Util.consoleLog("%s (%s)", gamePadName, button.name()); for (GamePadButton gpButton : buttons) if (gpButton.id.value == button.value) return gpButton; return null; }
/** * Add additonal GamePadButton button to be monitored. * * @param button Enum value identifying button to add. * @return New button added or existing button. */ public GamePadButton AddButton(GamePadButtonIDs button) { Util.consoleLog("%s (%s)", gamePadName, button.name()); GamePadButton gpButton = FindButton(button); if (gpButton == null) { gpButton = new GamePadButton(button); buttons.add(gpButton); } return gpButton; }