MCPcopy Create free account
hub / github.com/Card-Forge/forge / getGameControllers

Method getGameControllers

forge-gui-android/src/forge/app/Main.java:945–964  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

943 }
944
945 private ArrayList<String> getGameControllers() {
946 ArrayList<String> gameControllerDeviceIds = new ArrayList<>();
947 int[] deviceIds = InputDevice.getDeviceIds();
948 for (int deviceId : deviceIds) {
949 InputDevice dev = InputDevice.getDevice(deviceId);
950 int sources = dev.getSources();
951 String devNameId = dev.getName() + "[" + deviceId + "]";
952
953 // Verify that the device has gamepad buttons, control sticks, or both.
954 if (((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD)
955 || ((sources & InputDevice.SOURCE_JOYSTICK)
956 == InputDevice.SOURCE_JOYSTICK)) {
957 // This device is a game controller. Store its device ID.
958 if (!gameControllerDeviceIds.contains(devNameId)) {
959 gameControllerDeviceIds.add(devNameId);
960 }
961 }
962 }
963 return gameControllerDeviceIds;
964 }
965
966 public final String getAndroidOSName() {
967 final String codename;

Callers 1

onCreateMethod · 0.95

Calls 3

getNameMethod · 0.65
containsMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected