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


C++ CObjectManager::SetObject方法代码示例

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


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

示例1: StaticInit


//.........这里部分代码省略.........
	if (cm->GetIntValue("GUI_listbox_control_margin", &tempint) == S_OK) {
		pListbox->m_nMargin = tempint;
	}
	if (cm->GetIntValue("GUI_listbox_control_borderwidth", &tempint) == S_OK) {
		pListbox->m_nBorder = tempint;
	}
	if (cm->GetIntValue("GUI_listbox_control_itemheight", &tempint) == S_OK) {
		pListbox->m_ItemHeight = tempint;
	}
	if (cm->GetIntValue("GUI_listbox_control_scrollbarwidth", &tempint) == S_OK) {
		pListbox->m_nSBWidth = tempint;
	}
	if (cm->GetIntValue("GUI_listbox_control_scrollable", &tempint) == S_OK) {
		if (tempint == 0) {
			pListbox->m_bScrollable = false;
		}
		else
			pListbox->m_bScrollable = true;
	}


	//Set the default texture and font of the default scrollbar

	pListbox->m_objResource->SetActiveLayer();
	pListbox->m_objResource->SetCurrentState();
	pListbox->m_objResource->SetLayerType(GUILAYER::ONE_ELEMENT);

	RECT *prect = NULL;
	RECT rect;
	SpriteFontEntity* pFont;
	TextureEntity* pTexture = NULL;
	pFont = CGlobals::GetAssetManager()->GetFont("sys");
	GUIFontElement font_;
	GUIFontElement* pFontElement = &font_;
	GUITextureElement tex_;
	GUITextureElement* pElement = &tex_;

	pListbox->m_objResource->Clear();	//clean all resources;

	pFontElement->SetElement(pFont, COLOR_ARGB(255, 16, 16, 16), DT_LEFT | DT_TOP);
	pListbox->m_objResource->AddElement(pFontElement, "text");
	pFontElement->SetElement(pFont, COLOR_ARGB(255, 255, 255, 255), DT_LEFT | DT_TOP);
	pListbox->m_objResource->AddElement(pFontElement, "selected_text");
	string background, filename;
	bool bLoadDefault = true;
	if (cm->GetTextValue("GUI_listbox_control_background", background) == S_OK) {
		prect = ParaEngine::StringHelper::GetImageAndRect(background, filename, &rect);
		pTexture = CGlobals::GetAssetManager()->LoadTexture(filename.c_str(), filename.c_str(), TextureEntity::StaticTexture);
		if (pTexture != NULL) {
			bLoadDefault = false;
		}
	}
	if (bLoadDefault) {
		//Set the default texture and font of the default button
		pTexture = CGlobals::GetAssetManager()->LoadTexture("__Default_GUI", "Texture/dxutcontrols.dds", TextureEntity::StaticTexture);
		prect = ▭
		SetRect(prect, 13, 123, 241, 160);
	}
	pElement->SetElement(pTexture, prect, COLOR_ARGB(255, 255, 255, 255));

	pListbox->m_objResource->SetCurrentState(GUIResourceState_Normal);
	pListbox->m_objResource->AddElement(pElement, "background");
	pListbox->m_objResource->SetCurrentState(GUIResourceState_Pressed);
	pListbox->m_objResource->AddElement(pElement, "background");
	pListbox->m_objResource->SetCurrentState(GUIResourceState_Highlight);
	pListbox->m_objResource->AddElement(pElement, "background");
	pListbox->m_objResource->SetCurrentState(GUIResourceState_Disabled);
	pListbox->m_objResource->AddElement(pElement, "background");
	pListbox->m_objResource->SetCurrentState();

	bLoadDefault = true;
	if (cm->GetTextValue("GUI_listbox_control_selection", background) == S_OK) {
		prect = StringHelper::GetImageAndRect(background, filename, &rect);
		pTexture = CGlobals::GetAssetManager()->LoadTexture(filename.c_str(), filename.c_str(), TextureEntity::StaticTexture);
		if (pTexture != NULL)
			bLoadDefault = false;
	}
	if (bLoadDefault) {
		//Set the default texture and font of the default button
		pTexture = CGlobals::GetAssetManager()->LoadTexture("__Default_GUI", "Texture/dxutcontrols.dds", TextureEntity::StaticTexture);
		prect = ▭
		SetRect(prect, 17, 269, 241, 287);
	}
	pElement->SetElement(pTexture, prect, COLOR_ARGB(255, 255, 255, 255));

	pListbox->m_objResource->SetCurrentState(GUIResourceState_Normal);
	pListbox->m_objResource->AddElement(pElement, "selection");
	pListbox->m_objResource->SetCurrentState(GUIResourceState_Pressed);
	pListbox->m_objResource->AddElement(pElement, "selection");
	pListbox->m_objResource->SetCurrentState(GUIResourceState_Highlight);
	pListbox->m_objResource->AddElement(pElement, "selection");
	pListbox->m_objResource->SetCurrentState(GUIResourceState_Disabled);
	pListbox->m_objResource->AddElement(pElement, "selection");
	pListbox->m_objResource->SetCurrentState();


	pOm->SetObject("default_CGUIListBox", pListbox);
	SAFE_RELEASE(pListbox);

}
开发者ID:LiXizhi,项目名称:NPLRuntime,代码行数:101,代码来源:GUIListBox.cpp

示例2: StaticInit


//.........这里部分代码省略.........
		if (tempint == 0) {
			pContainer->m_bFastRender = false;
		}
		else
			pContainer->m_bFastRender = true;
	}
	if (cm->GetIntValue("GUI_container_control_canhasfocus", &tempint) == S_OK) {
		if (tempint == 0) {
			pContainer->m_bCanHasFocus = false;
		}
		else
			pContainer->m_bCanHasFocus = true;
	}
	if (cm->GetIntValue("GUI_container_control_visible", &tempint) == S_OK) {
		if (tempint == 0) {
			pContainer->m_bIsVisible = false;
		}
		else
			pContainer->m_bIsVisible = true;
	}
	if (cm->GetIntValue("GUI_container_control_enable", &tempint) == S_OK) {
		if (tempint == 0) {
			pContainer->m_bIsEnabled = false;
		}
		else
			pContainer->m_bIsEnabled = true;
	}
	if (cm->GetIntValue("GUI_container_control_candrag", &tempint) == S_OK) {
		if (tempint == 0) {
			pContainer->SetCandrag(false);
		}
		else
			pContainer->SetCandrag(true);
	}
	if (cm->GetIntValue("GUI_container_control_scrollable", &tempint) == S_OK) {
		if (tempint == 0) {
			pContainer->m_bScrollable = false;
		}
		else
			pContainer->m_bScrollable = true;
	}
	if (cm->GetIntValue("GUI_container_control_lifetime", &tempint) == S_OK) {
		pContainer->m_nLifeTimeCountDown = tempint;
	}
	if (cm->GetIntValue("GUI_container_control_scrollbarwidth", &tempint) == S_OK) {
		pContainer->m_nSBWidth = tempint;
	}
	if (cm->GetIntValue("GUI_container_control_margin", &tempint) == S_OK) {
		pContainer->m_nMargin = tempint;
	}
	if (cm->GetIntValue("GUI_container_control_borderwidth", &tempint) == S_OK) {
		pContainer->m_nBorder = tempint;
	}



	//Set the default texture and font of the default button
	pContainer->m_objResource->SetActiveLayer();
	pContainer->m_objResource->SetCurrentState();
	pContainer->m_objResource->SetLayerType(GUILAYER::ONE_ELEMENT);
	RECT *prect = NULL;
	RECT rect;
	SpriteFontEntity* pFont;
	TextureEntity* pTexture = NULL;
	pFont = CGlobals::GetAssetManager()->GetFont("sys");
	GUIFontElement font_;
	GUIFontElement* pFontElement = &font_;
	GUITextureElement tex_;
	GUITextureElement* pElement = &tex_;
	pFontElement->SetElement(pFont, COLOR_ARGB(255, 0, 0, 0), DT_LEFT | DT_TOP | DT_WORDBREAK);
	pContainer->m_objResource->AddElement(pFontElement, "text");
	string background, filename;
	bool bLoadDefault = true;
	if (cm->GetTextValue("GUI_container_control_background", background) == S_OK) {
		prect = ParaEngine::StringHelper::GetImageAndRect(background, filename, &rect);
		pTexture = CGlobals::GetAssetManager()->LoadTexture(filename.c_str(), filename.c_str(), TextureEntity::StaticTexture);
		if (pTexture != NULL)
			bLoadDefault = false;
	}
	if (bLoadDefault) {
		//Set the default texture and font of the default button
		pTexture = CGlobals::GetAssetManager()->LoadTexture("__Default_GUI", "Texture/dxutcontrols.dds", TextureEntity::StaticTexture);
		prect = ▭
		SetRect(prect, 13, 124, 241, 265);
	}
	pElement->SetElement(pTexture, prect, COLOR_ARGB(255, 255, 255, 255));
	pContainer->m_objResource->SetCurrentState(GUIResourceState_Normal);
	pContainer->m_objResource->AddElement(pElement, "background");
	pContainer->m_objResource->SetCurrentState(GUIResourceState_Pressed);
	pContainer->m_objResource->AddElement(pElement, "background");
	pContainer->m_objResource->SetCurrentState(GUIResourceState_Highlight);
	pContainer->m_objResource->AddElement(pElement, "background");
	pContainer->m_objResource->SetCurrentState(GUIResourceState_Disabled);
	pContainer->m_objResource->AddElement(pElement, "background");
	pContainer->m_objResource->SetCurrentState();
	pContainer->m_objResource->SetActiveLayer();

	pOm->SetObject("default_CGUIContainer", pContainer);
	SAFE_RELEASE(pContainer);
}
开发者ID:imfoollink,项目名称:NPLRuntime,代码行数:101,代码来源:GUIContainer.cpp


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