當前位置: 首頁>>代碼示例>>C++>>正文


C++ Billboard::SetPosition方法代碼示例

本文整理匯總了C++中Billboard::SetPosition方法的典型用法代碼示例。如果您正苦於以下問題:C++ Billboard::SetPosition方法的具體用法?C++ Billboard::SetPosition怎麽用?C++ Billboard::SetPosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Billboard的用法示例。


在下文中一共展示了Billboard::SetPosition方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: icon_spacing

LabelDecoration::LabelDecoration(BaseEntity* _source, Vector3f _screen_position, float _lifetime)
{
	source_ = _source;
	assert(source_ != NULL);
	source_->AddSubscriber(this);
	source_location_ = source_->GetGlobalPosition();
	lifetime_ = _lifetime;
	full_lifetime_ = _lifetime;
	fill_.SetFillColor(GLColor(255, 255, 255));

	Section_ptr section = (Section_ptr)_source;
	Vector3f screen_position = _screen_position;
	Vector3f icon_spacing(25, 0, 0);
	if(screen_position.x > Camera::Instance().GetWidth() * 0.1f)
		icon_spacing.x *= -1;
	bool interesting = false;

	std::vector<std::string> tags = GetRelevantTags((Section*)_source);

	for(std::vector<std::string>::iterator it = tags.begin(); it != tags.end(); ++it)
	{
		if(!it->compare("Weapon"))
		{
			Billboard* bb = new Billboard("WeaponIcon", BillboardType::ScreenSpace);
			bb->SetPosition(screen_position);
			labels_.push_back(bb);
			screen_position += icon_spacing;
			interesting = true;
		}
		if(!it->compare("Beam"))
		{
			Billboard* bb = new Billboard("BeamIcon", BillboardType::ScreenSpace);
			bb->SetPosition(screen_position);
			labels_.push_back(bb);
			screen_position += icon_spacing;
			interesting = true;
		}
		if(!it->compare("Shield"))
		{
			Billboard* bb = new Billboard("ShieldIcon", BillboardType::ScreenSpace);
			bb->SetPosition(screen_position);
			labels_.push_back(bb);
			screen_position += icon_spacing;
			interesting = true;
		}
		if(!it->compare("Generator"))
		{
			Billboard* bb = new Billboard("GeneratorIcon", BillboardType::ScreenSpace);
			bb->SetPosition(screen_position);
			labels_.push_back(bb);
			screen_position += icon_spacing;
			interesting = true;
		}
		if(!it->compare("EnergyStorage"))
		{
			Billboard* bb = new Billboard("EnergyStorageIcon", BillboardType::ScreenSpace);
			bb->SetPosition(screen_position);
			labels_.push_back(bb);
			screen_position += icon_spacing;
			interesting = true;
		}
		if(!it->compare("Thruster"))
		{
			Billboard* bb = new Billboard("ThrusterIcon", BillboardType::ScreenSpace);
			bb->SetPosition(screen_position);
			labels_.push_back(bb);
			screen_position += icon_spacing;
			interesting = true;
		}
		if(!it->compare("Core"))
		{
			Billboard* bb = new Billboard("CoreIcon", BillboardType::ScreenSpace);
			bb->SetPosition(screen_position);
			labels_.push_back(bb);
			screen_position += icon_spacing;
			interesting = true;
		}
		if(!it->compare("Joint"))
		{
			Billboard* bb = new Billboard("JointIcon", BillboardType::ScreenSpace);
			bb->SetPosition(screen_position);
			labels_.push_back(bb);
			screen_position += icon_spacing;
			interesting = true;
		}
	}
	if(!interesting)
		lifetime_ = -1;

	screen_position_ = screen_position;
}
開發者ID:danishcake,項目名稱:FusionForever,代碼行數:91,代碼來源:LabelDecoration.cpp


注:本文中的Billboard::SetPosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。