当前位置: 首页>>代码示例>>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;未经允许,请勿转载。