OSGHUD: Fix for toggling the visibility status of all widgets at once:
- only previously visible widgets will be restored - the all hidden status is NOT saved to disk git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@7800 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 7d890e27b2e557c09ee20370999187f21cde8311 Former-commit-id: f505f70968aebb6105de845eb672fd02d93af489
This commit is contained in:
parent
b0602c747c
commit
24c75cd444
1 changed files with 39 additions and 10 deletions
|
@ -68,6 +68,9 @@ static osg::Vec4 colorCyan(0.31, 0.968, 0.933, 1.0);
|
||||||
float prevSteerAngle = 0.0f;
|
float prevSteerAngle = 0.0f;
|
||||||
|
|
||||||
std::map<std::string,osgText::Text* > hudTextElements;
|
std::map<std::string,osgText::Text* > hudTextElements;
|
||||||
|
std::map<std::string,int> hudElementsVisibilityStatus;
|
||||||
|
int hudElementsVisibilityStatusEnabled = 1;
|
||||||
|
|
||||||
|
|
||||||
osg::Vec3 calculatePosition(osg::BoundingBox mybb, const std::string &objPoint,
|
osg::Vec3 calculatePosition(osg::BoundingBox mybb, const std::string &objPoint,
|
||||||
osg::BoundingBox bb, const std::string &referenceObjPoint,
|
osg::BoundingBox bb, const std::string &referenceObjPoint,
|
||||||
|
@ -1212,16 +1215,42 @@ void SDHUD::Refresh(tSituation *s, const SDFrameInfo* frameInfo,
|
||||||
|
|
||||||
void SDHUD::ToggleHUD()
|
void SDHUD::ToggleHUD()
|
||||||
{
|
{
|
||||||
this->hudWidgets["boardWidget"]->setNodeMask(0);
|
if (hudElementsVisibilityStatusEnabled > 0){
|
||||||
this->hudWidgets["racepositionWidget"]->setNodeMask(0);
|
hudElementsVisibilityStatus["boardWidget"] = (int)this->hudWidgets["boardWidget"]->getNodeMask();
|
||||||
this->hudWidgets["racelapsWidget"]->setNodeMask(0);
|
hudElementsVisibilityStatus["racepositionWidget"] = (int)this->hudWidgets["racepositionWidget"]->getNodeMask();
|
||||||
this->hudWidgets["laptimeWidget"]->setNodeMask(0);
|
hudElementsVisibilityStatus["racelapsWidget"] = (int)this->hudWidgets["racelapsWidget"]->getNodeMask();
|
||||||
this->hudWidgets["carinfoWidget"]->setNodeMask(0);
|
hudElementsVisibilityStatus["laptimeWidget"] = (int)this->hudWidgets["laptimeWidget"]->getNodeMask();
|
||||||
this->hudWidgets["carstatusWidget"]->setNodeMask(0);
|
hudElementsVisibilityStatus["carinfoWidget"] = (int)this->hudWidgets["carinfoWidget"]->getNodeMask();
|
||||||
this->hudWidgets["driverinputWidget"]->setNodeMask(0);
|
hudElementsVisibilityStatus["carstatusWidget"] = (int)this->hudWidgets["carstatusWidget"]->getNodeMask();
|
||||||
this->hudImgRotableElements["driverinput-wheel"]->setNodeMask(0);
|
hudElementsVisibilityStatus["driverinputWidget"] = (int)this->hudWidgets["driverinputWidget"]->getNodeMask();
|
||||||
this->hudWidgets["debugWidget"]->setNodeMask(0);
|
hudElementsVisibilityStatus["driverinput-wheel"] = (int)this->hudImgRotableElements["driverinput-wheel"]->getNodeMask();
|
||||||
this->hudWidgets["dashitemsWidget"]->setNodeMask(0);
|
hudElementsVisibilityStatus["debugWidget"] = (int)this->hudWidgets["debugWidget"]->getNodeMask();
|
||||||
|
hudElementsVisibilityStatus["dashitemsWidget"] = (int)this->hudWidgets["dashitemsWidget"]->getNodeMask();
|
||||||
|
|
||||||
|
this->hudWidgets["boardWidget"]->setNodeMask(0);
|
||||||
|
this->hudWidgets["racepositionWidget"]->setNodeMask(0);
|
||||||
|
this->hudWidgets["racelapsWidget"]->setNodeMask(0);
|
||||||
|
this->hudWidgets["laptimeWidget"]->setNodeMask(0);
|
||||||
|
this->hudWidgets["carinfoWidget"]->setNodeMask(0);
|
||||||
|
this->hudWidgets["carstatusWidget"]->setNodeMask(0);
|
||||||
|
this->hudWidgets["driverinputWidget"]->setNodeMask(0);
|
||||||
|
this->hudImgRotableElements["driverinput-wheel"]->setNodeMask(0);
|
||||||
|
this->hudWidgets["debugWidget"]->setNodeMask(0);
|
||||||
|
this->hudWidgets["dashitemsWidget"]->setNodeMask(0);
|
||||||
|
hudElementsVisibilityStatusEnabled = 0;
|
||||||
|
}else{
|
||||||
|
this->hudWidgets["boardWidget"]->setNodeMask(hudElementsVisibilityStatus["boardWidget"]);
|
||||||
|
this->hudWidgets["racepositionWidget"]->setNodeMask(hudElementsVisibilityStatus["racepositionWidget"]);
|
||||||
|
this->hudWidgets["racelapsWidget"]->setNodeMask(hudElementsVisibilityStatus["racelapsWidget"]);
|
||||||
|
this->hudWidgets["laptimeWidget"]->setNodeMask(hudElementsVisibilityStatus["laptimeWidget"]);
|
||||||
|
this->hudWidgets["carinfoWidget"]->setNodeMask(hudElementsVisibilityStatus["carinfoWidget"]);
|
||||||
|
this->hudWidgets["carstatusWidget"]->setNodeMask(hudElementsVisibilityStatus["carstatusWidget"]);
|
||||||
|
this->hudWidgets["driverinputWidget"]->setNodeMask(hudElementsVisibilityStatus["driverinputWidget"]);
|
||||||
|
this->hudImgRotableElements["driverinput-wheel"]->setNodeMask(hudElementsVisibilityStatus["driverinput-wheel"]);
|
||||||
|
this->hudWidgets["debugWidget"]->setNodeMask(hudElementsVisibilityStatus["debugWidget"]);
|
||||||
|
this->hudWidgets["dashitemsWidget"]->setNodeMask(hudElementsVisibilityStatus["dashitemsWidget"]);
|
||||||
|
hudElementsVisibilityStatusEnabled = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void SDHUD::ToggleHUDboard()
|
void SDHUD::ToggleHUDboard()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue