Exemplo n.º 1
0
void HUD::multiplayer()
{
	OverlayManager& overlayManager = OverlayManager::getSingleton();

	// Create a panel
	OverlayContainer* panel = static_cast<OverlayContainer*>(
	overlayManager.createOverlayElement("Panel", "MultiplayerPanel"));
	panel->setMetricsMode(Ogre::GMM_PIXELS);
	panel->setPosition(20, 20);
	panel->setDimensions(200, 250);
	panel->setMaterialName("PanelAchtergrondImage"); // Optional background material

	// Create a text area
	m_textMessages = static_cast<TextAreaOverlayElement*>(
	overlayManager.createOverlayElement("TextArea", "MultiplayerTextArea"));

	m_textMessages->setMetricsMode(Ogre::GMM_PIXELS);
	m_textMessages->setPosition(10, 50);
	m_textMessages->setDimensions(150, 100);
	m_textMessages->setCaption("GoClient 0.1");
	m_textMessages->setCharHeight(16);
	m_textMessages->setFontName("ArialFont");
	m_textMessages->setColourBottom(ColourValue(0.6, 0.6, 0.6));
	m_textMessages->setColourTop(ColourValue(1, 1, 1));

	// Create an overlay, and add the panel
	m_overlay = overlayManager.create("MultiplayerOverlay");
	m_overlay->add2D(panel);

	// Add the text area to the panel
	panel->addChild(m_textMessages);

	// Show the overlay
	m_overlay->show();
}
Exemplo n.º 2
0
void Splash::createScene()
{
	log("[Loading] Creating the splash screen...");
	// Loading picture
	overlayManager = &OverlayManager::getSingleton();
	overlay = overlayManager->create("LoadingOverlay");
	((MaterialPtr)MaterialManager::getSingleton().create("LoadingMaterial","splash"))->getTechnique(0)->getPass(0)->createTextureUnitState("loading.png");
	OverlayContainer* panel = static_cast<OverlayContainer*>(overlayManager->createOverlayElement("Panel","LoadingPanel"));
	panel->setMaterialName("LoadingMaterial");
	panel->setDimensions(1,0.96f);

	// Progess bar
	OverlayContainer* progressBar = static_cast<OverlayContainer*>(overlayManager->createOverlayElement("Panel","ProgressBar"));
	progressBar->setDimensions(1,0.04f);
	progressBar->setPosition(0,0.96f);
	MaterialPtr progressBGMat = MaterialManager::getSingleton().create("progressBG","splash");
	progressBGMat->getTechnique(0)->getPass(0)->createTextureUnitState()->setColourOperationEx(LBX_SOURCE1,LBS_MANUAL,LBS_CURRENT,ColourValue(0.9f, 0.9f, 0.9f));;
	MaterialPtr progressFGMat = MaterialManager::getSingleton().create("progressFG","splash");
	progressFGMat->getTechnique(0)->getPass(0)->createTextureUnitState()->setColourOperationEx(LBX_SOURCE1,LBS_MANUAL,LBS_CURRENT,ColourValue(0.23f, 0.88f, 0.5f));;
	progressBG = static_cast<OverlayContainer*>(overlayManager->createOverlayElement("Panel","ProgressBarBG"));
	progressBG->setMaterialName("progressBG");
	progressBG->setDimensions(1,1);
	progressFG = static_cast<OverlayContainer*>(overlayManager->createOverlayElement("Panel","ProgressBarFG"));
	progressFG->setMaterialName("progressFG");
	progressFG->setDimensions(0,1);

	// Loading text
	FontManager::getSingleton().getByName("BlueHighway")->load(); // HACK: Workaround for bug #324 in Ogre
	progressText = static_cast<TextAreaOverlayElement*>(overlayManager->createOverlayElement("TextArea", "text"));
	progressText->setMetricsMode(GuiMetricsMode::GMM_RELATIVE);
	progressText->setLeft(0.01f);
	progressText->setTop(0.01f);
	progressText->setHorizontalAlignment(GHA_LEFT);
	progressText->setVerticalAlignment(GVA_TOP);
	progressText->setFontName("BlueHighway");
	progressText->setCharHeight(0.03f);
	progressText->setColour(Ogre::ColourValue(0,0,0));

	progressBar->addChild(progressBG);
	progressBar->addChild(progressFG);
	progressBar->addChild(progressText);
	overlay->add2D(panel);
	overlay->add2D(progressBar);
	overlay->show();
}
Exemplo n.º 3
0
//-------------------------------------------------------------------------------------
void ScriptInterpreter::createScene(void)
{
	if (mScriptSourceMode == SSM_SCRIPTDIR)
	{
		ResourceGroupManager::getSingleton().destroyResourceGroup("Scripts");
		ResourceGroupManager::getSingleton().createResourceGroup("Scripts");
		ResourceGroupManager::getSingleton().addResourceLocation(mScriptDir, "FileSystem", "Scripts");
	}
	mDefaultTriangleBuffer = PlaneGenerator().buildTriangleBuffer();
	Overlay* o = OverlayManager::getSingleton().create("myOverlay");
	OverlayContainer* cont = (OverlayContainer*)OverlayManager::getSingleton().createOverlayElement("Panel","myCont");
	o->add2D(cont);
	mTextMessage = OverlayManager::getSingleton().createOverlayElement("TextArea","myText");
	cont->addChild(mTextMessage);
	mTextMessage->setCaption("Ogre program");
	mTextMessage->setParameter("font_name","SdkTrays/Caption");
	o->show();

	checkScriptModified();
}