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


C++ CEntity::SetRObjectType方法代码示例

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


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

示例1: Load


//.........这里部分代码省略.........

	m_pBackPlate = new CUIElement();

	m_pBackPlate->SetWidth(300);
	m_pBackPlate->SetHeight(300);
	m_pBackPlate->SetColor({ 1, 1, 1, 0.25f });
	m_pBackPlate->SetPosition(vec3f(300, 375, 1));
	m_pBackPlate->SetVisible(false);
	m_pBackPlate->LoadTexture(L"Assets/Images/Menus/Main_Menu_Border_v4.png");
	m_pGUI->AddElement(m_pBackPlate);

	//Load whole menu
	m_pBack = new CUIButton(std::wstring(L"Assets//Images//Menus//Back.png"), 300, 460, 150, 60, std::string("Void"));
	m_pBack->SetRenderText(false);
	m_pBack->SetVisible(false);
	m_pGUI->AddElement(m_pBack);


	m_pCampaign = new CUIButton(std::wstring(L"Assets//Images//Menus//Campaign.png"), 300, 300, 150, 60, std::string("Void"));
	m_pCampaign->SetRenderText(false);
	m_pCampaign->SetVisible(false);
	m_pGUI->AddElement(m_pCampaign);

	m_pEndless = new CUIButton(std::wstring(L"Assets//Images//Menus//Endless.png"), 300, 380, 150, 60, std::string("Void"));
	m_pEndless->SetRenderText(false);
	m_pEndless->SetVisible(false);
	m_pGUI->AddElement(m_pEndless);

	m_pScreen = new CUIElement();
	m_pScreen->SetWidth(10000);
	m_pScreen->SetHeight(8000);
	m_pScreen->SetPosition(vec3f(500, 400, 1));
	m_pScreen->SetVisible(true);

	m_pScreen->LoadTexture(L"Assets/Images/Black.png");
	//m_pGUI->AddElement(m_pScreen);

#ifdef SPINNING_SEXY
	//test object for Deferred
	{
		pAssets->LoadFBX("Assets//Models//Deferred.fbx", "Spinning Sexy");
		CRObject* bob = new CRObject();
		bob->SetTag("Spinning Sexy");
		m_pScene->AddObject(bob);
	}

	//set some light stuff
	{
		using namespace MathHelper;
		auto Lerp = [&](const DirectX::XMFLOAT3& x, const DirectX::XMFLOAT3& y, const DirectX::XMFLOAT3& s) -> DirectX::XMFLOAT3
		{
			return x + s * (y - x);
		};

		float amb = .45f;
		LightParams ambient({ amb, amb, amb }, { 0, -1, 0 });
		m_pScene->AddLight(ambient);

		LightParams light;
		light.Type = Point;
		light.Range = 2.0f;

		const int cubeSize = 3 + 0 * 2;
		const int cubeMin = -(cubeSize / 2);
		const int cubeMax = cubeSize / 2;

		const DirectX::XMFLOAT3 minExtents(-4.0f, 1.0f, -4.0f);
		const DirectX::XMFLOAT3 maxExtents(4.0f, 11.0f, 4.0f);
		const DirectX::XMFLOAT3 minColor(1.0f, 0.0f, 0.0f);
		const DirectX::XMFLOAT3 maxColor(0.0f, 1.0f, 1.0f);

		for (int x = cubeMin; x <= cubeMax; x++)
		{
			for (int y = cubeMin; y <= cubeMax; y++)
			{
				for (int z = cubeMin; z <= cubeMax; z++)
				{
					DirectX::XMFLOAT3 lerp;
					lerp.x = static_cast<float>(x - cubeMin) / (cubeSize - 1);
					lerp.y = static_cast<float>(y - cubeMin) / (cubeSize - 1);
					lerp.z = static_cast<float>(z - cubeMin) / (cubeSize - 1);

					light.Position = Lerp(minExtents, maxExtents, lerp);
					light.Color = Lerp(minColor, maxColor, lerp) * 1.5f * 1.5f;
					m_pScene->AddLight(light);
				}
			}
		}
	}
#endif
	static CEntity e;
	//Since this thing's only use us as a listener, I think I'll commandeer the render type and use it as a bool
	if (e.GetRObjectType() == CRObject::ROBJECT_STATIC)
	{
		AudioSystemWwise::Get()->RegisterListener(&e, NULL);
		e.SetRObjectType(CRObject::ROBJECT_TRANSPARENT);
	}

	return true;
}
开发者ID:jmazzola,项目名称:Damage-Control-FinalProject,代码行数:101,代码来源:MainMenuState.cpp


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