Fixed: Only display VR page in game config if compiled with a VR SDK

This commit is contained in:
kervala 2015-12-01 15:58:45 +01:00
parent c342776812
commit 4d67f9a64f
6 changed files with 40 additions and 0 deletions

View file

@ -58,6 +58,7 @@ IF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
ENDIF(NOT LIBOVR_FIND_QUIETLY)
SET(LIBOVR_FOUND "YES")
SET(LIBOVR_DEFINITIONS "-DHAVE_LIBOVR")
SET(NL_STEREO_AVAILABLE ON)
IF(UNIX)
SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY} X11 Xinerama udev pthread)
ELSE(UNIX)

View file

@ -25,6 +25,7 @@ IF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
ENDIF(NOT LIBVR_FIND_QUIETLY)
SET(LIBVR_FOUND "YES")
SET(LIBVR_DEFINITIONS "-DHAVE_LIBVR")
SET(NL_STEREO_AVAILABLE ON)
ELSE(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
IF(NOT LIBVR_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find LibVR!")

View file

@ -10,6 +10,8 @@
#cmakedefine NL_DSOUND_AVAILABLE ${NL_DSOUND_AVAILABLE}
#cmakedefine NL_XAUDIO2_AVAILABLE ${NL_XAUDIO2_AVAILABLE}
#cmakedefine NL_STEREO_AVAILABLE ${NL_STEREO_AVAILABLE}
#cmakedefine NL_BIN_PREFIX "${NL_BIN_ABSOLUTE_PREFIX}"
#cmakedefine NL_ETC_PREFIX "${NL_ETC_ABSOLUTE_PREFIX}"
#cmakedefine NL_SHARE_PREFIX "${NL_SHARE_ABSOLUTE_PREFIX}"

View file

@ -65,6 +65,7 @@
#include "../far_tp.h"
#include "nel/gui/interface_link.h"
#include "../npc_icon.h"
#include "user_agent.h"
// Game Share
#include "game_share/character_summary.h"
@ -2911,6 +2912,7 @@ REGISTER_ACTION_HANDLER (CHandlerToggleInventory, "toggle_inventory");
// ***************************************************************************
#define GAME_CONFIG_DDX "ui:interface:game_config:content:all"
#define GAME_CONFIG_TREE_LIST "ui:interface:game_config:content:sbtree:tree_list"
static vector<UDriver::CMode> VideoModes;
#define GAME_CONFIG_VIDEO_MODES_COMBO "ui:interface:game_config:content:general:video_modes"
@ -3085,6 +3087,29 @@ public:
}
// **** Init Language : look in game_config.lua
// display or not VR page
NLGUI::CGroupTree* configTree = dynamic_cast<CGroupTree*>(CWidgetManager::getInstance()->getElementFromId(GAME_CONFIG_TREE_LIST));
if (configTree)
{
CGroupTree::SNode *rootNode = configTree->getRootNode();
if (rootNode)
{
CGroupTree::SNode *graphNode = rootNode->getNodeFromId("graph");
if (graphNode)
{
CGroupTree::SNode *vrNode = graphNode->getNodeFromId("vr");
if (vrNode)
{
vrNode->setShow(isStereoAvailable());
}
}
}
}
}
};
REGISTER_ACTION_HANDLER (CHandlerGameConfigInit, "game_config_init");

View file

@ -105,3 +105,12 @@ std::string getDebugVersion()
return s_version;
}
bool isStereoAvailable()
{
#ifdef NL_STEREO_AVAILABLE
return true;
#else
return false;
#endif
}

View file

@ -25,6 +25,8 @@ std::string getVersion();
std::string getDisplayVersion();
std::string getDebugVersion();
bool isStereoAvailable();
#endif // CL_USER_AGENT_H
/* End of user_agent.h */