pokerogue/src/configs/gamepad-utils.ts

15 lines
482 B
TypeScript
Raw Normal View History

import {GamepadConfig} from "../inputs-controller";
export function getKeyForButtonIndex(config: GamepadConfig, index: integer): String {
for (const key of Object.keys(config.gamepadMapping)) {
const id = config.gamepadMapping[key];
if (id === index) return key;
}
return null;
}
export function getIconForCustomIndex(config: GamepadConfig, index: integer): String {
const key = getKeyForButtonIndex(config, index);
return config.icons[key];
}