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


C++ CSlider::SetButtonTextures方法代码示例

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


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

示例1: LoadSlider

void CGUIWindow::LoadSlider (CSlider** slider_aux, CXMLTreeNode& pNewNode, const Vect2i& screenResolution, CTextureManager* tm)
{
	//<Slider	name="debug_fps" posx="0" posy="2" height="10" width="10" visible="true" active="true" value="0.5" buttonH="10" buttonW="10"
	// button_normal="blabla" button_over="bla" button_clicked"bla" button_deactivated="bla" quad="bla"
	// OnOverAction="" OnClickedAction="" OnChangeValue="" OnSaveValue="blabl" OnLoadValue="" Literal="blabla" widthOffset="" heightOffset=""/>

  CSlider* slider;

	std::string name								= pNewNode.GetPszProperty("name", "defaultGuiElement");
	float 			posx								= pNewNode.GetFloatProperty("posx", 0.f);
	float 			posy								= pNewNode.GetFloatProperty("posy", 0.f);
	float 			w										= pNewNode.GetFloatProperty("width", 50.f);
	float 			h										= pNewNode.GetFloatProperty("height", 50.f);
	bool 				visible							= pNewNode.GetBoolProperty("visible", true);
	bool 				activated						= pNewNode.GetBoolProperty("active", true);
	float 			value								= pNewNode.GetFloatProperty("value", 0.f);
	float 			buttonH							= pNewNode.GetFloatProperty("buttonH", 10.f);
	float 			buttonW							= pNewNode.GetFloatProperty("buttonW", 10.f);
	std::string button_normal				= pNewNode.GetPszProperty("button_normal", "");
	std::string button_over					= pNewNode.GetPszProperty("button_over", "");
	std::string button_clicked			= pNewNode.GetPszProperty("button_clicked", "");
	std::string button_deactivated	= pNewNode.GetPszProperty("button_deactivated", "");
	std::string quad								= pNewNode.GetPszProperty("quad", "");
	std::string OnChangeValue				= pNewNode.GetPszProperty("OnChangeValue", "");
	std::string OnClickedAction			= pNewNode.GetPszProperty("OnClickedAction", "");
	std::string OnOverAction				= pNewNode.GetPszProperty("OnOverAction", "");
	std::string OnSaveValue					= pNewNode.GetPszProperty("OnSaveValue", "");
	std::string OnLoadValue					= pNewNode.GetPszProperty("OnLoadValue", "");
	std::string l_literal						= pNewNode.GetPszProperty("Literal", "");
	float				widthOffsetPercent	= pNewNode.GetFloatProperty("widthOffset", 0.f);
	float				heightOffsetPercent	= pNewNode.GetFloatProperty("heightOffset", 0.f);

	CTexture* normal	= tm->GetTexture(button_normal);
	CTexture* over		= tm->GetTexture(button_over);
	CTexture* deac		= tm->GetTexture(button_deactivated);
	CTexture* clicked	= tm->GetTexture(button_clicked);
	CTexture* back		= tm->GetTexture(quad);

	uint32 widthOffset	= (uint32) (screenResolution.x	* 0.01f * widthOffsetPercent );
	uint32 heightOffset	= (uint32) (screenResolution.y	* 0.01f * heightOffsetPercent );

	slider = new CSlider(	screenResolution.y, screenResolution.x, h, w, Vect2f(posx,posy), buttonW, buttonH, value, 
												l_literal, heightOffset, widthOffset, visible, activated);
	slider->SetName(name);
	slider->SetButtonTextures(normal, over, clicked, deac);
	slider->SetBackGroundTexture(back);
	slider->SetOnChangeValueAction(OnChangeValue);
	slider->SetOnClickedAction(OnClickedAction);
	slider->SetOnOverAction(OnOverAction);
	slider->SetOnLoadValueAction(OnLoadValue);
	slider->SetOnSaveValueAction(OnSaveValue);

  *slider_aux = slider;
}
开发者ID:ivantarruella,项目名称:TheOtherSide,代码行数:54,代码来源:GUIWindow.cpp


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