// Binds physical buttons to abstract actions, then exports the action // constants so other scripts don't need to know raw INPUT_ACTION_* names. Input.bind("w", INPUT_ACTION_UP); Input.bind("s", INPUT_ACTION_DOWN); Input.bind("a", INPUT_ACTION_LEFT); Input.bind("d", INPUT_ACTION_RIGHT); Input.bind("space", INPUT_ACTION_ACCEPT); Input.bind("escape", INPUT_ACTION_RAGEQUIT); if(typeof INPUT_GAMEPAD !== "undefined") { Input.bind("gamepad_up", INPUT_ACTION_UP); Input.bind("gamepad_down", INPUT_ACTION_DOWN); Input.bind("gamepad_left", INPUT_ACTION_LEFT); Input.bind("gamepad_right", INPUT_ACTION_RIGHT); Input.bind("gamepad_a", INPUT_ACTION_ACCEPT); Input.bind("gamepad_start", INPUT_ACTION_RAGEQUIT); } module = { UP: INPUT_ACTION_UP, DOWN: INPUT_ACTION_DOWN, LEFT: INPUT_ACTION_LEFT, RIGHT: INPUT_ACTION_RIGHT, ACCEPT: INPUT_ACTION_ACCEPT, CANCEL: INPUT_ACTION_CANCEL, RAGEQUIT: INPUT_ACTION_RAGEQUIT };