• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TRDescription类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TRDescription的典型用法代码示例。如果您正苦于以下问题:C++ TRDescription类的具体用法?C++ TRDescription怎么用?C++ TRDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TRDescription类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SetClassProperties

bool UISliderPlus::SetClassProperties(const TRDescription& inDesc, Panel* inPanel, CSchemeManager* inSchemeManager)
{
	UIPanel::SetClassProperties(inDesc, inPanel, inSchemeManager);
	
	// Read lower and upper limits
	int theLowerValue = 0;
	int theUpperValue = 20;
	
    inDesc.GetTagValue(UILowerValue, theLowerValue);
    inDesc.GetTagValue(UIUpperValue, theUpperValue);
	
	SliderPlus* theSlider = dynamic_cast<SliderPlus*>(inPanel);
	ASSERT(theSlider);
	theSlider->setRange(theLowerValue, theUpperValue);
	
	int theRangeWindow;
	if(inDesc.GetTagValue(UIRangeWindow, theRangeWindow))
	{
		// The range window is in pixels, the lower and upper values are in their own arbitrary scale
		//int theValueRange = theUpperValue - theLowerValue;
		//ASSERT(theRangeWindow < theValueRange);
		//theSlider->setRangeWindowEnabled(true);
		theSlider->setRangeWindow(theRangeWindow);
	}
	
	int theStartingValue;
	if(inDesc.GetTagValue(UIDefaultIntValue, theStartingValue))
	{
		theSlider->setValue(theStartingValue);
	}

	return true;
}
开发者ID:Arkshine,项目名称:NS,代码行数:33,代码来源:UIComponents.cpp


示例2: AllocateComponent

////////////////////////////////////
// AvHLogoutComponent -> StaticLabel //
////////////////////////////////////
void AvHUILogoutComponent::AllocateComponent(const TRDescription& inDesc)
{
    // Width and height (normalized screen coords)
    float theWidth = UIDefaultWidth;
    float theHeight = UIDefaultHeight;
    inDesc.GetTagValue(UITagWidth, theWidth);
    inDesc.GetTagValue(UITagHeight, theHeight);
	
    this->mLogoutComponent = new AvHLogoutComponent(theWidth*ScreenWidth(), theHeight*ScreenHeight());
}
开发者ID:tschumann,项目名称:naturalselection,代码行数:13,代码来源:AvHLogoutComponent.cpp


示例3: AllocateComponent

//////////////////////////
// SpritePanel -> Panel //
//////////////////////////
void UISpritePanel::AllocateComponent(const TRDescription& inDesc)
{
	string theBaseSpriteName;
    inDesc.GetTagValue(UIBaseSprite, theBaseSpriteName);

	string theRenderMode;
    inDesc.GetTagValue(UIRenderMode, theRenderMode);
	
    this->mUISpritePanel = new SpritePanel(theBaseSpriteName, theRenderMode);

	string theVAlignment;
    if(inDesc.GetTagValue(UIVAlignment, theVAlignment))
	{
		this->mUISpritePanel->SetVAlignment(theVAlignment);
	}
}
开发者ID:Arkshine,项目名称:NS,代码行数:19,代码来源:UIComponents.cpp


示例4: SetSchemeValues

// Set up default scheme values if a scheme was specified (overrides other tags specified)
void UIManager::SetSchemeValues(const TRDescription& inDesc, UIComponent* inComponent, CSchemeManager* inSchemeManager)
{
    std::string theSchemeName;
    if(inDesc.GetTagValue(UITagScheme, theSchemeName))
    {
        // Get the vgui panel inside
        Panel* thePanelPointer = inComponent->GetComponentPointer();

        // Get the scheme specified in the layout
        const char* theSchemeCString = theSchemeName.c_str();
        SchemeHandle_t theSchemeHandle = inSchemeManager->getSchemeHandle(theSchemeCString);
        int r, g, b, a;
        
        // Set fg color
        inSchemeManager->getFgColor(theSchemeHandle, r, g, b, a);
        thePanelPointer->setFgColor(r, g, b, a);

        // Set bg color
        inSchemeManager->getBgColor(theSchemeHandle, r, g, b, a);
        thePanelPointer->setBgColor(r, g, b, a);

        // Set font if applicable
    	vgui::Font* theFont = inSchemeManager->getFont(theSchemeHandle);
        vgui::TextPanel* theTextPanel = dynamic_cast<vgui::TextPanel*>(thePanelPointer);
        if(theFont && theTextPanel)
        {
            theTextPanel->setFont(theFont);
        }
    }
}
开发者ID:Arkshine,项目名称:NS,代码行数:31,代码来源:UIManager.cpp


示例5: SetClassProperties

bool AvHUILogoutComponent::SetClassProperties(const TRDescription& inDesc, Panel* inPanel, CSchemeManager* inSchemeManager)
{
    AvHLogoutComponent* theLogoutComponent = (AvHLogoutComponent*)inPanel;
	
    bool theSuccess = UIStaticLabel::SetClassProperties(inDesc, inPanel, inSchemeManager);
    
    if(theSuccess)
    {
		// Get font to use
		std::string theSchemeName;
		if(inDesc.GetTagValue(UITagScheme, theSchemeName))
		{
			const char* theSchemeCString = theSchemeName.c_str();
			SchemeHandle_t theSchemeHandle = inSchemeManager->getSchemeHandle(theSchemeCString);
			Font* theFont = inSchemeManager->getFont(theSchemeHandle);
			if(theFont)
			{
				theLogoutComponent->setFont(theFont);
			}
		}
		theSuccess = true;
	}

	return theSuccess;
}
开发者ID:tschumann,项目名称:naturalselection,代码行数:25,代码来源:AvHLogoutComponent.cpp


示例6: SetClassProperties

bool AvHUIActionButtons::SetClassProperties(const TRDescription& inDesc, Panel* inComponent, CSchemeManager* inSchemeManager)
{
    bool theSuccess = false;
    AvHActionButtons* theActionButtons = dynamic_cast<AvHActionButtons*>(inComponent);
	ASSERT(theActionButtons);

    // read custom attributes here
    UIPanel::SetClassProperties(inDesc, inComponent, inSchemeManager);

    // Get tech font to use
    std::string theSchemeName;
    if(inDesc.GetTagValue(UITagScheme, theSchemeName))
    {
		const char* theSchemeCString = theSchemeName.c_str();
		SchemeHandle_t theSchemeHandle = inSchemeManager->getSchemeHandle(theSchemeCString);
		Font* theFont = inSchemeManager->getFont(theSchemeHandle);
		if(theFont)
		{
			theActionButtons->setFont(theFont);
		}
		
		theSuccess = true;
    }
	
    return theSuccess;
}
开发者ID:Arkshine,项目名称:NS,代码行数:26,代码来源:AvHActionButtons.cpp


示例7: SetClassProperties

bool AvHUITeamHierarchy::SetClassProperties(const TRDescription& inDesc, Panel* inComponent, CSchemeManager* inSchemeManager)
{
    bool theSuccess = false;

    // read custom attributes here
    UIStaticLabel::SetClassProperties(inDesc, inComponent, inSchemeManager);

    // Get font to use
    std::string theSchemeName;
    if(inDesc.GetTagValue(UITagScheme, theSchemeName))
    {
        AvHTeamHierarchy* theHierarchy = dynamic_cast<AvHTeamHierarchy*>(inComponent);
        if(theHierarchy)
        {
            const char* theSchemeCString = theSchemeName.c_str();
            SchemeHandle_t theSchemeHandle = inSchemeManager->getSchemeHandle(theSchemeCString);
        	Font* theFont = inSchemeManager->getFont(theSchemeHandle);
            if(theFont)
            {
                theHierarchy->setFont(theFont);
            }

            theSuccess = true;
        }
    }

    return theSuccess;
}
开发者ID:Arkshine,项目名称:NS,代码行数:28,代码来源:AvHTeamHierarchy.cpp


示例8: readStartBlockLine

// Read start block
// Set the name and type of the description
// Returns false if invalid format
bool TRFactory::readStartBlockLine(const string& inString, TRDescription& outDescription)
{
    bool theSuccess = false;
    char theType[maxLineLength];
    char theName[maxLineLength];

    memset(theType, ' ', maxLineLength);
    memset(theName, ' ', maxLineLength);

    // Read three tokens.  There should be "start" <type> <name>
    if(sscanf(inString.c_str(), "start %s %s", theType, theName) == 2)
    {
        outDescription.SetName(theName);
        outDescription.SetType(theType);
        theSuccess = true;
    }

    return theSuccess;
}
开发者ID:,项目名称:,代码行数:22,代码来源:


示例9: WriteDescription

bool TRFactory::WriteDescription(fstream& outfile, const TRDescription& inDescription)
{
    bool theSuccess = true;

    // Write out the start block
    outfile << "start" << " " << inDescription.GetType() << " " << inDescription.GetName() << std::endl;

    // Write out the property tags
    TRDescription::const_iterator theIter;
    for(theIter = inDescription.begin(); theIter != inDescription.end(); theIter++)
    {
        outfile << "    " << theIter->first << " = " << theIter->second << std:: endl;
    }

    // Write out the end block.
    outfile << "end" << std::endl;

    return theSuccess;
}
开发者ID:,项目名称:,代码行数:19,代码来源:


示例10: AllocateComponent

void UIPieMenu::AllocateComponent(const TRDescription& inDesc)
{
    float theXPos, theYPos;
    int theWidth, theHeight;
    string theImageName("default");

    UIGetPosition(inDesc, theXPos, theYPos, theWidth, theHeight);

    string theRootName;
    inDesc.GetTagValue(UIRootName, theRootName);

    this->mPieMenu = new PieMenu(theRootName, theXPos*ScreenWidth(), theYPos*ScreenHeight(), theWidth*ScreenWidth(), theHeight*ScreenHeight());
}
开发者ID:Arkshine,项目名称:NS,代码行数:13,代码来源:UIPieMenu.cpp


示例11: readTagAndValueLine

bool TRFactory::readTagAndValueLine(const string& inString, TRDescription& outDescription)
{
    bool theSuccess = false;
    char theTag[maxLineLength];
    char theValue[maxLineLength];

    // Zero them out
    memset(theTag, ' ', maxLineLength);
    memset(theValue, ' ', maxLineLength);

    if((sscanf(inString.c_str(), "%s = %s", theTag, theValue)) == 2)
    {
        // Add it
        TRTagValuePair thePair(theTag, theValue);
        outDescription.AddPair(thePair);
        theSuccess = true;
    }

    return theSuccess;
}
开发者ID:,项目名称:,代码行数:20,代码来源:


示例12: SetClassProperties

// Not virtual, this is meant to act only on the class specified.  Operate on panel because that is
// the lowest level of hierarchy (not that we're going to do anything with it anyways)
bool UIPieMenu::SetClassProperties(const TRDescription& inDesc, Panel* inComponent, CSchemeManager* inSchemeManager)
{
    bool theSuccess;

    // Let parent classes go first
    theSuccess = UIPanel::SetClassProperties(inDesc, inComponent, inSchemeManager);

    if(theSuccess)
    {
        // Dynamic_cast inComponent to an PieMenu (will always succeed)
        PieMenu* thePieMenu = (PieMenu*)inComponent;

        // Read font if specified
        std::string theSchemeName;
        if(inDesc.GetTagValue(UITagScheme, theSchemeName))
        {
            if(thePieMenu)
            {
                const char* theSchemeCString = theSchemeName.c_str();
                SchemeHandle_t theSchemeHandle = inSchemeManager->getSchemeHandle(theSchemeCString);
                Font* theFont = inSchemeManager->getFont(theSchemeHandle);
                if(theFont)
                {
                    thePieMenu->SetFont(theFont);
                    thePieMenu->GetRootNode()->setFont(theFont);
                }
            }
        }

        // Set colors of root node to that of the pie menu
        Color theColor;
        thePieMenu->getFgColor(theColor);
        thePieMenu->GetRootNode()->setFgColor(theColor);

        thePieMenu->getBgColor(theColor);
        thePieMenu->GetRootNode()->setBgColor(theColor);

        // Read node distances
        float theNodeXDistance = 0.0f;
        inDesc.GetTagValue(kPieMenuNodeXDistance, theNodeXDistance);
        float theNodeYDistance = 0.0f;
        inDesc.GetTagValue(kPieMenuNodeYDistance, theNodeYDistance);
        thePieMenu->SetNodeDistance(theNodeXDistance, theNodeYDistance);

        // Set pop-up menu default image
        string theDefaultImage;
        if(inDesc.GetTagValue(kPieMenuDefaultImage, theDefaultImage))
        {
            thePieMenu->SetDefaultImage(theDefaultImage);
        }

        // Read specified image to use
        //string theNodeTargaName;
        //if(inDesc.GetTagValue(kNodeTarga, theNodeTargaName))
        //{
        //    thePieMenu->SetNodeTargaName(theNodeTargaName);
        //}

        // Now read in the nodes until there are no more.  Assumes first node is root.
        thePieMenu->GetRootNode()->SetSizeKeepCenter(theNodeXDistance*ScreenWidth(), theNodeYDistance*ScreenHeight());

        StringVector theNodeList;
        inDesc.GetTagStringList(kPieMenuNodePrefix, theNodeList);
        for(StringVector::iterator theIter = theNodeList.begin(); theIter != theNodeList.end(); theIter++)
        {
            thePieMenu->AddNode(*theIter);
        }

        // Set the connector, if any
        string theConnectorName;
        if(inDesc.GetTagValue(UIConnectorName, theConnectorName))
        {
            if(theConnectorName != "")
            {
                this->mPieMenu->SetConnectorName(theConnectorName);
            }
        }

        // Now have the piemenu recompute visible size for all nodes
        thePieMenu->RecomputeVisibleSize();

//        for(int i = 0; ; i++)
//        {
//            char theNum[4];
//            sprintf(theNum, "%d", i);
//            string theNodeName(kPieMenuNodePrefix + string(theNum));
//
//            string theNodeString;
//            if(inDesc.GetTagValue(theNodeName, theNodeString))
//            {
//                thePieMenu->AddNode(theNodeString);
//            }
//            else
//            {
//                break;
//            }
//        }

//.........这里部分代码省略.........
开发者ID:Arkshine,项目名称:NS,代码行数:101,代码来源:UIPieMenu.cpp



注:本文中的TRDescription类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TRandom类代码示例发布时间:2022-05-31
下一篇:
C++ TRACK类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap