当前位置: 首页>>代码示例>>C++>>正文


C++ NamedProperties::Set方法代码示例

本文整理汇总了C++中NamedProperties::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ NamedProperties::Set方法的具体用法?C++ NamedProperties::Set怎么用?C++ NamedProperties::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NamedProperties的用法示例。


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

示例1: FireEventForEachFileFound

///---------------------------------------------------------------------------------
///
///---------------------------------------------------------------------------------
void FireEventForEachFileFound( const std::string& eventToFire, const std::string& directory, const std::string& searchPattern, bool recurseSubfolders )
{
    Strings files;
    EnumerateFiles( directory, searchPattern, files, recurseSubfolders );

    for (std::string& file : files)
    {
        std::string fileWithoutPath = ExtractFileNameFromPath( file );
        std::string fileName = RemoveFileExtension( fileWithoutPath );
        Strings fileNameTokens;
        Tokenize( fileWithoutPath, fileNameTokens, "." );
        std::string fileExtension = "." + fileNameTokens[1];
        std::string relativePath = ConvertBackSlashesToForwardSlashes( file );
        char fullPath[_MAX_PATH];
        _fullpath( fullPath, relativePath.c_str(), _MAX_PATH );
        std::string fullFilePath = ConvertBackSlashesToForwardSlashes( std::string( fullPath ) );

        ConsolePrintf( "File without path:  %s\n File Name: %s\n File Extension: %s\n File Relative: %s\n File Absolute: %s\n", fileWithoutPath.c_str(), fileName.c_str(), fileExtension.c_str(), relativePath.c_str(), fullFilePath.c_str() );

        NamedProperties props;
        props.Set( "FileName", fileWithoutPath );
        props.Set( "FileExtension", fileExtension );
        props.Set( "FileNameWithoutExtension", fileName );
        props.Set( "FileRelativePath", relativePath );
        props.Set( "FileAbsolutePath", fullFilePath );

        FireEvent( eventToFire, props );
    }
}
开发者ID:tbgeorge,项目名称:putty_engine,代码行数:32,代码来源:FileUtilities.cpp

示例2: Update

void BaseWidget::Update(double deltaSeconds) {
	
	//consider, not updating at all if hidden
	
	WidgetStateProperties& currentStateProperties = GetCurrentStateProperties();

	//calls this widget's update event
	std::string updateEventNameStr = "";
	currentStateProperties.GetProperty("updateEvent", updateEventNameStr);
	if (updateEventNameStr != "") {
		NamedProperties updateEventParams;
		updateEventParams.Set("widgetInstance", this);
		updateEventParams.Set("deltaSeconds", deltaSeconds);
		EventSystem::GetInstance().FireEvent(updateEventNameStr, updateEventParams);
	}

	ProcessInput(deltaSeconds);
	
	currentStateProperties.Update(deltaSeconds);

	//optimize: only update if it is rendering, or if it is dirty
	if (!m_isHidden) {
		UpdateRenderComponent(deltaSeconds);
		SetUICollider2DComponent();
	}
}
开发者ID:achen889,项目名称:Warlockery_Engine,代码行数:26,代码来源:BaseWidget.cpp

示例3: GroupWidget

UISystem::UISystem() 
{
	//Read all styles and widgets 

	s_rootWidget = new GroupWidget();

	std::vector<std::string> out_styles;
	FindAllFilesOfType("Data/Styles/", "*", out_styles);

	for (auto it = out_styles.begin(); it != out_styles.end(); ++it) {
		std::string filePath = *it;
		ReadStyleFile(filePath);
	}

	std::vector<std::string> out_widgets;
	FindAllFilesOfType("Data/Widgets/", "*", out_widgets);

	for (auto it = out_widgets.begin(); it != out_widgets.end(); ++it) {
		std::string filePath = *it;
		ReadWidgetFile(filePath);
	}

	WidgetStyle wid;
	NamedProperties defaultProps;
	NamedProperties allProps;

	KeyFrameAnimation<RGBA> animColor;
	animColor.AddAnimationFrameAtParameter(RGBA(50, 255, 50, 255), 0.f);
	//defaultProps.Set("color", animColor);

	KeyFrameAnimation<Vec2> offsetAnim;
	offsetAnim.AddAnimationFrameAtParameter(Vec2(100.f, 500.f), 0.f);
	allProps.Set("offset", offsetAnim);

	KeyFrameAnimation<RGBA> animColor2;
	animColor2.AddAnimationFrameAtParameter(RGBA(255, 0, 0, 255), 0.f);
	allProps.Set("color", animColor2);

	wid.AddProperty(UI_STATE_DEFAULT, defaultProps);
	wid.AddGeneralProperty(allProps);
	WidgetBase* widget = AddStyledWidgetExplicitly("Button", "Default", wid, s_rootWidget);

	std::string name;
	widget->GetPropertyForCurrentState("name", name);

	//ToggleWidgetVisibility(name);
	ToggleWidgetEnabled(name);


}
开发者ID:2bitdreamer,项目名称:SD6_Engine,代码行数:50,代码来源:UISystem.cpp

示例4: ReportXMLDocumentUsage

///-----------------------------------------------------------------------
///
///-----------------------------------------------------------------------
void ReportXMLDocumentUsage( XMLNode& xmlDocumentToReport, const ResourceStream& resourceStream, bool reportUsed )
{
	UNUSED( reportUsed );

	std::vector< XMLNode > unusedElements ;
	GetUnusedElements( xmlDocumentToReport, unusedElements );

	if ( !unusedElements.empty() )
	{
		std::string warningMessage = Stringf( "Unused elements in file: %s\n", resourceStream.GetJazzPath().c_str() );
		for ( std::vector< XMLNode >::iterator xmlNodeIter = unusedElements.begin(); xmlNodeIter != unusedElements.end(); ++xmlNodeIter )
		{
			XMLNode& unusedNode = (*xmlNodeIter);
			int stringSize = 0 ;
			char* nodeString = unusedNode.createXMLString( 1, &stringSize );
			if ( nodeString )
			{
				if ( stringSize > 2048 )
				{
					nodeString[ 2040 ] = '.' ;
					nodeString[ 2041 ] = '.' ;
					nodeString[ 2042 ] = '.' ;
					nodeString[ 2043 ] = 0 ;
				}
				delete nodeString ;
			}
		}

		NamedProperties warningProperties ;
		warningProperties.Set( "Warning", warningMessage );
//		FireEvent( "SystemWarningEvent", warningProperties );
	}

}
开发者ID:SquirrelEiserloh,项目名称:Rules-of-Enragement,代码行数:37,代码来源:ParsingSupport.cpp

示例5: Render

void BaseWidget::Render(OpenGLRenderer* renderer) {
	
	if (m_isHidden)
		return;
	
	WidgetStateProperties& currentStateProperties = GetCurrentStateProperties();

	std::string renderEventNameStr = "";
	currentStateProperties.GetProperty("renderEvent", renderEventNameStr);
	if (renderEventNameStr != "") {
		NamedProperties renderEventParams;
		renderEventParams.Set("widgetInstance", this);
		EventSystem::GetInstance().FireEvent(renderEventNameStr, renderEventParams);
	}

	float myEdgeSize;
	currentStateProperties.GetProperty("edgeSize", myEdgeSize);

	renderer->SetModelLineWidth((int)myEdgeSize);

	//basic render component
	m_edgeRenderComponent.Render2D(renderer);

	m_renderComponent.Render2D(renderer);

	//draw debug collider
	//renderer->DrawMeshQuad(m_UIColliderComponent.GetBox2DCollider(), Rgba::GREEN);
}
开发者ID:achen889,项目名称:Warlockery_Engine,代码行数:28,代码来源:BaseWidget.cpp

示例6: BuildFlagsFromString

//-----------------------------------------------------------------------------------------------
void XMLDocumentParser::BuildFlagsFromString( const std::string& flagsAsString, NamedProperties& propertiesOut )
{
	std::vector<std::string> flagNames = SplitStringBySingleCharacterDelimiters( flagsAsString, "," );

	std::string actualString;
	bool truthValue;

	for( auto iter = flagNames.begin(); iter != flagNames.end(); ++iter )
	{
		actualString = *iter;

		truthValue = GetTruthValueFromFlag( actualString );
		propertiesOut.Set( actualString, truthValue );
	}
}
开发者ID:treyspears,项目名称:Networking,代码行数:16,代码来源:XMLUtilities.hpp

示例7: ExtractWidgetAttributesFromStateDefinition

NamedProperties WidgetStyle::ExtractWidgetAttributesFromStateDefinition(const TiXmlNode* stateDefinition) {
	NamedProperties widgetAttributes;

	//const char* stateName = stateDefinition->ToElement()->Value();
	const char* onExit = stateDefinition->ToElement()->Attribute("OnExit");
	const char* onEnter = stateDefinition->ToElement()->Attribute("OnEnter");

	if (onEnter) {
		KeyFrameAnimation<std::vector<std::string>> enterSeq;
		enterSeq.AddAnimationFrameAtParameter(SplitString(onEnter, ","), 0.f);

		widgetAttributes.Set("enter event", enterSeq);
	}

	if (onExit) {
		KeyFrameAnimation<std::vector<std::string>> exitSeq;
		exitSeq.AddAnimationFrameAtParameter(SplitString(onExit, ","), 0.f);

		widgetAttributes.Set("exit event", exitSeq);
	}

	const TiXmlNode* bgcolor = stateDefinition->FirstChild("BackgroundColor");

	const TiXmlNode* borderSize = stateDefinition->FirstChild("BorderSize");
	const TiXmlNode* borderColor = stateDefinition->FirstChild("BorderColor");
	const TiXmlNode* size = stateDefinition->FirstChild("Size");
	const TiXmlNode* offset = stateDefinition->FirstChild("Offset");
	const TiXmlNode* opacity = stateDefinition->FirstChild("Opacity");
	const TiXmlNode* textColor = stateDefinition->FirstChild("TextColor");
	const TiXmlNode* fontSize = stateDefinition->FirstChild("FontSize");
	const TiXmlNode* textOpacity = stateDefinition->FirstChild("TextOpacity");
	const TiXmlNode* textContents = stateDefinition->FirstChild("TextContents");
	const TiXmlNode* innerColor = stateDefinition->FirstChild("InnerColor");



	if (bgcolor) {
		const TiXmlElement* bgColorElement = bgcolor->ToElement();
		const char* R = bgColorElement->Attribute("R");
		const char* G = bgColorElement->Attribute("G");
		const char* B = bgColorElement->Attribute("B");
		const char* A = bgColorElement->Attribute("A");

		bool isAnim = bgcolor->FirstChild("KeyFrame") != nullptr;

		if (isAnim) {
			KeyFrameAnimation<RGBA> colorSeq = SetupColorAnimation(bgColorElement);
			widgetAttributes.Set("color", colorSeq);
		}
		else {

			if (!A)
				A = "255";

			char Rc = (char)atoi(R);
			char Gc = (char)atoi(G);
			char Bc = (char)atoi(B);
			char Ac = (char)atoi(A);

			KeyFrameAnimation<RGBA> colorSeq;
			colorSeq.AddAnimationFrameAtParameter(RGBA(Rc, Gc, Bc, Ac), 0.f);
			widgetAttributes.Set("color", colorSeq);
		}
	}

	if (size) {

		const TiXmlElement* sizeElement = size->ToElement();
		bool isAnim = size->FirstChild("KeyFrame") != nullptr;

		if (isAnim) {
			KeyFrameAnimation<Vec2> sizeSeq = SetupVec2Animation(sizeElement);
			widgetAttributes.Set("size", sizeSeq);
		}
		else {
			const char* sizeX = sizeElement->Attribute("X");
			const char* sizeY = sizeElement->Attribute("Y");

			float X = (float)atof(sizeX);
			float Y = (float)atof(sizeY);

			KeyFrameAnimation<Vec2> sizeSeq;
			sizeSeq.AddAnimationFrameAtParameter(Vec2(X, Y), 0.f);

			widgetAttributes.Set("size", sizeSeq);
		}
	}

	if (offset) {
		const TiXmlElement* offsetElement = offset->ToElement();

		bool isAnim = offset->FirstChild("KeyFrame") != nullptr;

		if (isAnim) {
			KeyFrameAnimation<Vec2> offsetSeq = SetupVec2Animation(offsetElement);
			widgetAttributes.Set("offset", offsetSeq);
		}
		else {
			const char* offsetX = offsetElement->Attribute("X");
			const char* offsetY = offsetElement->Attribute("Y");
//.........这里部分代码省略.........
开发者ID:2bitdreamer,项目名称:SD6_Engine,代码行数:101,代码来源:WidgetStyle.cpp

示例8: Update

void DropdownWidget::Update(float deltaSecond, Vector2& mousePosition)
{
	m_currentStateProperty = m_forStates[m_currentState];
	Vector2 offset = GetOffSet();
	for (unsigned int i = 0; i < NUM_WIDGET_STATE_; i++)
	{
		m_forStates[i].fromWidget.Set("parentsOffset", offset);
		if (m_options.size()>0)
		{
			m_options[0]->m_forStates[i].fromWidget.Set("parentsOffset", offset);
		}
	}
	if (m_isExpend)
	{
		for (unsigned int i = 0; i < m_options.size(); i++)
		{
			NamedProperties properties;
			properties.Set("widget", this, "index", i);
			m_options[i]->Update(deltaSecond, mousePosition, &properties);
			if (i>=1)
			{
				m_options[i]->SetDragable(false);
			}
		}
	}
	else
	{
		NamedProperties properties;
		properties.Set("widget", this, "index", 0);
		m_options[0]->Update(deltaSecond, mousePosition, &properties);

	}
	
	
	if (!m_isExpend)
	{
		Vector2 currentOffset(0.0f, 0.0f);
		currentOffset = m_options[0]->GetOffSet();
		Vector2 mins;
		Vector2 maxs;
		m_options[0]->GetValueInCurrentState("mins", mins);
		m_options[0]->GetValueInCurrentState("maxs", maxs);
		AABB2D box(mins+ currentOffset, maxs+ currentOffset);
		if (box.IsPointInside(mousePosition))
		{
			m_isExpend = true;
		}
	}
	else
	{
		Vector2 currentOffset(0.0f, 0.0f);
		currentOffset = m_options[0]->GetOffSet();
		Vector2 mins;
		Vector2 maxs;
		m_options.back()->GetValueInCurrentState("mins", mins);
		m_options[0]->GetValueInCurrentState("maxs", maxs);
		AABB2D box(mins+ currentOffset, maxs+ currentOffset);
		if (!box.IsPointInside(mousePosition))
		{
			m_isExpend = false;
		}
		//for (unsigned int i = 0; i < m_options.size(); i++)
		//{
		//	m_options[i]->GetValueInCurrentState("mins", mins);
		//	m_options[i]->GetValueInCurrentState("maxs", maxs);
		//	box = AABB2D(mins, maxs);
		//	if (box.IsPointInside(mousePosition) && s_theInputSystem->WasMouseButtonJustReleased(VK_LBUTTON))
		//	{
		//		NamedProperties properties;
		//		properties.Set("widget", this, "index", i);
		//		m_options[i]->CallEvent(&properties);
		//		//SwitchOption(i);
		//	}
		//}
			
	}
}
开发者ID:YoungBot,项目名称:Engine,代码行数:77,代码来源:DropdownWidget.cpp


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