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


C++ Application::GetRenderWindow方法代码示例

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


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

示例1: InitState

void InMapRenderState::InitState()
{
	IRenderingState::InitState();

	Application* app = TBAppGlobals::Instance()->App;
	m_pageManager=new GUI::GUIPageManager();
	m_mapGUIManager = new GUI::GUIManager(Engine::getInstance().getDevice());
	m_entManager=new game::GameEntityManager();
	m_mapWebpage=m_pageManager->CreateWebPage(m_mapGUIManager);
	math::vector2d rw=app->GetRenderWindow()->GetSize();
	m_mapWebpage->SetResolution(rw.x,rw.y);
	int scale=1;
	m_mapWebpage->SetSize((rw)*scale);///math::vector2d(1,2));
	m_mapWebpage->SetPosition((rw)*(-(scale-1.0f)/2.0f));
	core::string path;
	gFileSystem.getCorrectFilePath("/HTML/maps.html",path);
	if(path!="")
	{
		m_mapWebpage->NavigateTo("file:///"+path);
	}

	m_sceneManager=new scene::SceneManager(app->getDevice());
	m_mapGUIRT=new scene::GUIManagerRT();
	scene::ISceneNode* snode=m_sceneManager->createSceneNode();
	scene::IGUIElementRT* guiRT= m_mapGUIRT->CreateFromManager(m_mapGUIManager);//m_guiRtManager->CreateFromElement(m_root);
	scene::GUIElement3D* rendNode=new scene::GUIElement3D();
	rendNode->SetElement(guiRT);
	rendNode->setOwner(snode);
	snode->AttachNode(rendNode);
	snode->setScale(100);

	m_mapGUIManager->SetRootElement(m_mapWebpage);

	m_entManager->SetSceneManager(m_sceneManager);

	m_entManager->loadFromFile("Indicator.xml");
	{
		const game::EntityList& ents= m_entManager->GetEntities();
		game::EntityList::const_iterator it=ents.begin();
		for (;it!=ents.end();++it)
		{
			const std::list<IObjectComponent*>& comps= (*it)->GetComponent(game::SceneComponent::getClassRTTI());
			std::list<IObjectComponent*>::const_iterator it2=comps.begin();
			for (;it2!=comps.end();++it2)
			{
				m_indicatorObjs.push_back(((game::SceneComponent*)*it2)->GetSceneNode());
			}
		}
	}

	{
		m_guiManager=new GUI::GUIManager(app->getDevice());
		GUI::IGUIPanelElement* root=new  GUI::IGUIPanelElement(core::string(""),m_guiManager);
		m_guiManager->SetRootElement(root);
		root->SetDocking(GUI::EED_Fill);

		GUI::GUIOverlay* o= GUI::GUIOverlayManager::getInstance().LoadOverlay("TBee\\GUIMapScreen.gui");
		if(o)
		{
			o->CreateElements(m_guiManager,root,0,m_mapScreenGUI);
		}
		o= GUI::GUIOverlayManager::getInstance().LoadOverlay("TBee\\GUIRobotPanel.gui");
		if(o)
		{
			o->CreateElements(m_guiManager,root,0,m_robotPanel);
			m_robotPanel->Hide();
		}

		o= GUI::GUIOverlayManager::getInstance().LoadOverlay("TBee\\GUIMapControls.gui");
		if(o)
		{
			o->CreateElements(m_guiManager,root,0,0);
		}
	}

	MapCamera* cam = new MapCamera(m_sceneManager, AppData::Instance()->inputMngr);
	m_sceneManager->addSceneNode(cam);
	cam->UpdatePosition();

	m_mapController=new CinematicController(AppData::Instance()->inputMngr); //new JoystickMapController(app->GetInputManager());
	m_mapObject=new MapObject();
	m_mapObject->AddListener(this);
	m_mapObject->Init(cam,m_mapWebpage);
	m_mapController->SetMapObject(m_mapObject);

	{
		m_viewport=new scene::ViewPort("MapCam",cam,0,0,math::rectf(0,0.2,1,0.8),0);
		m_viewport->SetClearColor(video::SColor(0,1,0,1));

		video::ITexturePtr renderTargetTex = Engine::getInstance().getDevice()->createTexture2D(math::vector2d(1, 1), video::EPixel_R8G8B8A8, true);
		renderTargetTex->setBilinearFilter(false);
		renderTargetTex->setTrilinearFilter(false);
		renderTargetTex->setMipmapsFilter(false);
		m_viewport->SetClearColor(video::SColor(1,1,1,1));

		video::IRenderTargetPtr rt = Engine::getInstance().getDevice()->createRenderTarget(mT(""), renderTargetTex, video::IHardwareBufferPtr::Null, video::IHardwareBufferPtr::Null, false);
		m_viewport->setRenderTarget(rt);
		m_viewport->setOnlyToRenderTarget(true);
		m_viewport->SetAutoUpdateRTSize(true);
		m_viewport->enablePostProcessing(true);
//.........这里部分代码省略.........
开发者ID:yingzhang536,项目名称:mrayy-Game-Engine,代码行数:101,代码来源:InMapRenderState.cpp


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