- bugfix for text placement in progress bars

This commit is contained in:
Mark Vejvoda 2011-08-30 21:48:32 +00:00
parent a9f5563ab7
commit 3eb375904c
3 changed files with 48 additions and 15 deletions

View File

@ -1633,6 +1633,8 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i
//pos.y += (lineHeight / 2.f); // y starts at the middle of the render position, so only move up 1/2 the font height
if(lineHeight < h) {
//printf("line %d, lineHeight [%f] h [%d] text [%s]\n",__LINE__,lineHeight,h,text.c_str());
//int realHeight = lineHeight + (h - lineHeight);
// First go to top of bounding box
pos.y += (h - lineHeight);
@ -1643,6 +1645,15 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i
//pos.y -= (realHeight / 2);
//pos.y += (lineHeight / 2);
}
else if(lineHeight > h) {
//printf("line %d, lineHeight [%f] h [%d] text [%s]\n",__LINE__,lineHeight,h,text.c_str());
#ifdef USE_STREFLOP
pos.y += (streflop::ceil((float)lineHeight - (float)h));
#else
pos.y += (ceil(lineHeight - h));
#endif
}
}
return pos;
}
@ -5804,7 +5815,7 @@ void Renderer::renderArrow(const Vec3f &pos1, const Vec3f &pos2,
void Renderer::renderProgressBar3D(int size, int x, int y, Font3D *font, int customWidth,
string prefixLabel,bool centeredText) {
int progressbarHeight = 10;
int progressbarHeight = 12;
int currentSize = size;
int maxSize = maxProgressBar;
string renderText = intToStr(static_cast<int>(size)) + "%";

View File

@ -1023,12 +1023,22 @@ void MenuStateConnectedGame::render() {
string progressLabelPrefix = lang.get("ModDownloading") + " " + iterMap->first + " ";
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\nRendering file progress with the following prefix [%s]\n",progressLabelPrefix.c_str());
renderer.renderProgressBar(
iterMap->second.first,
10,
yLocation,
CoreData::getInstance().getDisplayFontSmall(),
350,progressLabelPrefix);
if(Renderer::renderText3DEnabled) {
renderer.renderProgressBar3D(
iterMap->second.first,
10,
yLocation,
CoreData::getInstance().getDisplayFontSmall3D(),
350,progressLabelPrefix);
}
else {
renderer.renderProgressBar(
iterMap->second.first,
10,
yLocation,
CoreData::getInstance().getDisplayFontSmall(),
350,progressLabelPrefix);
}
yLocation -= 10;
}

View File

@ -1914,14 +1914,26 @@ void MenuStateMods::render() {
string progressLabelPrefix = lang.get("ModDownloading") + " " + extractFileFromDirectoryPath(iterMap->first) + " ";
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\nRendering file progress with the following prefix [%s]\n",progressLabelPrefix.c_str());
renderer.renderProgressBar(
iterMap->second.first,
//10,
//yLocation,
xLocation,
yLocation,
CoreData::getInstance().getDisplayFontSmall(),
185,progressLabelPrefix,false);
if(Renderer::renderText3DEnabled) {
renderer.renderProgressBar3D(
iterMap->second.first,
//10,
//yLocation,
xLocation,
yLocation,
CoreData::getInstance().getDisplayFontSmall3D(),
185,progressLabelPrefix,false);
}
else {
renderer.renderProgressBar(
iterMap->second.first,
//10,
//yLocation,
xLocation,
yLocation,
CoreData::getInstance().getDisplayFontSmall(),
185,progressLabelPrefix,false);
}
yLocation -= 14;
}