The target for a mapping-string name such as leftx or dpup, or .UNINITIALIZED for an unknown name.
assert(input_name_to_input_target("start") == .START);
assert(input_name_to_input_target("nope") == .UNINITIALIZED);↗#import "Gamepad/SDL_Input_Map";
Parses SDL game controller mapping strings, the guid,name,a:b0,leftx:a0,... lines of the SDL
controller database.
parse_gamepad_mapping_string turns one line into an SDL_Gamepad_Mapping; free it with deinit.
mapping, ok := parse_gamepad_mapping_string("030000005e040000,Pad,a:b0,leftx:a0,dpup:h0.1,platform:Mac OS X");
assert(ok && mapping.name == "Pad" && mapping.mappings.count == 3);
assert(mapping.mappings[0].target == .A && mapping.mappings[0].type == .BUTTON);
deinit(mapping);The target for a mapping-string name such as leftx or dpup, or .UNINITIALIZED for an unknown name.
assert(input_name_to_input_target("start") == .START);
assert(input_name_to_input_target("nope") == .UNINITIALIZED);↗Frees a mapping returned by parse_gamepad_mapping_string.
Builds the 32-character SDL GUID for a device from its bus type, vendor, product and version. The string lives in temporary storage.
guid := get_guid_string(3, 0x45e, 0x28e, 0x110);
assert(guid.count == 32);↗Parses one SDL mapping line. Returns the mapping and whether the line was valid. The caller owns
the result: free it with deinit.
mapping, ok := parse_gamepad_mapping_string("guid,Pad,a:b0,righttrigger:a5");
assert(ok && mapping.mappings[1].type == .AXIS && mapping.mappings[1].index == 5);
deinit(mapping);
_, ok = parse_gamepad_mapping_string("guid,Pad,bogus:b0");
assert(!ok);↗Whether a mapped input is a button, an axis or a hat (d-pad) direction.
The part of a standard controller an input is mapped onto.
One mapping entry: the physical input (type, index, and subindex for a hat) that drives target.
A controller's mapping: its guid, name, platform and the list of entries.
Altered data extraction: platform-qualified and sorted by device identity.