void OgreSubsystem::setOverlayTextColor(String element, Color color, Color color2) { Ogre::TextAreaOverlayElement* elem = static_cast<Ogre::TextAreaOverlayElement*>( Ogre::OverlayManager::getSingletonPtr()->getOverlayElement(element)); elem->setColourBottom(convertOgre(color)); elem->setColourTop(convertOgre(color2)); }
void WorldManager::updateLevel() { mWorld->updateLevel(); int level = mWorld->getLevel(); Ogre::OverlayManager& om = Ogre::OverlayManager::getSingleton(); Ogre::TextAreaOverlayElement *te = (Ogre::TextAreaOverlayElement *) om.getOverlayElement("level"); char levelCaption[25]; sprintf(levelCaption, "Level : %i", level); te->setCaption(levelCaption); }
LogMessageWindow::LogMessageWindow(Ogre::Real aW, Ogre::Real aH): m_width(aW), m_height(aH), m_log(""), m_displaylog("") { m_console = NULL; initialize(); Ogre::TextAreaOverlayElement* textArea = static_cast<Ogre::TextAreaOverlayElement*>(m_textarea); m_displaylinenum = (int)(m_height/textArea->getCharHeight()); show(false); }
void COverlay::createChildTextArea(const std::string &panelName, const std::string &name, float left, float top, float width, float height, const std::string &font, float fontSize, const std::string &text) { assert(_childElements[panelName] && "No existe un panel hijo con ese nombre en este overlay!"); Ogre::TextAreaOverlayElement* newChild = static_cast<Ogre::TextAreaOverlayElement*>( createChildElement(TChildType::TEXTAREA, name, left, top, width, height) ); newChild->setFontName(font); newChild->setCharHeight(fontSize); newChild->setCaption(text); static_cast<Ogre::OverlayContainer*>( _childElements[panelName] )->addChild(newChild); } // createChildTextArea
void gkDebugScreen::initialize() { if (m_isInit) return; try { m_font = new gkBuiltinFont; Ogre::FontPtr fp = Ogre::FontManager::getSingleton().create("<gkBuiltin/Font>", GK_BUILTIN_GROUP, true, m_font); fp->load(); Ogre::OverlayManager& mgr = Ogre::OverlayManager::getSingleton(); m_over = mgr.create("<gkBuiltin/gkDebugScreen>"); m_ele = mgr.createOverlayElement("TextArea", "<gkBuiltin/gkDebugScreen/TextArea>"); Ogre::OverlayContainer* cont = (Ogre::OverlayContainer*)mgr.createOverlayElement("BorderPanel", "<gkBuiltin/gkDebugScreen/Containter>"); cont->setMetricsMode(Ogre::GMM_PIXELS); cont->setVerticalAlignment(Ogre::GVA_TOP); const gkVector2& dims = gkWindowSystem::getSingleton().getMouse()->winsize; m_ele->setMetricsMode(Ogre::GMM_PIXELS); m_ele->setVerticalAlignment(Ogre::GVA_TOP); m_ele->setPosition(0, 0); m_ele->setDimensions(dims.x, dims.y); Ogre::TextAreaOverlayElement* textArea = static_cast<Ogre::TextAreaOverlayElement*>(m_ele); textArea->setFontName("<gkBuiltin/Font>"); textArea->setCharHeight(SCREEN_SIZE); textArea->setColour(Ogre::ColourValue::White); m_over->setZOrder(500); cont->addChild(m_ele); m_over->add2D(cont); } catch (Ogre::Exception& e) { gkPrintf("%s", e.getDescription().c_str()); return; } m_isInit = true; gConsole = this; }
void LanguageEngine::postSetup() { // set some overlay used fonts to the new font config String newfont = "CyberbitEnglish"; const char *overlays[] = {"Core/CurrFps", "Core/AverageFps", "Core/WorstFps", "Core/BestFps", "Core/NumTris", "Core/DebugText", "Core/CurrMemory", "Core/MemoryText", "Core/LoadPanel/Description", "Core/LoadPanel/Comment", 0}; for (int i=0;overlays[i]!=0;i++) { try { Ogre::TextAreaOverlayElement *ot = (Ogre::TextAreaOverlayElement *)OverlayManager::getSingleton().getOverlayElement(overlays[i]); if (ot) ot->setFontName(newfont); } catch (...) { } } }
void WorldManager::updateScore() { int rightPlayerScore = mWorld->getRightPlayerScore(); int leftPlayerScore = mWorld->getLeftPlayerScore(); if (isBallCollideWithLeftWall()) { mWorld->setRightPlayerScore(++rightPlayerScore); } if (isBallCollideWithRightWall()) { mWorld->setLeftPlayerScore(++leftPlayerScore); } Ogre::OverlayManager& om = Ogre::OverlayManager::getSingleton(); Ogre::TextAreaOverlayElement *te = (Ogre::TextAreaOverlayElement *) om.getOverlayElement("left"); char score[25]; sprintf(score, "%i", leftPlayerScore); te->setCaption(score); sprintf(score, "%i", rightPlayerScore); te = (Ogre::TextAreaOverlayElement *) om.getOverlayElement("right"); te->setCaption(score); }
void gkDebugScreen::pushText(const gkString& text) { utStringUtils::split(m_splitBuf, text, "\n\r"); Ogre::TextAreaOverlayElement* textArea = static_cast<Ogre::TextAreaOverlayElement*>(m_ele); const gkVector2& winSize = gkWindowSystem::getSingleton().getMouse()->winsize; gkScalar che = textArea->getCharHeight(); for (UTsize i = 0; i < m_splitBuf.size(); ++i) { ScreenBufferItem* item = m_lineBuffer.alloc(); item->clear(); item->m_buf = m_splitBuf.at(i); m_lines.push_back(item); gkScalar size = gkScalar(m_lines.size()) * che; if (size > winSize.y) m_lineBuffer.dealloc(m_lines.pop_front()); } m_splitBuf.clear(true); if (!m_lines.empty()) { // write lines m_txtBuffer.resize(0); ScreenBufferItem* node = m_lines.begin(); while (node) { m_txtBuffer += node->m_buf + "\n"; node = node->getNext(); } } _getClipped(); }
void gkDebugPropertyPage::initialize(void) { if (m_isInit) return; try { // always initialize after gkDebugScreen! Ogre::OverlayManager& mgr = Ogre::OverlayManager::getSingleton(); m_over = mgr.create("<gkBuiltin/gkDebugPropertyPage>"); m_key = mgr.createOverlayElement("TextArea", "<gkBuiltin/gkDebugPropertyPage/Keys>"); m_val = mgr.createOverlayElement("TextArea", "<gkBuiltin/gkDebugPropertyPage/Vals>"); m_cont = (Ogre::OverlayContainer*)mgr.createOverlayElement("Panel", "<gkBuiltin/gkDebugPropertyPage/Containter1>"); m_cont->setMetricsMode(Ogre::GMM_PIXELS); m_cont->setVerticalAlignment(Ogre::GVA_TOP); m_cont->setHorizontalAlignment(Ogre::GHA_LEFT); m_key->setMetricsMode(Ogre::GMM_PIXELS); m_key->setVerticalAlignment(Ogre::GVA_TOP); m_key->setHorizontalAlignment(Ogre::GHA_LEFT); m_val->setMetricsMode(Ogre::GMM_PIXELS); m_val->setVerticalAlignment(Ogre::GVA_TOP); m_val->setHorizontalAlignment(Ogre::GHA_LEFT); Ogre::TextAreaOverlayElement* textArea; textArea = static_cast<Ogre::TextAreaOverlayElement*>(m_key); textArea->setFontName("<gkBuiltin/Font>"); textArea->setCharHeight(PROP_SIZE); textArea->setColour(Ogre::ColourValue::White); textArea = static_cast<Ogre::TextAreaOverlayElement*>(m_val); textArea->setFontName("<gkBuiltin/Font>"); textArea->setCharHeight(PROP_SIZE); textArea->setColour(Ogre::ColourValue::White); m_over->setZOrder(500); m_cont->addChild(m_key); m_cont->addChild(m_val); m_over->add2D(m_cont); } catch (Ogre::Exception& e) { gkPrintf("%s", e.getDescription().c_str()); return; } m_isInit = true; }
void LogMessageWindow::log(const char* fmt,...) { char buf[MAX_LINE_CHR+1]; va_list lst; va_start(lst, fmt); int size = printfprintf(buf, MAX_LINE_CHR, fmt, lst); va_end(lst); m_log.append(Ogre::UTFString(CharToWchar(buf))); m_log.append("\n"); if(m_log.length()>MAX_LOG_LENGTH) { m_log = m_log.substr(m_log.length()-MAX_LOG_LENGTH); } trimDisplayArea(buf); Ogre::TextAreaOverlayElement* textArea = static_cast<Ogre::TextAreaOverlayElement*>(m_textarea); textArea->setCaption(m_displaylog); gkPrintf( "(log panel)%s\n", buf); if(m_console ) { m_console->addToConsole(m_console->getColorString("System"), "", MyGUI::UString(CharToWchar(buf))); } }
void World::updateScoreboard(void) { // User scored if (mBallNode->getPosition().x >= 60) { Ogre::OverlayManager& om = Ogre::OverlayManager::getSingleton(); Ogre::TextAreaOverlayElement *te = (Ogre::TextAreaOverlayElement *) om.getOverlayElement("Scoreboard/Panel2/Score2"); // Set new score for user player int score = Ogre::StringConverter::parseInt(te->getCaption()); score++; te->setCaption(Ogre::StringConverter::toString(score)); // Reset necessary booleans hitTopWall = false; hitBottomWall = false; hitByUser = false; hitByAI = false; start = true; // Send ball back to middle mBallNode->setPosition(Ogre::Vector3(0, 0, 0)); } // AI scored if (mBallNode->getPosition().x <= -60) { Ogre::OverlayManager& om = Ogre::OverlayManager::getSingleton(); Ogre::TextAreaOverlayElement *te = (Ogre::TextAreaOverlayElement *) om.getOverlayElement("Scoreboard/Panel1/Score1"); // Set new score for AI player int score = Ogre::StringConverter::parseInt(te->getCaption()); score++; te->setCaption(Ogre::StringConverter::toString(score)); // Reset necessary booleans hitTopWall = false; hitBottomWall = false; hitByUser = false; hitByAI = false; start = true; // Send ball back to middle mBallNode->setPosition(Ogre::Vector3(0, 0, 0)); } }
void OgreEngine::initOverlay() { Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton(); Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>(overlayManager.createOverlayElement("Panel", "PanelName")); panel->setMetricsMode(Ogre::GMM_PIXELS); panel->setPosition(10, 10); panel->setDimensions(100, 100); Ogre::TextAreaOverlayElement* textArea = static_cast<Ogre::TextAreaOverlayElement*>( overlayManager.createOverlayElement("TextArea", "worldName")); textArea->setMetricsMode(Ogre::GMM_PIXELS); textArea->setPosition(10, 10); textArea->setDimensions(100, 200); textArea->setFontName("StarWars"); //textArea->setCaption(this->data["name"].toString().toStdString()); textArea->setCharHeight(16); textArea->setColourBottom(Ogre::ColourValue(1, 1, 1)); textArea->setColourTop(Ogre::ColourValue(1, 1, 1)); Ogre::TextAreaOverlayElement* textArea2 = static_cast<Ogre::TextAreaOverlayElement*>( overlayManager.createOverlayElement("TextArea", "timeArea")); textArea2->setMetricsMode(Ogre::GMM_PIXELS); textArea2->setPosition(10, 30); textArea2->setDimensions(100, 200); textArea2->setFontName("StarWars"); textArea2->setCaption("0min 0sec"); textArea2->setCharHeight(16); textArea2->setColourBottom(Ogre::ColourValue(1, 1, 1)); textArea2->setColourTop(Ogre::ColourValue(1, 1, 1)); Ogre::Overlay* overlay = overlayManager.create("OverlayName"); overlay->add2D(panel); panel->addChild(textArea); panel->addChild(textArea2); overlay->show(); }
void gkDebugScreen::initialize() { if (m_isInit) return; try { m_font = new gkBuiltinFont; Ogre::FontPtr fp = Ogre::FontManager::getSingleton().create("<gkBuiltin/Font>", GK_BUILTIN_GROUP, true, m_font); fp->load(); #define FONT_MATERIAL 1 #if FONT_MATERIAL #ifndef OGREKIT_USE_OLD gkString ShareMaterail = "Examples/BumpMapping/MultiLight"; static int Use_Init_Once = 0; if(Use_Init_Once < 2) { Ogre::FileInfoListPtr fileInfoList = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo( "", "*.material"); for (Ogre::FileInfoList::const_iterator cit=fileInfoList->begin(); cit != fileInfoList->end(); ++cit) { const Ogre::String& name = cit->filename; const Ogre::String& basename = cit->basename; Ogre::String sType = cit->archive->getType(); Ogre::String sPath = cit->archive->getName(); if (sType=="Zip" || sType=="FileSystem") { Ogre::DataStreamPtr pData= Ogre::ResourceGroupManager::getSingleton().openResource( basename,""); Ogre::MaterialManager::getSingleton().parseScript( pData, ""); Ogre::MaterialManager::getSingleton().load(basename,""); } } Use_Init_Once++; } #endif Ogre::MaterialPtr ShareMaterailPtr = Ogre::MaterialManager::getSingleton().getByName(ShareMaterail, ""); if (!ShareMaterailPtr.isNull()) { ShareMaterailPtr->load(); //ShareMaterailPtr->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant("textureCount",1); } Ogre::MaterialPtr oma = Ogre::MaterialManager::getSingleton().getByName("Fonts/<gkBuiltin/Font>"); if (!oma.isNull()) { Ogre::Pass* pass1 = oma->getTechnique(0)->getPass(0); Ogre::GpuProgramPtr vsPtr = Ogre::HighLevelGpuProgramManager::getSingleton().getByName("FixVs"); if (vsPtr.isNull()) { LogManager::getSingleton().logMessage("GpuProgramPtr NULL"); } gkString VertexProgramName = "FixVs"; gkString FragmentProgramName ="FixPs"; if (pass1) { pass1->setVertexProgram(VertexProgramName); pass1->setFragmentProgram(FragmentProgramName); Ogre::GpuProgramParametersSharedPtr vsParams = pass1->getVertexProgramParameters(); vsParams->copyMatchingNamedConstantsFrom(*ShareMaterailPtr->getTechnique(0)->getPass(0)->getVertexProgramParameters().get()); Ogre::GpuProgramParametersSharedPtr psParams = pass1->getFragmentProgramParameters(); psParams->copyMatchingNamedConstantsFrom(*ShareMaterailPtr->getTechnique(0)->getPass(0)->getFragmentProgramParameters().get()); //psParams->setNamedConstant("textureCount",1); //psParams->setNamedConstant("AlphaValue",0.0f); //vsParams->setNamedConstant("lightOpen",0); LogManager::getSingleton().logMessage("set font es2.0"); } } #endif Ogre::OverlayManager& mgr = Ogre::OverlayManager::getSingleton(); m_over = mgr.create("<gkBuiltin/gkDebugScreen>"); m_ele = mgr.createOverlayElement("TextArea", "<gkBuiltin/gkDebugScreen/TextArea>"); Ogre::OverlayContainer* cont = (Ogre::OverlayContainer*)mgr.createOverlayElement("BorderPanel", "<gkBuiltin/gkDebugScreen/Containter>"); cont->setMetricsMode(Ogre::GMM_PIXELS); cont->setVerticalAlignment(Ogre::GVA_TOP); const gkVector2& dims = gkWindowSystem::getSingleton().getMouse()->winsize; m_ele->setMetricsMode(Ogre::GMM_PIXELS); m_ele->setVerticalAlignment(Ogre::GVA_TOP); m_ele->setPosition(0, 0); m_ele->setDimensions(dims.x, dims.y); Ogre::TextAreaOverlayElement* textArea = static_cast<Ogre::TextAreaOverlayElement*>(m_ele); textArea->setFontName("<gkBuiltin/Font>"); textArea->setCharHeight(SCREEN_SIZE); textArea->setColour(Ogre::ColourValue::White); m_over->setZOrder(500); cont->addChild(m_ele); m_over->add2D(cont); } catch (Ogre::Exception& e) { gkPrintf("%s", e.getDescription().c_str()); return; } m_isInit = true; gConsole = this; }
void LogMessageWindow::initialize(void) { try { // always initialize after gkDebugScreen! Ogre::OverlayManager& mgr = Ogre::OverlayManager::getSingleton(); m_over = mgr.create("<gkBuiltin/LogMessageWindow>"); m_textarea = mgr.createOverlayElement("TextArea", "<gkBuiltin/LogMessageWindow/Textarea>"); m_cont = (Ogre::OverlayContainer*)mgr.createOverlayElement("Panel", "<gkBuiltin/LogMessageWindow/Containter>"); m_cont->setMetricsMode(Ogre::GMM_PIXELS); m_cont->setVerticalAlignment(Ogre::GVA_TOP); m_cont->setHorizontalAlignment(Ogre::GHA_LEFT); //m_cont->setLeft(-16 * PROP_SIZE); //m_cont->setTop(10); //m_cont->setWidth(1.0f); //m_cont->setHeight(0.25f); //m_cont->s>setDimensions(1.0,0.25); m_textarea->setMetricsMode(Ogre::GMM_PIXELS); m_textarea->setVerticalAlignment(Ogre::GVA_TOP); m_textarea->setHorizontalAlignment(Ogre::GHA_LEFT); //m_val->setMetricsMode(Ogre::GMM_PIXELS); //m_val->setVerticalAlignment(Ogre::GVA_TOP); //m_val->setHorizontalAlignment(Ogre::GHA_LEFT); //m_val->setLeft(8 * PROP_SIZE); m_font = Ogre::FontManager::getSingleton().create("WQYFont", MY_GROUP_NAME); m_font ->setSource(FONT_TTF_WQY); m_font ->setType(Ogre::FT_TRUETYPE); m_font ->setTrueTypeSize( 20 ); m_font ->setTrueTypeResolution( 96 ); m_font ->addCodePointRange(Ogre::Font::CodePointRange(33,255)); m_font ->addCodePointRange(Ogre::Font::CodePointRange(19968,40869)); m_font ->load(); Ogre::TextAreaOverlayElement* textArea; textArea = static_cast<Ogre::TextAreaOverlayElement*>(m_textarea); //textArea->setFontName("<gkBuiltin/Font>"); textArea->setFontName("WQYFont"); textArea->setCharHeight(PROP_SIZE); textArea->setSpaceWidth(PROP_SIZE); textArea->setColour(Ogre::ColourValue::Green); //textArea = static_cast<Ogre::TextAreaOverlayElement*>(m_val); //textArea->setFontName("<gkBuiltin/Font>"); //textArea->setCharHeight(PROP_SIZE); //textArea->setColour(Ogre::ColourValue::White); m_over->setZOrder(498); m_cont->addChild(m_textarea); m_over->add2D(m_cont); } catch (Ogre::Exception& e) { gkPrintf("%s\n", e.getDescription().c_str()); return; } m_isInit = true; }
//void setColourTop(const ColourValue& col); void textareaoverlayelement_set_colour_top(TextAreaOverlayElementHandle handle, const coiColourValue* c) { Ogre::TextAreaOverlayElement* toe = static_cast<Ogre::TextAreaOverlayElement*>(handle); const Ogre::ColourValue colour(c->r, c->b, c->g, c->a); toe->setColourTop(colour); }
//void setMetricsMode(GuiMetricsMode gmm); void textareaoverlayelement_set_metrics_mode(TextAreaOverlayElementHandle handle, gui_metrics_mode gmm) { Ogre::TextAreaOverlayElement* toe = static_cast<Ogre::TextAreaOverlayElement*>(handle); Ogre::GuiMetricsMode GMM = llcoi_gui_metrics_mode_to_ogre_gui_metrics_mode(gmm); toe->setMetricsMode(GMM); }
//void setFontName( const String& font ); void textareaoverlayelement_set_font_name(TextAreaOverlayElementHandle handle, const char* font) { Ogre::TextAreaOverlayElement* toe = static_cast<Ogre::TextAreaOverlayElement*>(handle); toe->setFontName(Ogre::String(font)); }
//void setCharHeight( Real height ); void textareaoverlayelement_set_char_height(TextAreaOverlayElementHandle handle, coiReal height) { Ogre::TextAreaOverlayElement* toe = static_cast<Ogre::TextAreaOverlayElement*>(handle); toe->setCharHeight(height); }
//void setCaption(const DisplayString& text); void textareaoverlayelement_set_caption(TextAreaOverlayElementHandle handle, const char* text) { Ogre::TextAreaOverlayElement* toe = static_cast<Ogre::TextAreaOverlayElement*>(handle); toe->setCaption(Ogre::DisplayString(text)); }
//void initialise(void); void textareaoverlayelement_initialise(TextAreaOverlayElementHandle handle) { Ogre::TextAreaOverlayElement* toe = static_cast<Ogre::TextAreaOverlayElement*>(handle); toe->initialise(); }
//void _update(void); void textareaoverlayelement__update(TextAreaOverlayElementHandle handle) { Ogre::TextAreaOverlayElement* toe = static_cast<Ogre::TextAreaOverlayElement*>(handle); toe->_update(); }
//void setMaterialName(const String& matName); void textareaoverlayelement_set_material_name(TextAreaOverlayElementHandle handle, const char* mat_name) { Ogre::TextAreaOverlayElement* toe = static_cast<Ogre::TextAreaOverlayElement*>(handle); toe->setMaterialName(Ogre::String(mat_name)); }
GameplayScreen::GameplayScreen() { //Set up the 3D scene Ogre::SceneManager* mSceneManager = Ogre::Root::getSingletonPtr()->getSceneManager("ApplicationSceneManager"); Ogre::Entity* stageEntity = mSceneManager->createEntity("Stage", "Stage.mesh"); mStageNode = mSceneManager->getRootSceneNode()->createChildSceneNode("StageNode"); mStageNode->attachObject(stageEntity); mStageNode->setPosition(0.0f, -6.0f, -6.5f); //Set up game objects mWhacker = new Whacker(mSceneManager, mSceneManager->getRootSceneNode()); mWhacker->SetMovePlane(Ogre::Vector3(0.0f, 2.0f, 1.0f), Ogre::Vector3(0.0f, -0.5f, -6.5f), 3.8f, 3.0f); float dragonPositions[] = { -3.0f, -2.5f, -7.0f, -1.5f, -2.0f, -8.0f, -1.5f, -3.0f, -6.0f, 0.0f, -2.5f, -7.0f, 1.5f, -2.0f, -8.0f, 1.5f, -3.0f, -6.0f, 3.0f, -2.5f, -7.0f }; mDragons = std::vector<Dragon*>(); for (int i=0; i < 7; i++) { mDragons.push_back(new Dragon(mSceneManager, mSceneManager->getRootSceneNode())); mDragons[i]->SetPosition(Ogre::Vector3(dragonPositions[i*3], dragonPositions[(i*3)+1], dragonPositions[(i*3)+2])); } //Set up game variables timeBetweenPopups = 1.0f; timeSinceLastPopup = 0.0f; score = 0; numPeasants = 200; subtractPopTime = 0.05f; scorePerPopTimeSub = 15; minPopTime = 0.75f; mWhackerMoveScalar = 0.01f; //Lets set up our scoring overlay (Lots of uninteresting code :/ ) //Fonts are loaded due to a resource loading bug in OGRE 1.8 http://www.ogre3d.org/forums/viewtopic.php?f=2&t=63652 Ogre::FontManager::getSingleton().load( "YeOldShire", "General" ); Ogre::FontManager::getSingleton().load( "DejaVuSans", "General" ); //Title overlays Ogre::OverlayManager* overlayMgr = Ogre::OverlayManager::getSingletonPtr(); mOverlay = overlayMgr->create("GameStats"); Ogre::OverlayContainer* newContainer = static_cast<Ogre::OverlayContainer*>(overlayMgr->createOverlayElement("Panel", "StatsTitleContainer")); //Breaks Here newContainer->setMetricsMode(Ogre::GMM_RELATIVE); newContainer->setDimensions(0.4f, 0.15f); newContainer->setPosition(0.5f, 0.75f); newContainer->setHorizontalAlignment(Ogre::GHA_LEFT); Ogre::TextAreaOverlayElement* newElement = static_cast<Ogre::TextAreaOverlayElement*>(overlayMgr->createOverlayElement("TextArea", "ScoreTitleText")); newElement->setCaption("Score"); newElement->setFontName("YeOldShire"); newElement->setColour(Ogre::ColourValue(0.0f, 0.0f, 0.0f, 1.0f)); newElement->setAlignment(Ogre::TextAreaOverlayElement::Right); newElement->setVerticalAlignment(Ogre::GVA_TOP); newElement->setMetricsMode(Ogre::GMM_RELATIVE); newElement->setPosition(0, 0); newElement->setDimensions(0.4f, 0.4f); newElement->setCharHeight(0.028f); newContainer->addChild(newElement); newElement = static_cast<Ogre::TextAreaOverlayElement*>(overlayMgr->createOverlayElement("TextArea", "PeasantsTitleText")); newElement->setCaption("Peasants Left"); newElement->setFontName("YeOldShire"); newElement->setColour(Ogre::ColourValue(0.0f, 0.0f, 0.0f, 1.0f)); newElement->setAlignment(Ogre::TextAreaOverlayElement::Right); newElement->setVerticalAlignment(Ogre::GVA_BOTTOM); newElement->setMetricsMode(Ogre::GMM_RELATIVE); newElement->setPosition(0, 0); newElement->setDimensions(0.4f, 0.4f); newElement->setCharHeight(0.028f); newContainer->addChild(newElement); mOverlay->add2D(newContainer); //Value Overlays newContainer = static_cast<Ogre::OverlayContainer*>(overlayMgr->createOverlayElement("Panel", "StatsValueContainer")); newContainer->setMetricsMode(Ogre::GMM_RELATIVE); newContainer->setDimensions(0.4f, 0.15f); newContainer->setPosition(0.5f, 0.75f); newContainer->setHorizontalAlignment(Ogre::GHA_LEFT); newContainer->setColour(Ogre::ColourValue(1.0f, 1.0f, 1.0f, 0.3f)); newElement = static_cast<Ogre::TextAreaOverlayElement*>(overlayMgr->createOverlayElement("TextArea", "ScoreValueText")); Ogre::String num_str = Ogre::StringConverter::toString(score); newElement->setCaption(":"+num_str); newElement->setFontName("DejaVuSans"); newElement->setColour(Ogre::ColourValue(0.0f, 0.0f, 0.0f, 1.0f)); newElement->setAlignment(Ogre::TextAreaOverlayElement::Left); newElement->setVerticalAlignment(Ogre::GVA_TOP); newElement->setMetricsMode(Ogre::GMM_RELATIVE); newElement->setPosition(0, 0); newElement->setDimensions(0.4f, 0.4f); newElement->setCharHeight(0.045f); mScoreText = newElement; newContainer->addChild(newElement); newElement = static_cast<Ogre::TextAreaOverlayElement*>(overlayMgr->createOverlayElement("TextArea", "PeasantsValueText")); num_str = Ogre::StringConverter::toString(numPeasants); newElement->setCaption(":"+num_str); newElement->setFontName("DejaVuSans"); newElement->setColour(Ogre::ColourValue(0.0f, 0.0f, 0.0f, 1.0f)); newElement->setAlignment(Ogre::TextAreaOverlayElement::Left); newElement->setVerticalAlignment(Ogre::GVA_BOTTOM); newElement->setMetricsMode(Ogre::GMM_RELATIVE); newElement->setPosition(0, 0); newElement->setDimensions(0.4f, 0.4f); newElement->setCharHeight(0.045f); mPeasantText = newElement; newContainer->addChild(newElement); mOverlay->add2D(newContainer); mOverlay->show(); }
//void setSpaceWidth( Real width ); void textareaoverlayelement_set_space_width(TextAreaOverlayElementHandle handle, coiReal width) { Ogre::TextAreaOverlayElement* toe = static_cast<Ogre::TextAreaOverlayElement*>(handle); toe->setSpaceWidth(width); }
//void setAlignment( Alignment a ); void textareaoverlayelement_set_alignment(TextAreaOverlayElementHandle handle, textarea_overlayelement_alignment a) { Ogre::TextAreaOverlayElement* toe = static_cast<Ogre::TextAreaOverlayElement*>(handle); Ogre::TextAreaOverlayElement::Alignment align = llcoi_textarea_alignment_to_ogre_textarea_alignment(a); toe->setAlignment(align); }