Game controller button support (#33868)

This adds support for game controller buttons. It adds some supplemental USB HID codes that aren't available from the Chromium source code, and maps those on Android to the game pad buttons that Android supports. Other platforms are not supported yet.
This commit is contained in:
Greg Spencer
2019-06-05 16:23:17 -07:00
committed by GitHub
parent 4e4d3a5de4
commit f0978c225a
11 changed files with 1613 additions and 8 deletions

View File

@@ -52,6 +52,12 @@ Future<void> main(List<String> rawArguments) async {
'read. If --chromium-hid-codes is not specified, the input will be read '
'from the correct file in the Chromium repository.',
);
argParser.addOption(
'supplemental-hid-codes',
defaultsTo: path.join(flutterRoot.path, 'dev', 'tools', 'gen_keycodes', 'data', 'supplemental_hid_codes.inc'),
help: "The path to where the supplemental HID codes that don't appear in the "
'Chromium map should be read.',
);
argParser.addOption(
'android-keycodes',
defaultsTo: null,
@@ -140,6 +146,9 @@ Future<void> main(List<String> rawArguments) async {
hidCodes = File(parsedArguments['chromium-hid-codes']).readAsStringSync();
}
final String supplementalHidCodes = File(parsedArguments['supplemental-hid-codes']).readAsStringSync();
hidCodes = '$hidCodes\n$supplementalHidCodes';
String androidKeyCodes;
if (parsedArguments['android-keycodes'] == null) {
androidKeyCodes = await getAndroidKeyCodes();