OSGHUD: add toggling on/off for the dashitemsWidget too
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@7795 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: cd7ca251e1cfd1b21522429566661855bb96df63 Former-commit-id: 3b0e185625cbc759dde3fbe5991480a1f88f8c56
This commit is contained in:
parent
2f038f0047
commit
1601a7ae77
5 changed files with 34 additions and 5 deletions
|
@ -165,6 +165,10 @@ void SDToggleHUDdebug(void *vp)
|
|||
{
|
||||
screens->toggleHUDdebug();
|
||||
}
|
||||
void SDToggleHUDdashitems(void *vp)
|
||||
{
|
||||
screens->toggleHUDdashitems();
|
||||
}
|
||||
|
||||
int initView(int x, int y, int width, int height, int /* flag */, void *screen)
|
||||
{
|
||||
|
@ -205,13 +209,14 @@ int initView(int x, int y, int width, int height, int /* flag */, void *screen)
|
|||
GfuiAddKey(screen, GFUIK_F10, "Follow Car Zoomed", (void*)8, SDSelectCamera, NULL);
|
||||
GfuiAddKey(screen, GFUIK_F11, "TV Director View", (void*)9, SDSelectCamera, NULL);
|
||||
|
||||
GfuiAddKey(screen, '3', "Toggle HUD boardWidget", (void*)0, SDToggleHUDboard, NULL);
|
||||
GfuiAddKey(screen, '8', "Toggle HUD raceinfoWidget", (void*)0, SDToggleHUDraceinfo, NULL);
|
||||
GfuiAddKey(screen, '1', "Toggle HUD laptimeWidget", (void*)0, SDToggleHUDlaptime, NULL);
|
||||
GfuiAddKey(screen, '2', "Toggle HUD carinfoWidget", (void*)0, SDToggleHUDcarinfo, NULL);
|
||||
GfuiAddKey(screen, '6', "Toggle HUD driverinputWidget", (void*)0, SDToggleHUDdriverinput, NULL);
|
||||
GfuiAddKey(screen, '3', "Toggle HUD boardWidget", (void*)0, SDToggleHUDboard, NULL);
|
||||
GfuiAddKey(screen, '4', "Toggle HUD driverinputWidget", (void*)0, SDToggleHUDdriverinput, NULL);
|
||||
GfuiAddKey(screen, '5', "Toggle HUD debugWidget", (void*)0, SDToggleHUDdebug, NULL);
|
||||
GfuiAddKey(screen, '7', "Toggle HUD", (void*)0, SDToggleHUD, NULL);
|
||||
GfuiAddKey(screen, '6', "Toggle HUD dashitemsWidget", (void*)0, SDToggleHUDdashitems, NULL);
|
||||
GfuiAddKey(screen, '7', "Toggle HUD raceinfoWidget", (void*)0, SDToggleHUDraceinfo, NULL);
|
||||
GfuiAddKey(screen, '8', "Toggle HUD", (void*)0, SDToggleHUD, NULL);
|
||||
|
||||
|
||||
/*GfuiAddKey(screen, '5', "Debug Info", (void*)3, grSelectBoard, NULL);
|
||||
|
|
|
@ -1221,6 +1221,7 @@ void SDHUD::ToggleHUD()
|
|||
this->hudWidgets["driverinputWidget"]->setNodeMask(0);
|
||||
this->hudImgRotableElements["driverinput-wheel"]->setNodeMask(0);
|
||||
this->hudWidgets["debugWidget"]->setNodeMask(0);
|
||||
this->hudWidgets["dashitemsWidget"]->setNodeMask(0);
|
||||
}
|
||||
void SDHUD::ToggleHUDboard()
|
||||
{
|
||||
|
@ -1340,6 +1341,24 @@ void SDHUD::ToggleHUDdebug()
|
|||
|
||||
}
|
||||
|
||||
void SDHUD::ToggleHUDdashitems()
|
||||
{
|
||||
//toggle the visibility
|
||||
this->hudWidgets["dashitemsWidget"]->setNodeMask(1 - this->hudWidgets["dashitemsWidget"]->getNodeMask());
|
||||
|
||||
//save the current status in the config file
|
||||
std::string configFileUrl= GetLocalDir();
|
||||
configFileUrl.append("config/osghudconfig.xml");
|
||||
std::string path= "widgets/dashitemsWidget";
|
||||
std::string attribute= "enabled";
|
||||
int value = this->hudWidgets["dashitemsWidget"]->getNodeMask();
|
||||
|
||||
//read the config file, update the value and write it back
|
||||
void *paramHandle = GfParmReadFile(configFileUrl.c_str(), GFPARM_RMODE_STD);
|
||||
GfParmSetNum(paramHandle, path.c_str(), attribute.c_str(), NULL, (int)value);
|
||||
GfParmWriteFile(NULL, paramHandle, "osghudconfig");
|
||||
|
||||
}
|
||||
|
||||
osg::ref_ptr <osg::Group> SDHUD::generateHudFromXmlFile(int scrH, int scrW)
|
||||
{
|
||||
|
|
|
@ -149,6 +149,7 @@ class SDHUD
|
|||
void ToggleHUDcarinfo();
|
||||
void ToggleHUDdriverinput();
|
||||
void ToggleHUDdebug();
|
||||
void ToggleHUDdashitems();
|
||||
|
||||
osg::ref_ptr<osg::Camera> camera;
|
||||
|
||||
|
|
|
@ -251,7 +251,10 @@ void SDScreens::toggleHUDdebug()
|
|||
{
|
||||
hud.ToggleHUDdebug();
|
||||
}
|
||||
|
||||
void SDScreens::toggleHUDdashitems()
|
||||
{
|
||||
hud.ToggleHUDdashitems();
|
||||
}
|
||||
|
||||
void SDScreens::registerViewDependantPreRenderNode(osg::ref_ptr<osg::Node> node)
|
||||
{
|
||||
|
|
|
@ -63,6 +63,7 @@ public:
|
|||
void toggleHUDcarinfo();
|
||||
void toggleHUDdriverinput();
|
||||
void toggleHUDdebug();
|
||||
void toggleHUDdashitems();
|
||||
|
||||
inline SDView * getActiveView(){return Screens[m_CurrentScreenIndex];}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue