/** * Get a reference to a registered LaunchPad control. * * @param controlID Id of control to find. * @return Reference to the control object or null if not found. */ public LaunchPadControl FindButton(LaunchPadControlIDs controlID) { Util.consoleLog(controlID.name()); for (LaunchPadControl control : controls) if (control.id.value == controlID.value) return control; return null; }
/** * Construct JoyStick class with one control registered for monitoring. * * @param joystick The JoyStick object that maps to the LaunchPad * @param controlID Launch pad control id identifying control to register. * @param caller 'this' in calling class. */ public LaunchPad(Joystick joystick, LaunchPadControlIDs controlID, Object caller) { Util.consoleLog(controlID.name()); try { this.joyStick = joystick; this.caller = caller; if (controlID != null) AddControl(controlID); } catch (Exception e) { e.printStackTrace(Util.logPrintStream); } }
/** * Register additional control. * * @param controlID LaunchPad control id of control to register. * @return New control added or existing control. */ public LaunchPadControl AddControl(LaunchPadControlIDs controlID) { Util.consoleLog(controlID.name()); // try // { // if (!controls.contains(control)) controls.add(control); // } // catch (Exception e) {e.printStackTrace(Util.logPrintStream);} LaunchPadControl control = FindButton(controlID); if (control == null) { control = new LaunchPadControl(controlID); controls.add(control); } return control; }