Adds function to better report active device type from GFXDevice

Ensures Window title and options menu correctly displays available and active render api
Fixes AA option so it correctly toggles FXAA
This commit is contained in:
Areloch 2020-12-12 23:04:50 -06:00
parent 196e80b9da
commit 334cd1d205
3 changed files with 46 additions and 8 deletions

View file

@ -196,7 +196,32 @@ function OptionsMenu::populateDisplaySettingsList(%this)
OptionName.setText("");
OptionDescription.setText("");
OptionsMenuSettingsList.addOptionRow("Display API", "D3D11\tOpenGL", false, "", -1, -30, true, "The display API used for rendering.", $pref::Video::displayDevice);
//First, lets double-check the active device is accurate. Sometimes the default value in our prefs doesn't match the active one
%displayDevice = getDisplayDeviceType();
if($changingDisplayDevice !$= "")
%displayDevice = $changingDisplayDevice;
%apiList = "";
%apiCount = GFXInit::getAdapterCount();
%apiIdx = 0;
for(%i=0; %i < %apiCount; %i++)
{
%api = GFXInit::getAdapterType(%i);
if(%api !$= "NullDevice")
{
if(%apiIdx==0)
%apiList = %api;
else
%apiList = %apiList TAB %api;
%apiIdx++;
}
}
trim(%apiList);
OptionsMenuSettingsList.addOptionRow("Display API", %apiList, false, "", -1, -30, true, "The display API used for rendering.", %displayDevice);
%numDevices = Canvas.getMonitorCount();
%devicesList = "";
@ -246,7 +271,7 @@ function OptionsMenu::populateDisplaySettingsList(%this)
function OptionsMenu::applyDisplaySettings(%this)
{
%newDevice = OptionsMenuSettingsList.getCurrentOption(0);
%newDevice = OptionsMenuSettingsList.getCurrentOption(0);
// Change the device.
if ( %newDevice !$= $pref::Video::displayDevice )
@ -257,6 +282,8 @@ function OptionsMenu::applyDisplaySettings(%this)
$pref::Video::displayDevice = %newDevice;
if( %newAdapter !$= getDisplayDeviceInformation() )
MessageBoxOK( "Change requires restart", "Please restart the game for a display device change to take effect." );
$changingDisplayDevice = %newDevice;
}
updateDisplaySettings();