private void gatherControllers(boolean sendEvent) { // gather all joysticks and gamepads, remove any disconnected ones IntMap<AndroidController> removedControllers = new IntMap<AndroidController>(); removedControllers.putAll(controllerMap); for(int deviceId: InputDevice.getDeviceIds()) { InputDevice device = InputDevice.getDevice(deviceId); AndroidController controller = controllerMap.get(deviceId); if(controller != null) { removedControllers.remove(deviceId); } else { addController(deviceId, sendEvent); } } for(Entry<AndroidController> entry: removedControllers.entries()) { removeController(entry.key); } }
public static void pollGamepads() { JsArray<Gamepad> currentGamepads = nativePollGamepads(); if (currentGamepads != null) { gamepadsTemp.clear(); gamepadsTemp.putAll(gamepads); for (int i = 0, j = currentGamepads.length(); i < j; i++) { Gamepad gamepad = currentGamepads.get(i); if (gamepad != null) { if (!gamepadsTemp.containsKey(gamepad.getIndex())) { onGamepadConnect(gamepad); } gamepadsTemp.remove(gamepad.getIndex()); } } for (Gamepad gamepad : gamepadsTemp.values()) { onGamepadDisconnect(gamepad); } } }
/** * You may want to copy colors between IColorCenter instances that have different create() methods -- and as * such, will have different values for the same keys in the cache. This allows you to copy the cache from other * into this Skeleton, but using this Skeleton's create() method. * @param other another Skeleton of the same type that will have its cache copied into this Skeleton */ public void copyCache(SquidColorCenter other) { cache.putAll(other.cache); }
public void setKeyboardMapping(IntMap<IntArray> keyboardMapping){ this.keyboardMapping.putAll(keyboardMapping); }
@Override public void putAll(IntMap<V> map) { super.putAll(map); Keys keys = map.keys(); keys.reset(); while(keys.hasNext) { sortedKeys.add(keys.next()); } sortedKeys.sort(); }
public static void pollGamepads() { JSArray<Gamepad> currentGamepads = nativePollGamepads(); if (currentGamepads != null) { gamepadsTemp.clear(); gamepadsTemp.putAll(gamepads); for (int i = 0, j = currentGamepads.getLength(); i < j; i++) { Gamepad gamepad = currentGamepads.get(i); if (gamepad != null) { if (!gamepadsTemp.containsKey(gamepad.getIndex())) { onGamepadConnect(gamepad); } gamepadsTemp.remove(gamepad.getIndex()); } } for (Gamepad gamepad : gamepadsTemp.values()) { onGamepadDisconnect(gamepad); } } }