mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-24 01:48:44 +00:00
Cleanup vr config interface
--HG-- branch : multipass-stereo
This commit is contained in:
parent
6186da84b2
commit
f6668b3f6f
3 changed files with 84 additions and 36 deletions
|
@ -2762,12 +2762,37 @@
|
|||
x="0"
|
||||
y="0"
|
||||
hardtext="uiVRGeneral" />
|
||||
<instance template="tgcw_checkbox"
|
||||
id="enabler"
|
||||
text="uiVREnable"
|
||||
posref="TL TL"
|
||||
x="0"
|
||||
y="-16" />
|
||||
<group id="enabler"
|
||||
posref="TL TL"
|
||||
x="0"
|
||||
y="-16"
|
||||
child_resize_w="true"
|
||||
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"
|
||||
id="vr_devices"
|
||||
sizeparent="parent"
|
||||
|
@ -3767,11 +3792,6 @@
|
|||
widget="sbfloat"
|
||||
link="RotKeySpeedMin"
|
||||
realtime="true" />
|
||||
<param ui="vr:enabler:c"
|
||||
type="cfg"
|
||||
widget="boolbut"
|
||||
link="VREnable"
|
||||
realtime="true" />
|
||||
<param ui="sound:enabler:c"
|
||||
type="cfg"
|
||||
widget="boolbut"
|
||||
|
|
|
@ -2922,6 +2922,7 @@ static vector<UDriver::CMode> VideoModes;
|
|||
#define GAME_CONFIG_VIDEO_DEPTH_REQ 32
|
||||
|
||||
// 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_DEVICE_DB "UI:TEMP:VR_DEVICE"
|
||||
|
||||
|
@ -2934,7 +2935,7 @@ enum TTextureMode {LowTextureMode= 0, NormalTextureMode= 1, HighTextureMode= 2};
|
|||
|
||||
void cacheStereoDisplayDevices(); // from init.cpp
|
||||
|
||||
void updateVRDevicesComboUI()
|
||||
void updateVRDevicesComboUI(bool enable)
|
||||
{
|
||||
// VR_CONFIG
|
||||
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));
|
||||
if (pCB)
|
||||
{
|
||||
pCB->setActive(ClientCfg.VREnable);
|
||||
if (ClientCfg.VREnable)
|
||||
pCB->setActive(enable);
|
||||
if (enable)
|
||||
{
|
||||
nldebug("pCB ok");
|
||||
cacheStereoDisplayDevices();
|
||||
|
@ -3026,7 +3027,12 @@ public:
|
|||
}
|
||||
|
||||
// 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
|
||||
TTextureMode texMode;
|
||||
|
@ -3257,6 +3263,31 @@ class CHandlerGameConfigFullscreen : public IActionHandler
|
|||
};
|
||||
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
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
// store the new config variables
|
||||
|
|
|
@ -49,6 +49,17 @@ void updateFromClientCfg()
|
|||
{
|
||||
CClientConfig::setValues();
|
||||
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
|
||||
//---------------------------------------------------
|
||||
|
@ -79,27 +90,6 @@ void updateFromClientCfg()
|
|||
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
|
||||
//---------------------------------------------------
|
||||
if (ClientCfg.LandscapeThreshold != LastClientCfg.LandscapeThreshold)
|
||||
|
|
Loading…
Reference in a new issue