mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
- Added ability to explicitly execute a guiControl's console and altConsole command
- Fixed formatting of resolution strings for the internal values, allowing them to be properly parsed and applied by the options menu/canvas - Fixed display of Display Device on option's menu - Fixed Issue of it not displaying any keybinds in keyboard/gamepad options if there's only a single actionmap - Added 'hold to scroll' action to optionsMenu - Added apply button to options menu - Added remap button to options menu when on keyboard/gamepad keybinds categories - Fixed up the remap logic so remapping a key only unbinds the matched device being bound, so binds for different devices are untouched - Made keybinds options properly refresh when keybinds are changed - Shifted keyboard "go" keybind for menu nav from Enter to Space for easier use - Removed stick keybinds from gamepad
This commit is contained in:
parent
f5ab97242f
commit
67ac556ecd
14 changed files with 223 additions and 95 deletions
|
|
@ -2947,3 +2947,19 @@ DefineEngineMethod( GuiControl, getAspect, F32, (),,
|
||||||
const Point2I &ext = object->getExtent();
|
const Point2I &ext = object->getExtent();
|
||||||
return (F32)ext.x / (F32)ext.y;
|
return (F32)ext.x / (F32)ext.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
DefineEngineMethod(GuiControl, execCommand, const char*, (), ,
|
||||||
|
"Forcefully executes the command field value(if any) on this guiControl.\n"
|
||||||
|
"@return The results of the evaluation of the command.")
|
||||||
|
{
|
||||||
|
return object->execConsoleCallback();
|
||||||
|
}
|
||||||
|
|
||||||
|
DefineEngineMethod(GuiControl, execAltCommand, const char*, (), ,
|
||||||
|
"Forcefully executes the altCommand field value(if any) on this guiControl.\n"
|
||||||
|
"@return The results of the evaluation of the altCommand.")
|
||||||
|
{
|
||||||
|
return object->execAltConsoleCallback();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ function configureCanvas()
|
||||||
if ($pref::Video::deviceMode != $Video::ModeFullscreen)
|
if ($pref::Video::deviceMode != $Video::ModeFullscreen)
|
||||||
$pref::Video::FullScreen = false;
|
$pref::Video::FullScreen = false;
|
||||||
%modeStr = Canvas.prefsToModeStr();
|
%modeStr = Canvas.prefsToModeStr();
|
||||||
|
|
||||||
echo("--------------");
|
echo("--------------");
|
||||||
echo("Attempting to set resolution to \"" @ %modeStr @ "\"");
|
echo("Attempting to set resolution to \"" @ %modeStr @ "\"");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,10 @@ function OptionsQualityLevel::isCurrent( %this )
|
||||||
%value = %this.getValue( %i );
|
%value = %this.getValue( %i );
|
||||||
|
|
||||||
if ( getVariable( %pref ) !$= %value )
|
if ( getVariable( %pref ) !$= %value )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -971,7 +972,7 @@ function VideoSettingsGroup::populateDisplaySettings(%this)
|
||||||
{
|
{
|
||||||
class = "OptionsQualityLevel";
|
class = "OptionsQualityLevel";
|
||||||
displayName = %device;
|
displayName = %device;
|
||||||
key["$pref::Video::displayDeviceId"] = %device;
|
key["$pref::Video::deviceId"] = %i;
|
||||||
};
|
};
|
||||||
|
|
||||||
DisplayDevicesGroup.add(%entry);
|
DisplayDevicesGroup.add(%entry);
|
||||||
|
|
@ -985,8 +986,9 @@ function VideoSettingsGroup::populateDisplaySettings(%this)
|
||||||
for(%i=0; %i < getFieldCount(%resolutionList); %i++)
|
for(%i=0; %i < getFieldCount(%resolutionList); %i++)
|
||||||
{
|
{
|
||||||
%rawResolution = getField(%resolutionList, %i);
|
%rawResolution = getField(%resolutionList, %i);
|
||||||
%prettyResolution = _makePrettyResString(%rawResolution);
|
|
||||||
|
|
||||||
|
%prettyResolution = _makePrettyResString(%rawResolution);
|
||||||
|
|
||||||
%entry = new ArrayObject()
|
%entry = new ArrayObject()
|
||||||
{
|
{
|
||||||
class = "OptionsQualityLevel";
|
class = "OptionsQualityLevel";
|
||||||
|
|
@ -997,6 +999,26 @@ function VideoSettingsGroup::populateDisplaySettings(%this)
|
||||||
DisplayResSettingsGroup.add(%entry);
|
DisplayResSettingsGroup.add(%entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if($platform !$= "windows")
|
||||||
|
%monitorRect = Canvas.getMonitorUsableRect($pref::Video::deviceId);
|
||||||
|
else
|
||||||
|
%monitorRect = Canvas.getMonitorRect($pref::Video::deviceId);
|
||||||
|
|
||||||
|
%rawResolution = getWords(%monitorRect, 2);
|
||||||
|
|
||||||
|
%prettyResolution = _makePrettyResString(%rawResolution);
|
||||||
|
|
||||||
|
%entry = new ArrayObject()
|
||||||
|
{
|
||||||
|
class = "OptionsQualityLevel";
|
||||||
|
displayName = %prettyResolution;
|
||||||
|
key["$pref::Video::Resolution"] = %rawResolution;
|
||||||
|
};
|
||||||
|
|
||||||
|
DisplayResSettingsGroup.add(%entry);
|
||||||
|
}
|
||||||
|
|
||||||
%refreshList = getScreenRefreshList($pref::Video::mode);
|
%refreshList = getScreenRefreshList($pref::Video::mode);
|
||||||
for(%i=0; %i < getFieldCount(%refreshList); %i++)
|
for(%i=0; %i < getFieldCount(%refreshList); %i++)
|
||||||
|
|
@ -1100,6 +1122,7 @@ function updateDisplayOptionsSettings()
|
||||||
$pref::Video::FullScreen = %newFullScreen;
|
$pref::Video::FullScreen = %newFullScreen;
|
||||||
$pref::Video::RefreshRate = %newRefresh;
|
$pref::Video::RefreshRate = %newRefresh;
|
||||||
$pref::Video::AA = %newAA;
|
$pref::Video::AA = %newAA;
|
||||||
|
|
||||||
configureCanvas();
|
configureCanvas();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1135,6 +1158,11 @@ function PostFXLightRayOptionsGroup::onApply(%this)
|
||||||
|
|
||||||
function getCurrentQualityLevel(%qualityGroup)
|
function getCurrentQualityLevel(%qualityGroup)
|
||||||
{
|
{
|
||||||
|
/*if(%qualityGroup.getId() == DisplayResSettingsGroup.getId())
|
||||||
|
{
|
||||||
|
echo("Checking current quality level of Display Resolution");
|
||||||
|
}*/
|
||||||
|
|
||||||
for ( %i=0; %i < %qualityGroup.getCount(); %i++ )
|
for ( %i=0; %i < %qualityGroup.getCount(); %i++ )
|
||||||
{
|
{
|
||||||
%level = %qualityGroup.getObject( %i );
|
%level = %qualityGroup.getObject( %i );
|
||||||
|
|
@ -1349,7 +1377,7 @@ function getScreenResolutionList(%deviceID, %deviceMode)
|
||||||
if ((%deviceMode == $Video::ModeBorderless) && ($platform !$= "windows"))
|
if ((%deviceMode == $Video::ModeBorderless) && ($platform !$= "windows"))
|
||||||
{
|
{
|
||||||
%borderlessRes = getWords(Canvas.getMonitorUsableRect(%deviceID), 2);
|
%borderlessRes = getWords(Canvas.getMonitorUsableRect(%deviceID), 2);
|
||||||
return _makePrettyResString(%borderlessRes);
|
return %borderlessRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
%resCount = Canvas.getModeCount();
|
%resCount = Canvas.getModeCount();
|
||||||
|
|
@ -1361,7 +1389,7 @@ function getScreenResolutionList(%deviceID, %deviceMode)
|
||||||
if (!Canvas.checkCanvasRes(%testResString, %deviceID, %deviceMode, false))
|
if (!Canvas.checkCanvasRes(%testResString, %deviceID, %deviceMode, false))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
%testRes = _makePrettyResString( %testResString );
|
%testRes = getWords(%testResString, 0, 1);
|
||||||
|
|
||||||
//sanitize
|
//sanitize
|
||||||
%found = false;
|
%found = false;
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,10 @@ addKeyRemap("Ascend", "ExampleMoveMap", "keyboard", "moveup", "Makes the camera
|
||||||
addKeyRemap("Descend", "ExampleMoveMap", "keyboard", "movedown", "Makes the camera descend");
|
addKeyRemap("Descend", "ExampleMoveMap", "keyboard", "movedown", "Makes the camera descend");
|
||||||
addKeyRemap("Jump", "ExampleMoveMap", "keyboard", "jump", "Jump");
|
addKeyRemap("Jump", "ExampleMoveMap", "keyboard", "jump", "Jump");
|
||||||
|
|
||||||
addKeyRemap("Forward", "ExampleMoveMap", "gamepad", "gamePadMoveY", "Forward Movement");
|
//addKeyRemap("Forward", "ExampleMoveMap", "gamepad", "gamePadMoveY", "Forward Movement");
|
||||||
addKeyRemap("Backward", "ExampleMoveMap", "gamepad", "gamePadMoveY", "Backward Movement");
|
//addKeyRemap("Backward", "ExampleMoveMap", "gamepad", "gamePadMoveY", "Backward Movement");
|
||||||
addKeyRemap("Strafe Left", "ExampleMoveMap", "gamepad", "gamePadMoveX", "Left Strafing Movement");
|
//addKeyRemap("Strafe Left", "ExampleMoveMap", "gamepad", "gamePadMoveX", "Left Strafing Movement");
|
||||||
addKeyRemap("Strafe Right", "ExampleMoveMap", "gamepad", "gamePadMoveX", "Right Strafing Movement");
|
//addKeyRemap("Strafe Right", "ExampleMoveMap", "gamepad", "gamePadMoveX", "Right Strafing Movement");
|
||||||
addKeyRemap("Jump", "ExampleMoveMap", "gamepad", "jump", "Jump");
|
addKeyRemap("Jump", "ExampleMoveMap", "gamepad", "jump", "Jump");
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ if(!isObject( ChooseLevelActionMap ) )
|
||||||
ChooseLevelActionMap.bind( gamepad, lpov, BaseUINavigatePrev );
|
ChooseLevelActionMap.bind( gamepad, lpov, BaseUINavigatePrev );
|
||||||
ChooseLevelActionMap.bind( gamepad, rpov, BaseUINavigateNext );
|
ChooseLevelActionMap.bind( gamepad, rpov, BaseUINavigateNext );
|
||||||
|
|
||||||
ChooseLevelActionMap.bind( keyboard, Enter, ChooseLevelBegin );
|
ChooseLevelActionMap.bind( keyboard, Space, ChooseLevelBegin );
|
||||||
ChooseLevelActionMap.bind( gamepad, btn_a, ChooseLevelBegin );
|
ChooseLevelActionMap.bind( gamepad, btn_a, ChooseLevelBegin );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ if(!isObject( GameMenuActionMap ) )
|
||||||
GameMenuActionMap.bind( gamepad, upov, BaseUINavigatePrev );
|
GameMenuActionMap.bind( gamepad, upov, BaseUINavigatePrev );
|
||||||
GameMenuActionMap.bind( gamepad, dpov, BaseUINavigateNext );
|
GameMenuActionMap.bind( gamepad, dpov, BaseUINavigateNext );
|
||||||
|
|
||||||
GameMenuActionMap.bind( keyboard, Enter, BaseUIActivateSelected );
|
GameMenuActionMap.bind( keyboard, Space, BaseUIActivateSelected );
|
||||||
GameMenuActionMap.bind( gamepad, btn_a, BaseUIActivateSelected );
|
GameMenuActionMap.bind( gamepad, btn_a, BaseUIActivateSelected );
|
||||||
|
|
||||||
GameMenuActionMap.bindCmd( keyboard, Escape, "Canvas.popDialog(GameMenu);", "" );
|
GameMenuActionMap.bindCmd( keyboard, Escape, "Canvas.popDialog(GameMenu);", "" );
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ if(!isObject( JoinServerActionMap ) )
|
||||||
JoinServerActionMap.bindCmd( keyboard, e, "JoinServerMenu.queryLan();" );
|
JoinServerActionMap.bindCmd( keyboard, e, "JoinServerMenu.queryLan();" );
|
||||||
JoinServerActionMap.bindCmd( gamepad, btn_y, "JoinServerMenu.queryLan();" );
|
JoinServerActionMap.bindCmd( gamepad, btn_y, "JoinServerMenu.queryLan();" );
|
||||||
|
|
||||||
JoinServerActionMap.bindCmd( keyboard, Enter, "JoinServerMenu::join();" );
|
JoinServerActionMap.bindCmd( keyboard, Space, "JoinServerMenu::join();" );
|
||||||
JoinServerActionMap.bindCmd( gamepad, btn_a, "JoinServerMenu::join();" );
|
JoinServerActionMap.bindCmd( gamepad, btn_a, "JoinServerMenu::join();" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ function MainMenuGui::onWake(%this)
|
||||||
{
|
{
|
||||||
$MenuList = MainMenuButtonList;
|
$MenuList = MainMenuButtonList;
|
||||||
$MenuList.listPosition = 0;
|
$MenuList.listPosition = 0;
|
||||||
|
|
||||||
|
$MenuList.syncGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
function MainMenuGui::onSleep(%this)
|
function MainMenuGui::onSleep(%this)
|
||||||
|
|
@ -25,7 +27,7 @@ if(!isObject( BaseUIActionMap ) )
|
||||||
BaseUIActionMap.bind( gamepad, upov, BaseUINavigatePrev );
|
BaseUIActionMap.bind( gamepad, upov, BaseUINavigatePrev );
|
||||||
BaseUIActionMap.bind( gamepad, dpov, BaseUINavigateNext );
|
BaseUIActionMap.bind( gamepad, dpov, BaseUINavigateNext );
|
||||||
|
|
||||||
BaseUIActionMap.bind( keyboard, Enter, BaseUIActivateSelected );
|
BaseUIActionMap.bind( keyboard, Space, BaseUIActivateSelected );
|
||||||
BaseUIActionMap.bind( gamepad, btn_a, BaseUIActivateSelected );
|
BaseUIActionMap.bind( gamepad, btn_a, BaseUIActivateSelected );
|
||||||
|
|
||||||
BaseUIActionMap.bind( keyboard, Escape, BaseUIBackOut );
|
BaseUIActionMap.bind( keyboard, Escape, BaseUIBackOut );
|
||||||
|
|
@ -75,9 +77,7 @@ function BaseUIStickNavigate(%val)
|
||||||
else if(%val == -1)
|
else if(%val == -1)
|
||||||
BaseUINavigatePrev(1);
|
BaseUINavigatePrev(1);
|
||||||
else
|
else
|
||||||
{
|
|
||||||
cancel($BaseUI::scrollSchedule);
|
cancel($BaseUI::scrollSchedule);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function BaseUIBackOut(%val)
|
function BaseUIBackOut(%val)
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ if(!isObject( MessageBoxActionMap ) )
|
||||||
{
|
{
|
||||||
new ActionMap(MessageBoxActionMap){};
|
new ActionMap(MessageBoxActionMap){};
|
||||||
|
|
||||||
MessageBoxActionMap.bind( keyboard, Enter, messageBoxYesClicked );
|
MessageBoxActionMap.bind( keyboard, Space, messageBoxYesClicked );
|
||||||
MessageBoxActionMap.bind( gamepad, btn_a, messageBoxYesClicked );
|
MessageBoxActionMap.bind( gamepad, btn_a, messageBoxYesClicked );
|
||||||
|
|
||||||
MessageBoxActionMap.bind( keyboard, Escape, messageBoxNoClicked );
|
MessageBoxActionMap.bind( keyboard, Escape, messageBoxNoClicked );
|
||||||
|
|
|
||||||
|
|
@ -192,11 +192,41 @@ $guiContent = new GuiControl(OptionsMenu) {
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
class = "MenuInputButton";
|
class = "MenuInputButton";
|
||||||
};
|
};
|
||||||
new GuiIconButtonCtrl(OptionsMenuResetBtn) {
|
new GuiIconButtonCtrl(OptionsMenuRemapBtn) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_Space_image";
|
||||||
|
sizeIconToButton = "1";
|
||||||
|
makeIconSquare = "1";
|
||||||
|
textLocation = "Center";
|
||||||
|
text = "Remap";
|
||||||
|
position = "850 0";
|
||||||
|
extent = "140 40";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "OptionsMenuActivateOption(1)";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
class = "MenuInputButton";
|
||||||
|
};
|
||||||
|
new GuiIconButtonCtrl(OptionsMenuApplyBtn) {
|
||||||
BitmapAsset = "UI:Keyboard_Black_Return_image";
|
BitmapAsset = "UI:Keyboard_Black_Return_image";
|
||||||
sizeIconToButton = "1";
|
sizeIconToButton = "1";
|
||||||
makeIconSquare = "1";
|
makeIconSquare = "1";
|
||||||
textLocation = "Center";
|
textLocation = "Center";
|
||||||
|
text = "Apply";
|
||||||
|
position = "990 0";
|
||||||
|
extent = "140 40";
|
||||||
|
horizSizing = "left";
|
||||||
|
vertSizing = "center";
|
||||||
|
profile = "GuiMenuButtonProfile";
|
||||||
|
command = "OptionsMenu.applyChangedOptions();";
|
||||||
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
class = "MenuInputButton";
|
||||||
|
};
|
||||||
|
new GuiIconButtonCtrl(OptionsMenuResetBtn) {
|
||||||
|
BitmapAsset = "UI:Keyboard_Black_R_image";
|
||||||
|
sizeIconToButton = "1";
|
||||||
|
makeIconSquare = "1";
|
||||||
|
textLocation = "Center";
|
||||||
text = "Reset";
|
text = "Reset";
|
||||||
position = "1135 0";
|
position = "1135 0";
|
||||||
extent = "140 40";
|
extent = "140 40";
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,11 @@ if(!isObject( OptionsMenuActionMap ) )
|
||||||
OptionsMenuActionMap.bind( keyboard, R, OptionsMenuReset );
|
OptionsMenuActionMap.bind( keyboard, R, OptionsMenuReset );
|
||||||
OptionsMenuActionMap.bind( gamepad, btn_x, OptionsMenuReset );
|
OptionsMenuActionMap.bind( gamepad, btn_x, OptionsMenuReset );
|
||||||
|
|
||||||
OptionsMenuActionMap.bind( keyboard, Enter, OptionsMenuActivateOption );
|
OptionsMenuActionMap.bind( keyboard, Space, OptionsMenuActivateOption );
|
||||||
OptionsMenuActionMap.bind( gamepad, btn_a, OptionsMenuActivateOption );
|
OptionsMenuActionMap.bind( gamepad, btn_a, OptionsMenuActivateOption );
|
||||||
|
|
||||||
|
OptionsMenuActionMap.bind( keyboard, Enter, tryApplyOptions);
|
||||||
|
OptionsMenuActionMap.bind( gamepad, btn_start, tryApplyOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
@ -237,6 +240,11 @@ function OptionsMenu::syncGui(%this)
|
||||||
|
|
||||||
OptionsMenuPrevNavIcon.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuPrevCategory"));
|
OptionsMenuPrevNavIcon.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuPrevCategory"));
|
||||||
OptionsMenuNextNavIcon.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuNextCategory"));
|
OptionsMenuNextNavIcon.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuNextCategory"));
|
||||||
|
|
||||||
|
OptionsMenuApplyBtn.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "tryApplyOptions"));
|
||||||
|
|
||||||
|
OptionsMenuRemapBtn.visible = KBMControlsList.visible || GamepadControlsList.visible;
|
||||||
|
OptionsMenuRemapBtn.setBitmap(OptionsMenuActionMap.getCommandButtonBitmap(%device, "OptionsMenuActivateOption"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
@ -292,6 +300,12 @@ function OptionMenuNavigatePrev(%val)
|
||||||
$MenuList.listPosition = 0;
|
$MenuList.listPosition = 0;
|
||||||
|
|
||||||
$MenuList.syncGUI();
|
$MenuList.syncGUI();
|
||||||
|
|
||||||
|
$BaseUI::scrollSchedule = schedule($BaseUI::scrollSpeedTimeMs, 0, "OptionMenuNavigatePrev", 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cancel($BaseUI::scrollSchedule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -311,15 +325,23 @@ function OptionMenuNavigateNext(%val)
|
||||||
$MenuList.listPosition = $MenuList.getCount()-1;
|
$MenuList.listPosition = $MenuList.getCount()-1;
|
||||||
|
|
||||||
$MenuList.syncGUI();
|
$MenuList.syncGUI();
|
||||||
|
|
||||||
|
$BaseUI::scrollSchedule = schedule($BaseUI::scrollSpeedTimeMs, 0, "OptionMenuNavigateNext", 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cancel($BaseUI::scrollSchedule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function OptionMenuStickNavigate(%val)
|
function OptionMenuStickNavigate(%val)
|
||||||
{
|
{
|
||||||
if(%val == -1)
|
if(%val == 1)
|
||||||
BaseUINavigateNext(1);
|
OptionMenuNavigateNext(1);
|
||||||
else if(%val == 1)
|
else if(%val == -1)
|
||||||
mainMenuNavigateDown(1);
|
OptionMenuNavigatePrev(1);
|
||||||
|
else
|
||||||
|
cancel($BaseUI::scrollSchedule);
|
||||||
}
|
}
|
||||||
|
|
||||||
function OptionMenuPrevSetting(%val)
|
function OptionMenuPrevSetting(%val)
|
||||||
|
|
@ -387,11 +409,9 @@ function OptionsMenuActivateOption(%val)
|
||||||
if(!isObject(%option))
|
if(!isObject(%option))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
echo(%option.class);
|
|
||||||
|
|
||||||
if(%option.class $= "OptionsKeybindEntry")
|
if(%option.class $= "OptionsKeybindEntry")
|
||||||
{
|
{
|
||||||
eval(%option-->button.altCommand);
|
%option-->button.execAltCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -504,29 +524,29 @@ function OptionsMenu::populateAudioSettings(%this)
|
||||||
|
|
||||||
function OptionsMenu::populateKBMControls(%this)
|
function OptionsMenu::populateKBMControls(%this)
|
||||||
{
|
{
|
||||||
//$remapListDevice = "keyboard";
|
|
||||||
%this.populateKeybinds("keyboard", KBMControlsList);
|
%this.populateKeybinds("keyboard", KBMControlsList);
|
||||||
|
|
||||||
%this.syncGui();
|
%this.syncGui();
|
||||||
|
|
||||||
|
KBMControlsList.syncGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
function OptionsMenu::populateGamepadControls(%this)
|
function OptionsMenu::populateGamepadControls(%this)
|
||||||
{
|
{
|
||||||
//$remapListDevice = ;
|
|
||||||
%this.populateKeybinds("gamepad", GamepadControlsList);
|
%this.populateKeybinds("gamepad", GamepadControlsList);
|
||||||
|
|
||||||
%this.syncGui();
|
%this.syncGui();
|
||||||
|
|
||||||
|
GamepadControlsList.syncGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
function OptionsMenu::populateKeybinds(%this, %device, %controlsList)
|
function OptionsMenu::populateKeybinds(%this, %device, %controlsList)
|
||||||
{
|
{
|
||||||
//%device = $remapListDevice;
|
|
||||||
|
|
||||||
%controlsList.clear();
|
%controlsList.clear();
|
||||||
|
|
||||||
//build out our list of action maps
|
//build out our list of action maps
|
||||||
%actionMapCount = ActionMapGroup.getCount();
|
%actionMapCount = ActionMapGroup.getCount();
|
||||||
|
|
||||||
%actionMapList = "";
|
%actionMapList = "";
|
||||||
for(%i=0; %i < %actionMapCount; %i++)
|
for(%i=0; %i < %actionMapCount; %i++)
|
||||||
{
|
{
|
||||||
|
|
@ -567,32 +587,34 @@ function OptionsMenu::populateKeybinds(%this, %device, %controlsList)
|
||||||
if($activeRemapControlSet $= "")
|
if($activeRemapControlSet $= "")
|
||||||
$activeRemapControlSet = getField(%actionMapList, 0);
|
$activeRemapControlSet = getField(%actionMapList, 0);
|
||||||
|
|
||||||
if(getFieldCount(%actionMapList) > 1)
|
for(%am = 0; %am < getFieldCount(%actionMapList); %am++)
|
||||||
{
|
{
|
||||||
for(%am = 0; %am < getFieldCount(%actionMapList); %am++)
|
%currentActionMap = getField(%actionMapList, %am);
|
||||||
|
|
||||||
|
//only add the group if we've got more than one group, otherwise it's obviously
|
||||||
|
//part of the single grouping
|
||||||
|
if(getFieldCount(%actionMapList) > 1)
|
||||||
{
|
{
|
||||||
%currentActionMap = getField(%actionMapList, %am);
|
|
||||||
|
|
||||||
%actionMapGroupEntry = addOptionGroup(%currentActionMap);
|
%actionMapGroupEntry = addOptionGroup(%currentActionMap);
|
||||||
%controlsList.add(%actionMapGroupEntry);
|
%controlsList.add(%actionMapGroupEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( %i = 0; %i < $RemapCount; %i++ )
|
||||||
|
{
|
||||||
|
if(%device !$= "" && %device !$= $RemapDevice[%i])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
%actionMapName = $RemapActionMap[%i].humanReadableName $= "" ? $RemapActionMap[%i].getName() : $RemapActionMap[%i].humanReadableName;
|
||||||
|
|
||||||
|
if(%currentActionMap !$= %actionMapName)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
%keyMap = buildFullMapString( %i, $RemapActionMap[%i], %device );
|
||||||
|
|
||||||
|
%description = $RemapDescription[%i];
|
||||||
|
|
||||||
for ( %i = 0; %i < $RemapCount; %i++ )
|
%remapEntry = addActionMapEntry(%actionMapName, %device, %keyMap, %i, %description);
|
||||||
{
|
%controlsList.add(%remapEntry);
|
||||||
if(%device !$= "" && %device !$= $RemapDevice[%i])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
%actionMapName = $RemapActionMap[%i].humanReadableName $= "" ? $RemapActionMap[%i].getName() : $RemapActionMap[%i].humanReadableName;
|
|
||||||
|
|
||||||
if(%currentActionMap !$= %actionMapName)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
%keyMap = buildFullMapString( %i, $RemapActionMap[%i], %device );
|
|
||||||
|
|
||||||
%description = $RemapDescription[%i];
|
|
||||||
|
|
||||||
%remapEntry = addActionMapEntry(%actionMapName, %device, %keyMap, %i, %description);
|
|
||||||
%controlsList.add(%remapEntry);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -627,6 +649,20 @@ function tryCloseOptionsMenu(%val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function tryApplyOptions(%val)
|
||||||
|
{
|
||||||
|
if(!%val)
|
||||||
|
return;
|
||||||
|
|
||||||
|
$optionsChangeRequiresRestart = false;
|
||||||
|
|
||||||
|
%unappliedVideoChanges = VideoSettingsList.checkForUnappliedChanges();
|
||||||
|
%unappliedAudioChanges = AudioSettingsList.checkForUnappliedChanges();
|
||||||
|
|
||||||
|
if(%unappliedVideoChanges || %unappliedAudioChanges)
|
||||||
|
OptionsMenu.applyChangedOptions();
|
||||||
|
}
|
||||||
|
|
||||||
function OptionsMenu::applyChangedOptions(%this)
|
function OptionsMenu::applyChangedOptions(%this)
|
||||||
{
|
{
|
||||||
VideoSettingsList.applyChanges();
|
VideoSettingsList.applyChanges();
|
||||||
|
|
@ -650,14 +686,13 @@ function OptionsMenu::applyChangedOptions(%this)
|
||||||
|
|
||||||
function doKeyRemap( %optionEntry )
|
function doKeyRemap( %optionEntry )
|
||||||
{
|
{
|
||||||
//%rowIndex = %row.remapIndex;
|
|
||||||
//%name = $RemapName[%rowIndex];
|
|
||||||
|
|
||||||
%name = getField(%optionEntry.keymap,0);
|
%name = getField(%optionEntry.keymap,0);
|
||||||
|
|
||||||
RemapDlg-->OptRemapText.text = "Re-bind \"" @ %name @ "\" to..." ;
|
RemapDlg-->OptRemapText.text = "Re-bind \"" @ %name @ "\" to..." ;
|
||||||
OptRemapInputCtrl.index = %optionEntry.remapIndex;
|
OptRemapInputCtrl.index = %optionEntry.remapIndex;
|
||||||
|
|
||||||
|
$remapListDevice = %optionEntry.device;
|
||||||
|
|
||||||
Canvas.pushDialog( RemapDlg );
|
Canvas.pushDialog( RemapDlg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ $guiContent = new GuiControl(RemapDlg) {
|
||||||
vertSizing = "height";
|
vertSizing = "height";
|
||||||
profile = "GuiInputCtrlProfile";
|
profile = "GuiInputCtrlProfile";
|
||||||
tooltipProfile = "GuiToolTipProfile";
|
tooltipProfile = "GuiToolTipProfile";
|
||||||
|
sendAxisEvents = "1";
|
||||||
};
|
};
|
||||||
new GuiControl(RemapBoxCtrl) {
|
new GuiControl(RemapBoxCtrl) {
|
||||||
position = "-1 1";
|
position = "-1 1";
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,36 @@
|
||||||
|
function OptRemapInputCtrl::onAxisEvent( %this, %device, %action, %axisVal)
|
||||||
|
{
|
||||||
|
if(%device $= "mouse")
|
||||||
|
return;
|
||||||
|
if(!startsWith(%device,$remapListDevice))
|
||||||
|
return;
|
||||||
|
if(%axisVal != 1 && %axisVal != -1) //we want full presses on sticks to be sure
|
||||||
|
return;
|
||||||
|
|
||||||
|
Canvas.popDialog( RemapDlg );
|
||||||
|
|
||||||
|
%this.doRemap(%device, %action, %axisVal);
|
||||||
|
}
|
||||||
|
|
||||||
function OptRemapInputCtrl::onInputEvent( %this, %device, %action )
|
function OptRemapInputCtrl::onInputEvent( %this, %device, %action )
|
||||||
{
|
{
|
||||||
Canvas.popDialog( RemapDlg );
|
if(!startsWith(%device,$remapListDevice) && %action !$= "escape" && %action !$= "btn_start")
|
||||||
|
{
|
||||||
if ( %device $= "keyboard" && %action $= "escape" )
|
return;
|
||||||
return;
|
}
|
||||||
else if( %device $= "gamepad" && %action $= "btn_start" )
|
else
|
||||||
|
{
|
||||||
|
Canvas.popDialog( RemapDlg );
|
||||||
|
|
||||||
|
if(%action $= "escape" || %action $= "btn_start")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
%this.doRemap(%device, %action, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function OptRemapInputCtrl::doRemap(%this, %device, %action, %axisVal)
|
||||||
|
{
|
||||||
%cmd = $RemapCmd[%this.index];
|
%cmd = $RemapCmd[%this.index];
|
||||||
%name = $RemapName[%this.index];
|
%name = $RemapName[%this.index];
|
||||||
%actionMap = $RemapActionMap[%this.index];
|
%actionMap = $RemapActionMap[%this.index];
|
||||||
|
|
@ -21,32 +45,24 @@ function OptRemapInputCtrl::onInputEvent( %this, %device, %action )
|
||||||
%prevMap = %actionMap.getCommand( %device, %action );
|
%prevMap = %actionMap.getCommand( %device, %action );
|
||||||
|
|
||||||
//TODO: clear all existant keybinds to a command and then bind it so we only have a single one at all times
|
//TODO: clear all existant keybinds to a command and then bind it so we only have a single one at all times
|
||||||
unbindExtraActions( %cmd, %actionMap, 0 );
|
unbindExtraActions( %cmd, %actionMap, %device, 0 );
|
||||||
unbindExtraActions( %cmd, %actionMap, 1 );
|
unbindExtraActions( %cmd, %actionMap, %device, 1 );
|
||||||
|
|
||||||
// If nothing was mapped to the previous command
|
// If nothing was mapped to the previous command
|
||||||
// mapping then it's easy... just bind it.
|
// mapping then it's easy... just bind it.
|
||||||
if ( %prevMap $= "" )
|
// If the previous command is the same as the
|
||||||
|
// current then they hit the same input as what
|
||||||
|
// was already assigned.
|
||||||
|
if ( %prevMap $= "" || %prevMap $= %cmd )
|
||||||
{
|
{
|
||||||
//unbindExtraActions( %cmd, %actionMap, 1 );
|
//unbindExtraActions( %cmd, %actionMap, 1 );
|
||||||
%actionMap.bind( %device, %action, %cmd );
|
%actionMap.bind( %device, %action, %cmd );
|
||||||
|
|
||||||
OptionsMenu.syncGui();
|
OptionsMenu.populateKBMControls();
|
||||||
|
OptionsMenu.populateGamepadControls();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the previous command is the same as the
|
|
||||||
// current then they hit the same input as what
|
|
||||||
// was already assigned.
|
|
||||||
if ( %prevMap $= %cmd )
|
|
||||||
{
|
|
||||||
//unbindExtraActions( %cmd, %actionMap, 0 );
|
|
||||||
%actionMap.bind( %device, %action, %cmd );
|
|
||||||
|
|
||||||
OptionsMenu.syncGui();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Look for the index of the previous mapping.
|
// Look for the index of the previous mapping.
|
||||||
%prevMapIndex = findRemapCmdIndex( %prevMap );
|
%prevMapIndex = findRemapCmdIndex( %prevMap );
|
||||||
|
|
||||||
|
|
@ -73,5 +89,24 @@ function OptRemapInputCtrl::onInputEvent( %this, %device, %action )
|
||||||
%cmd @ "\", " @ %prevMapIndex @ ", " @ %this.index @ ");";
|
%cmd @ "\", " @ %prevMapIndex @ ", " @ %this.index @ ");";
|
||||||
%cancelCommand = "";
|
%cancelCommand = "";
|
||||||
|
|
||||||
MessageBoxYesNo( "Key already in use", %remapWarnText, %doRemapCommand, %cancelCommand );
|
MessageBoxYesNo( "Key already in use", %remapWarnText, %doRemapCommand, %cancelCommand );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// This unbinds actions beyond %count associated to the
|
||||||
|
/// particular actionMap %commmand.
|
||||||
|
function unbindExtraActions( %command, %actionMap, %device, %count )
|
||||||
|
{
|
||||||
|
%temp = %actionMap.getBinding( %command );
|
||||||
|
if ( %temp $= "" )
|
||||||
|
return;
|
||||||
|
|
||||||
|
%count = getFieldCount( %temp ) - ( %count * 2 );
|
||||||
|
for ( %i = 0; %i < %count; %i += 2 )
|
||||||
|
{
|
||||||
|
%amDevice = getField( %temp, %i + 0 );
|
||||||
|
%action = getField( %temp, %i + 1 );
|
||||||
|
|
||||||
|
if(%device !$= "" || %device $= %amDevice)
|
||||||
|
%actionMap.unbind( %device, %action );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -225,23 +225,6 @@ function findRemapCmdIndex( %command )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This unbinds actions beyond %count associated to the
|
|
||||||
/// particular actionMap %commmand.
|
|
||||||
function unbindExtraActions( %command, %actionMap, %count )
|
|
||||||
{
|
|
||||||
%temp = %actionMap.getBinding( %command );
|
|
||||||
if ( %temp $= "" )
|
|
||||||
return;
|
|
||||||
|
|
||||||
%count = getFieldCount( %temp ) - ( %count * 2 );
|
|
||||||
for ( %i = 0; %i < %count; %i += 2 )
|
|
||||||
{
|
|
||||||
%device = getField( %temp, %i + 0 );
|
|
||||||
%action = getField( %temp, %i + 1 );
|
|
||||||
|
|
||||||
%actionMap.unbind( %device, %action );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function redoMapping( %device, %actionMap, %action, %cmd, %oldIndex, %newIndex )
|
function redoMapping( %device, %actionMap, %action, %cmd, %oldIndex, %newIndex )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue