Adds utility function to clean up and standardize the remapping handling for keybinds

Adds sanity check so if no remappable binds are found for an actionMap, it isn't listed in the controls menu
Updates ExampleModule's keybinds to use new utility function
This commit is contained in:
Areloch 2022-12-06 00:16:13 -06:00
parent a304198abb
commit 44c894d335
3 changed files with 53 additions and 66 deletions

View file

@ -8,4 +8,23 @@ function getMouseAdjustAmount(%val)
{
// based on a default camera FOV of 90'
return(%val * ($cameraFov / 90) * 0.01) * $pref::Input::LinkMouseSensitivity;
}
function addKeyRemap(%name, %actionMap, %device, %command, %description)
{
if(%name $= "" ||
%actionMap $= "" ||
%device $= "" ||
%command $= "")
{
error("addKeybindRemap() - tried to add a remap entry, but didn't have all the keeded info!");
return;
}
$RemapName[$RemapCount] = %name;
$RemapCmd[$RemapCount] = %command;
$RemapActionMap[$RemapCount] = %actionMap;
$RemapDevice[$RemapCount] = %device;
$RemapDescription[$RemapCount] = %description;
$RemapCount++;
}