Cleanup vr config interface
This commit is contained in:
parent
c26a06b79e
commit
af51bdbc7a
3 changed files with 84 additions and 36 deletions
|
@ -2762,12 +2762,37 @@
|
||||||
x="0"
|
x="0"
|
||||||
y="0"
|
y="0"
|
||||||
hardtext="uiVRGeneral" />
|
hardtext="uiVRGeneral" />
|
||||||
<instance template="tgcw_checkbox"
|
<group id="enabler"
|
||||||
id="enabler"
|
posref="TL TL"
|
||||||
text="uiVREnable"
|
x="0"
|
||||||
posref="TL TL"
|
y="-16"
|
||||||
x="0"
|
child_resize_w="true"
|
||||||
y="-16" />
|
h="14">
|
||||||
|
<ctrl type="button"
|
||||||
|
id="c"
|
||||||
|
button_type="toggle_button"
|
||||||
|
posref="TL TL"
|
||||||
|
x="0"
|
||||||
|
y="0"
|
||||||
|
tx_normal="w_slot_on.tga"
|
||||||
|
tx_pushed="w_opacity_on.tga"
|
||||||
|
tx_over="w_slot_on.tga"
|
||||||
|
color="255 255 255 255"
|
||||||
|
col_pushed="255 255 255 255"
|
||||||
|
col_over="255 255 255 0"
|
||||||
|
onclick_l="game_config_change_vr_enable"
|
||||||
|
params_l="" />
|
||||||
|
<view type="text"
|
||||||
|
id="text"
|
||||||
|
posparent="c"
|
||||||
|
posref="MR ML"
|
||||||
|
x="4"
|
||||||
|
y="-2"
|
||||||
|
color="255 255 255 192"
|
||||||
|
fontsize="12"
|
||||||
|
shadow="true"
|
||||||
|
hardtext="uiVREnable" />
|
||||||
|
</group>
|
||||||
<group type="combo_box"
|
<group type="combo_box"
|
||||||
id="vr_devices"
|
id="vr_devices"
|
||||||
sizeparent="parent"
|
sizeparent="parent"
|
||||||
|
@ -3767,11 +3792,6 @@
|
||||||
widget="sbfloat"
|
widget="sbfloat"
|
||||||
link="RotKeySpeedMin"
|
link="RotKeySpeedMin"
|
||||||
realtime="true" />
|
realtime="true" />
|
||||||
<param ui="vr:enabler:c"
|
|
||||||
type="cfg"
|
|
||||||
widget="boolbut"
|
|
||||||
link="VREnable"
|
|
||||||
realtime="true" />
|
|
||||||
<param ui="sound:enabler:c"
|
<param ui="sound:enabler:c"
|
||||||
type="cfg"
|
type="cfg"
|
||||||
widget="boolbut"
|
widget="boolbut"
|
||||||
|
|
|
@ -2922,6 +2922,7 @@ static vector<UDriver::CMode> VideoModes;
|
||||||
#define GAME_CONFIG_VIDEO_DEPTH_REQ 32
|
#define GAME_CONFIG_VIDEO_DEPTH_REQ 32
|
||||||
|
|
||||||
// VR_CONFIG
|
// VR_CONFIG
|
||||||
|
#define GAME_CONFIG_VR_ENABLE_BUTTON "ui:interface:game_config:content:vr:enabler:c"
|
||||||
#define GAME_CONFIG_VR_DEVICES_COMBO "ui:interface:game_config:content:vr:vr_devices"
|
#define GAME_CONFIG_VR_DEVICES_COMBO "ui:interface:game_config:content:vr:vr_devices"
|
||||||
#define GAME_CONFIG_VR_DEVICE_DB "UI:TEMP:VR_DEVICE"
|
#define GAME_CONFIG_VR_DEVICE_DB "UI:TEMP:VR_DEVICE"
|
||||||
|
|
||||||
|
@ -2934,7 +2935,7 @@ enum TTextureMode {LowTextureMode= 0, NormalTextureMode= 1, HighTextureMode= 2};
|
||||||
|
|
||||||
void cacheStereoDisplayDevices(); // from init.cpp
|
void cacheStereoDisplayDevices(); // from init.cpp
|
||||||
|
|
||||||
void updateVRDevicesComboUI()
|
void updateVRDevicesComboUI(bool enable)
|
||||||
{
|
{
|
||||||
// VR_CONFIG
|
// VR_CONFIG
|
||||||
nldebug("Init VR device name list from cache into UI");
|
nldebug("Init VR device name list from cache into UI");
|
||||||
|
@ -2942,8 +2943,8 @@ void updateVRDevicesComboUI()
|
||||||
CDBGroupComboBox *pCB = dynamic_cast<CDBGroupComboBox*>(CWidgetManager::getInstance()->getElementFromId(GAME_CONFIG_VR_DEVICES_COMBO));
|
CDBGroupComboBox *pCB = dynamic_cast<CDBGroupComboBox*>(CWidgetManager::getInstance()->getElementFromId(GAME_CONFIG_VR_DEVICES_COMBO));
|
||||||
if (pCB)
|
if (pCB)
|
||||||
{
|
{
|
||||||
pCB->setActive(ClientCfg.VREnable);
|
pCB->setActive(enable);
|
||||||
if (ClientCfg.VREnable)
|
if (enable)
|
||||||
{
|
{
|
||||||
nldebug("pCB ok");
|
nldebug("pCB ok");
|
||||||
cacheStereoDisplayDevices();
|
cacheStereoDisplayDevices();
|
||||||
|
@ -3026,7 +3027,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// VR_CONFIG
|
// VR_CONFIG
|
||||||
updateVRDevicesComboUI();
|
pBut = dynamic_cast<CCtrlBaseButton*>(CWidgetManager::getInstance()->getElementFromId(GAME_CONFIG_VR_ENABLE_BUTTON));
|
||||||
|
if (pBut)
|
||||||
|
{
|
||||||
|
pBut->setPushed(ClientCfg.VREnable);
|
||||||
|
}
|
||||||
|
updateVRDevicesComboUI(ClientCfg.VREnable);
|
||||||
|
|
||||||
// init the mode in DB
|
// init the mode in DB
|
||||||
TTextureMode texMode;
|
TTextureMode texMode;
|
||||||
|
@ -3257,6 +3263,31 @@ class CHandlerGameConfigFullscreen : public IActionHandler
|
||||||
};
|
};
|
||||||
REGISTER_ACTION_HANDLER (CHandlerGameConfigFullscreen, "game_config_change_vid_fullscreen");
|
REGISTER_ACTION_HANDLER (CHandlerGameConfigFullscreen, "game_config_change_vid_fullscreen");
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
class CHandlerGameConfigVREnable : public IActionHandler
|
||||||
|
{
|
||||||
|
virtual void execute (CCtrlBase *pCaller, const string &/* Params */)
|
||||||
|
{
|
||||||
|
// VR_CONFIG
|
||||||
|
|
||||||
|
CCtrlBaseButton *pBut = dynamic_cast<CCtrlBaseButton*>(CWidgetManager::getInstance()->getElementFromId(GAME_CONFIG_VR_ENABLE_BUTTON));
|
||||||
|
if (pBut)
|
||||||
|
{
|
||||||
|
// hide or show device list depending on enabled or not
|
||||||
|
updateVRDevicesComboUI(pBut->getPushed());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pCaller)
|
||||||
|
{
|
||||||
|
CDDXManager *pDM = CDDXManager::getInstance();
|
||||||
|
CInterfaceDDX *pDDX = pDM->get(GAME_CONFIG_DDX);
|
||||||
|
if(pDDX)
|
||||||
|
pDDX->validateApplyButton();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
REGISTER_ACTION_HANDLER (CHandlerGameConfigVREnable, "game_config_change_vr_enable");
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
class CHandlerGameConfigVRDevice : public IActionHandler
|
class CHandlerGameConfigVRDevice : public IActionHandler
|
||||||
{
|
{
|
||||||
|
@ -3373,6 +3404,13 @@ class CHandlerGameConfigApply : public IActionHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CCtrlBaseButton *pBut = dynamic_cast<CCtrlBaseButton*>(CWidgetManager::getInstance()->getElementFromId(GAME_CONFIG_VR_ENABLE_BUTTON));
|
||||||
|
if (pBut)
|
||||||
|
{
|
||||||
|
// store the new config variables
|
||||||
|
ClientCfg.VREnable = pBut->getPushed();
|
||||||
|
ClientCfg.writeBool("VREnable", pBut->getPushed());
|
||||||
|
}
|
||||||
if (ClientCfg.VREnable)
|
if (ClientCfg.VREnable)
|
||||||
{
|
{
|
||||||
// store the new config variables
|
// store the new config variables
|
||||||
|
|
|
@ -49,6 +49,17 @@ void updateFromClientCfg()
|
||||||
{
|
{
|
||||||
CClientConfig::setValues();
|
CClientConfig::setValues();
|
||||||
ClientCfg.IsInvalidated = false;
|
ClientCfg.IsInvalidated = false;
|
||||||
|
|
||||||
|
if ((ClientCfg.VREnable != LastClientCfg.VREnable)
|
||||||
|
|| (ClientCfg.VREnable && (
|
||||||
|
ClientCfg.VRDisplayDevice != LastClientCfg.VRDisplayDevice
|
||||||
|
|| ClientCfg.VRDisplayDeviceId != LastClientCfg.VRDisplayDeviceId
|
||||||
|
)))
|
||||||
|
{
|
||||||
|
nldebug("Apply VR device change");
|
||||||
|
releaseStereoDisplayDevice();
|
||||||
|
initStereoDisplayDevice();
|
||||||
|
}
|
||||||
|
|
||||||
// GRAPHICS - GENERAL
|
// GRAPHICS - GENERAL
|
||||||
//---------------------------------------------------
|
//---------------------------------------------------
|
||||||
|
@ -79,27 +90,6 @@ void updateFromClientCfg()
|
||||||
Driver->setSwapVBLInterval(0);
|
Driver->setSwapVBLInterval(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ClientCfg.VREnable != LastClientCfg.VREnable)
|
|
||||||
{
|
|
||||||
// VR_CONFIG
|
|
||||||
|
|
||||||
// switch visibility of list & reload
|
|
||||||
updateVRDevicesComboUI();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (((StereoDisplay != NULL) != ClientCfg.VREnable)
|
|
||||||
|| (ClientCfg.VREnable && (
|
|
||||||
ClientCfg.VRDisplayDevice != LastClientCfg.VRDisplayDevice
|
|
||||||
|| ClientCfg.VRDisplayDeviceId != LastClientCfg.VRDisplayDeviceId
|
|
||||||
)))
|
|
||||||
{
|
|
||||||
nldebug("Apply VR device change");
|
|
||||||
releaseStereoDisplayDevice();
|
|
||||||
initStereoDisplayDevice();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GRAPHICS - LANDSCAPE
|
// GRAPHICS - LANDSCAPE
|
||||||
//---------------------------------------------------
|
//---------------------------------------------------
|
||||||
if (ClientCfg.LandscapeThreshold != LastClientCfg.LandscapeThreshold)
|
if (ClientCfg.LandscapeThreshold != LastClientCfg.LandscapeThreshold)
|
||||||
|
|
Loading…
Reference in a new issue