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