本文整理汇总了C++中OverlayElement::setHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ OverlayElement::setHeight方法的具体用法?C++ OverlayElement::setHeight怎么用?C++ OverlayElement::setHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OverlayElement
的用法示例。
在下文中一共展示了OverlayElement::setHeight方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTextArea
//-----------------------------------------------------------------------
OverlayElement* Profiler::createTextArea(const String& name, Real width, Real height, Real top, Real left,
uint fontSize, const String& caption, bool show) {
OverlayElement* textArea =
OverlayManager::getSingleton().createOverlayElement("TextArea", name);
textArea->setMetricsMode(GMM_PIXELS);
textArea->setWidth(width);
textArea->setHeight(height);
textArea->setTop(top);
textArea->setLeft(left);
textArea->setParameter("font_name", "BlueHighway");
textArea->setParameter("char_height", StringConverter::toString(fontSize));
textArea->setCaption(caption);
textArea->setParameter("colour_top", "1 1 1");
textArea->setParameter("colour_bottom", "1 1 1");
if (show) {
textArea->show();
}
else {
textArea->hide();
}
return textArea;
}
示例2: addTextureDebugOverlay
void addTextureDebugOverlay( TrayLocation loc, const String& texname, size_t i )
{// Create material
String matName = "Ogre/DebugTexture" + StringConverter::toString( i );
MaterialPtr debugMat = MaterialManager::getSingleton().getByName( matName );
if( debugMat.isNull() )
{
debugMat = MaterialManager::getSingleton().create( matName,
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );
}
Pass* p = debugMat->getTechnique( 0 )->getPass( 0 );
p->removeAllTextureUnitStates();
p->setLightingEnabled( false );
TextureUnitState *t = p->createTextureUnitState( texname );
t->setTextureAddressingMode( TextureUnitState::TAM_CLAMP );
// create template
if( !OverlayManager::getSingleton().hasOverlayElement( "Ogre/DebugTexOverlay", true ) )
{
OverlayElement* e = OverlayManager::getSingleton().createOverlayElement( "Panel", "Ogre/DebugTexOverlay", true );
e->setMetricsMode( GMM_PIXELS );
e->setWidth( 128 );
e->setHeight( 128 );
}
// add widget
String widgetName = "DebugTex" + StringConverter::toString( i );
Widget* w = mTrayMgr->getWidget( widgetName );
if( !w )
{
w = mTrayMgr->createDecorWidget( loc, widgetName, "Ogre/DebugTexOverlay" );
}
w->getOverlayElement()->setMaterialName( matName );
}
示例3: _setOverlay
void _setOverlay(void)
{
mOverlayMgr = OverlayManager::getSingletonPtr();
mTextOverlay = mOverlayMgr->create("TextOverlay");
mPanel = static_cast<Ogre::OverlayContainer*>(mOverlayMgr->createOverlayElement("Panel", "container1"));
mPanel->setDimensions(1, 1);
mPanel->setPosition(-0.3f, 0.5f);
OverlayElement* textBox = mOverlayMgr->createOverlayElement("TextArea", "TextID");
textBox->setMetricsMode(Ogre::GMM_PIXELS);
textBox->setPosition(10, 10);
textBox->setWidth(100);
textBox->setHeight(20);
textBox->setParameter("font_name", "Font/NanumBold18");
textBox->setParameter("char_height", "40");
textBox->setColour(Ogre::ColourValue::White);
textBox->setCaption(L"한국산업기술대학교 이대현 선수");
mPanel->addChild(textBox);
mTextOverlay->add2D(mPanel);
mTextOverlay->show();
mLogoOverlay = OverlayManager::getSingleton().getByName("Overlay/KPU_LOGO");
mLogoOverlay->show();
mLogoOverlay = OverlayManager::getSingleton().getByName("Overlay/Information");
mLogoOverlay->show();
}
示例4: createPanel
//-----------------------------------------------------------------------
OverlayElement* OverlayProfileSessionListener::createPanel(const String& name, Real width, Real height, Real top, Real left,
const String& materialName, bool show)
{
OverlayElement* panel =
OverlayManager::getSingleton().createOverlayElement("Panel", name);
panel->setMetricsMode(GMM_PIXELS);
panel->setWidth(width);
panel->setHeight(height);
panel->setTop(top);
panel->setLeft(left);
panel->setMaterialName(materialName);
if (show) {
panel->show();
}
else {
panel->hide();
}
return panel;
}
示例5: displayResults
//-----------------------------------------------------------------------
void Profiler::displayResults() {
if (!mEnabled) {
return;
}
// if its time to update the display
if (!(mCurrentFrame % mUpdateDisplayFrequency)) {
ProfileHistoryList::iterator iter;
ProfileBarList::iterator bIter;
OverlayElement* g;
Real newGuiHeight = mGuiHeight;
int profileCount = 0;
Real maxTimeMillisecs = (Real)mMaxTotalFrameTime / 1000.0f;
// go through each profile and display it
for (iter = mProfileHistory.begin(), bIter = mProfileBars.begin();
iter != mProfileHistory.end() && bIter != mProfileBars.end();
++iter, ++bIter)
{
// display the profile's name and the number of times it was called in a frame
g = *bIter;
g->show();
g->setCaption(String((*iter).name + " (" + StringConverter::toString((*iter).numCallsThisFrame) + ")"));
g->setLeft(10 + (*iter).hierarchicalLvl * 15.0f);
// display the main bar that show the percentage of the frame time that this
// profile has taken
bIter++;
g = *bIter;
g->show();
// most of this junk has been set before, but we do this to get around a weird
// Ogre gui issue (bug?)
g->setMetricsMode(GMM_PIXELS);
g->setHeight(mBarHeight);
if (mDisplayMode == DISPLAY_PERCENTAGE)
g->setWidth(((*iter).currentTimePercent) * mGuiWidth);
else
g->setWidth(((*iter).currentTimeMillisecs / maxTimeMillisecs) * mGuiWidth);
g->setLeft(mGuiWidth);
g->setTop(mGuiBorderWidth + profileCount * (mBarHeight + mBarSpacing));
// display line to indicate the minimum frame time for this profile
bIter++;
g = *bIter;
g->show();
if (mDisplayMode == DISPLAY_PERCENTAGE)
g->setLeft(mBarIndent + (*iter).minTimePercent * mGuiWidth);
else
g->setLeft(mBarIndent + ((*iter).minTimeMillisecs / maxTimeMillisecs) * mGuiWidth);
// display line to indicate the maximum frame time for this profile
bIter++;
g = *bIter;
g->show();
if (mDisplayMode == DISPLAY_PERCENTAGE)
g->setLeft(mBarIndent + (*iter).maxTimePercent * mGuiWidth);
else
g->setLeft(mBarIndent + ((*iter).maxTimeMillisecs / maxTimeMillisecs) * mGuiWidth);
// display line to indicate the average frame time for this profile
bIter++;
g = *bIter;
g->show();
if ((*iter).totalCalls != 0)
if (mDisplayMode == DISPLAY_PERCENTAGE)
g->setLeft(mBarIndent + ((*iter).totalTimePercent / (*iter).totalCalls) * mGuiWidth);
else
g->setLeft(mBarIndent + (((*iter).totalTimeMillisecs / (*iter).totalCalls) / maxTimeMillisecs) * mGuiWidth);
else
g->setLeft(mBarIndent);
// display text
bIter++;
g = *bIter;
g->show();
if (mDisplayMode == DISPLAY_PERCENTAGE)
{
g->setLeft(mBarIndent + (*iter).currentTimePercent * mGuiWidth + 2);
g->setCaption(StringConverter::toString((*iter).currentTimePercent * 100.0f, 3, 3) + "%");
}
else
{
g->setLeft(mBarIndent + ((*iter).currentTimeMillisecs / maxTimeMillisecs) * mGuiWidth + 2);
g->setCaption(StringConverter::toString((*iter).currentTimeMillisecs, 3, 3) + "ms");
}
// we set the height of the display with respect to the number of profiles displayed
newGuiHeight += mBarHeight + mBarSpacing;
profileCount++;
//.........这里部分代码省略.........
示例6: displayResults
//-----------------------------------------------------------------------
void OverlayProfileSessionListener::displayResults(ProfileInstance* instance, ProfileBarList::const_iterator& bIter, Real& maxTimeMillisecs, Real& newGuiHeight, int& profileCount)
{
OverlayElement* g;
// display the profile's name and the number of times it was called in a frame
g = *bIter;
++bIter;
g->show();
g->setCaption(String(instance->name + " (" + StringConverter::toString(instance->history.numCallsThisFrame) + ")"));
g->setLeft(10 + instance->hierarchicalLvl * 15.0f);
// display the main bar that show the percentage of the frame time that this
// profile has taken
g = *bIter;
++bIter;
g->show();
// most of this junk has been set before, but we do this to get around a weird
// Ogre gui issue (bug?)
g->setMetricsMode(GMM_PIXELS);
g->setHeight(mBarHeight);
if (mDisplayMode == DISPLAY_PERCENTAGE)
g->setWidth( (instance->history.currentTimePercent) * mGuiWidth);
else
g->setWidth( (instance->history.currentTimeMillisecs / maxTimeMillisecs) * mGuiWidth);
g->setLeft(mGuiWidth);
g->setTop(mGuiBorderWidth + profileCount * (mBarHeight + mBarSpacing));
// display line to indicate the minimum frame time for this profile
g = *bIter;
++bIter;
g->show();
if(mDisplayMode == DISPLAY_PERCENTAGE)
g->setLeft(mBarIndent + instance->history.minTimePercent * mGuiWidth);
else
g->setLeft(mBarIndent + (instance->history.minTimeMillisecs / maxTimeMillisecs) * mGuiWidth);
// display line to indicate the maximum frame time for this profile
g = *bIter;
++bIter;
g->show();
if(mDisplayMode == DISPLAY_PERCENTAGE)
g->setLeft(mBarIndent + instance->history.maxTimePercent * mGuiWidth);
else
g->setLeft(mBarIndent + (instance->history.maxTimeMillisecs / maxTimeMillisecs) * mGuiWidth);
// display line to indicate the average frame time for this profile
g = *bIter;
++bIter;
g->show();
if(instance->history.totalCalls != 0)
{
if (mDisplayMode == DISPLAY_PERCENTAGE)
g->setLeft(mBarIndent + (instance->history.totalTimePercent / instance->history.totalCalls) * mGuiWidth);
else
g->setLeft(mBarIndent + ((instance->history.totalTimeMillisecs / instance->history.totalCalls) / maxTimeMillisecs) * mGuiWidth);
}
else
g->setLeft(mBarIndent);
// display text
g = *bIter;
++bIter;
g->show();
if (mDisplayMode == DISPLAY_PERCENTAGE)
{
g->setLeft(mBarIndent + instance->history.currentTimePercent * mGuiWidth + 2);
g->setCaption(StringConverter::toString(instance->history.currentTimePercent * 100.0f, 3, 3) + "%");
}
else
{
g->setLeft(mBarIndent + (instance->history.currentTimeMillisecs / maxTimeMillisecs) * mGuiWidth + 2);
g->setCaption(StringConverter::toString(instance->history.currentTimeMillisecs, 3, 3) + "ms");
}
// we set the height of the display with respect to the number of profiles displayed
newGuiHeight += mBarHeight + mBarSpacing;
++profileCount;
// display children
ProfileInstance::ProfileChildren::const_iterator it = instance->children.begin(), endit = instance->children.end();
for(;it != endit; ++it)
{
ProfileInstance* child = it->second;
displayResults(child, bIter, maxTimeMillisecs, newGuiHeight, profileCount);
}
}