本文整理汇总了C++中ogre::TextAreaOverlayElement::setCaption方法的典型用法代码示例。如果您正苦于以下问题:C++ TextAreaOverlayElement::setCaption方法的具体用法?C++ TextAreaOverlayElement::setCaption怎么用?C++ TextAreaOverlayElement::setCaption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::TextAreaOverlayElement
的用法示例。
在下文中一共展示了TextAreaOverlayElement::setCaption方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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));
}
}
示例2: updateLevel
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);
}
示例3: updateScore
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);
}
示例4: createChildTextArea
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
示例5: log
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)));
}
}
示例6: Whacker
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);
//.........这里部分代码省略.........
示例7: textareaoverlayelement_set_caption
//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));
}