예제 #1
0
bool
ProcGameIntro::OnRender(irr::IrrlichtDevice& device)
{	
	device.getVideoDriver()->beginScene(true, true, SColor(255,128,0,255));

	device.getSceneManager()->drawAll();
	device.getGUIEnvironment()->drawAll();

	device.getVideoDriver()->endScene();

	return true;
}
예제 #2
0
bool
ProcTitle::OnExit(irr::IrrlichtDevice& device)
{	
	IGUIEnvironment* env = device.getGUIEnvironment();
	env->clear();

	// should I need to clear all texture here? 
	IVideoDriver* pDriver = IrrDvc.GetDriver();
	pDriver->removeAllTextures();

	return true;
}
예제 #3
0
bool
ProcGame::OnRender(irr::IrrlichtDevice& device)
{
    device.getVideoDriver()->beginScene(true, true, SColor(255,128,0,255));

    device.getSceneManager()->drawAll();
    device.getGUIEnvironment()->drawAll();

#ifdef AI_TEST_DISPLAY_INFO
    //add sk for AI
    EntityMgr.DrawExtraInfo();
    //end add sk for AI
#endif

    device.getVideoDriver()->endScene();

    return true;
}
예제 #4
0
bool 
ProcTitle::OnInit(irr::IrrlichtDevice& device)
{	
	device.setWindowCaption(L"Artistic Controlled Car - title");

	IGUIEnvironment* env = device.getGUIEnvironment();
	IGUIButton* pButton = env->addButton(rect<s32>(10, 240, 200, 240+100), 0, GUI_ID_START_BUTTON, L"Start", L"Start Game");
	pButton->setDrawBorder(false);
	IVideoDriver* pDriver = IrrDvc.GetDriver();
	video::ITexture* pTexture = pDriver->getTexture("Rsrc/hero.tga");	// refcount = 1
	pButton->setImage(pTexture);										// refcount += 2, means when button released refcount will be 1	
	pButton->setUseAlphaChannel(true);									// 1 will be decreased pDriver->removeAllTextures();

	{
		ITexture* pTexture = pDriver->getTexture("Rsrc/map.bmp");
		pButton->setPressedImage(pTexture);
	}

	// sound test
	IrrSnd.GetSndEngine()->play2D("Rsrc/getout.ogg", true);	

	return true;
}
예제 #5
0
bool 
ProcTitle::OnInit(irr::IrrlichtDevice& device)
{	
	device.setWindowCaption(L"Pair - title");
	//device.getCursorControl()->setVisible(false);

	u32 width = IrrDvc.GetDriver()->getScreenSize().Width;
	u32 height = IrrDvc.GetDriver()->getScreenSize().Height;

	scene::ISceneManager* pSmgr = IrrDvc.GetSmgr();
	IVideoDriver* pDriver = IrrDvc.GetDriver();

	// camera setting 
	{		
		irr::scene::ICameraSceneNode* pCamera = pSmgr->addCameraSceneNode(0, core::vector3df(0,0,-100), core::vector3df(0,0,0));		
		//f32 zNear = 1;
		//f32 zFar = 3000;
		//f32 zNear = pCamera->getNearValue();
		//f32 zFar = pCamera->getFarValue();
#if 0
		CMatrix4<f32> matOrtho;				
		matOrtho.buildProjectionMatrixOrthoLH(width, height, zNear, zFar);
		pCamera->setProjectionMatrix(matOrtho, true);
#else
		//CMatrix4<f32> matPerspective;
		//matPerspective.buildProjectionMatrixPerspectiveLH((f32)width, (f32)height, zNear, zFar);
		//pCamera->setProjectionMatrix(matPerspective, false);
#endif
	}

	// title
	{		
		m_p2DSprite = pSmgr->addBillboardSceneNode();
		video::ITexture* pTexture = pDriver->getTexture("Rsrc/title.png");		
		m_p2DSprite->setMaterialTexture(0, pTexture);
		m_p2DSprite->setMaterialFlag(video::EMF_LIGHTING, false);
		m_p2DSprite->setMaterialFlag(video::EMF_ZBUFFER, true);
		m_p2DSprite->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false);
		m_p2DSprite->setMaterialFlag(video::EMF_ANTI_ALIASING, true);
		m_p2DSprite->setMaterialFlag(video::EMF_BILINEAR_FILTER, true);
		m_p2DSprite->setSize(dimension2df((f32)width, (f32)height));
		m_p2DSprite->setPosition(vector3df(0.f, 0.f, 300.f));
		m_p2DSprite->setID(1004);
		m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureScale(1.0f, 1.0f);

		// animation test
		//scene::ISceneNodeAnimator* pAni = pSmgr->createFlyCircleAnimator(core::vector3df(0,0,200), 20.0f);
		//m_p2DSprite->addAnimator(pAni);
	}

	// card
	{
		for (int i = 0; i < 3; i++)
		{
			IMeshSceneNode* pCard = pSmgr->addCubeSceneNode();
			char buff[20];
			sprintf_s(buff, 20, "Rsrc/card%d.png", i);
			video::ITexture* pTexture = pDriver->getTexture(buff);			
			pCard->setMaterialTexture(0, pTexture);
			pCard->setScale(vector3df(4.f, 4.f * 1.618f, 0.1f));
			pCard->setPosition(vector3df(-60.f + 60.f * i, 0.f, 0.f));
			pCard->setMaterialFlag(video::EMF_LIGHTING, false);

			// animation test
			scene::ISceneNodeAnimator* pAni = pSmgr->createRotationAnimator(vector3df(0.f, 1.f, 0.f));
			pCard->addAnimator(pAni);
			pAni->drop();
		}
	}

	// mesh
	{
		IAnimatedMesh* mesh = pSmgr->getMesh("Rsrc/sydney.md2");
		IAnimatedMeshSceneNode* pNode = pSmgr->addAnimatedMeshSceneNode(mesh);
		if (pNode)
		{
			//pNode->setScale(vector3df(10.f, 10.f, 10.f));
			pNode->setMaterialFlag(EMF_LIGHTING, false);
			//pNode->setMaterialFlag(EMF_ZBUFFER, false);
			pNode->setMD2Animation(scene::EMAT_STAND);
			pNode->setMaterialTexture( 0, pDriver->getTexture("Rsrc/sydney.bmp") );
			pNode->setPosition(vector3df(0.0f, -5.f, -55.f));
		}
	}

	// button 
	{
		IGUIEnvironment* env = device.getGUIEnvironment();
		
		video::ITexture* pTexture = pDriver->getTexture("Rsrc/new_game_btn_normal.PNG");	// refcount = 1
		dimension2d<u32> dim = pTexture->getOriginalSize();
		s32 offsetX = width / 2 - dim.Width / 2;
		s32 offsetY = height - dim.Height * 3;
		IGUIButton* pButton = env->addButton(rect<s32>(offsetX, offsetY, offsetX + dim.Width, offsetY + dim.Height), 0, GUI_ID_START_BUTTON);
		pButton->setDrawBorder(false);		
		pButton->setImage(pTexture);										// refcount += 2, means when button released refcount will be 1	
		pButton->setUseAlphaChannel(true);									// 1 will be decreased pDriver->removeAllTextures();

		{
			ITexture* pTexture = pDriver->getTexture("Rsrc/new_game_btn_pressed.PNG");
			pButton->setPressedImage(pTexture);
		}
	}

	// sound test
	IrrSnd.GetSndEngine()->play2D("Rsrc/getout.ogg", true);

	return true;
}