mirror of
https://github.com/glest/glest-source.git
synced 2025-02-25 12:12:25 +01:00
fixed UI placement of playername in menus
This commit is contained in:
parent
30e1f45cc7
commit
5dcd9d8714
@ -244,7 +244,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
|||||||
listBoxMap.setEditable(false);
|
listBoxMap.setEditable(false);
|
||||||
|
|
||||||
labelMapInfo.registerGraphicComponent(containerName,"labelMapInfo");
|
labelMapInfo.registerGraphicComponent(containerName,"labelMapInfo");
|
||||||
labelMapInfo.init(xoffset+100, mapPos-labelOffset-6, 200, 40);
|
labelMapInfo.init(xoffset+100, mapPos-labelOffset-10, 200, 40);
|
||||||
labelMapInfo.setText("?");
|
labelMapInfo.setText("?");
|
||||||
|
|
||||||
labelMap.registerGraphicComponent(containerName,"labelMap");
|
labelMap.registerGraphicComponent(containerName,"labelMap");
|
||||||
|
@ -227,7 +227,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu,
|
|||||||
listBoxMap.setSelectedItemIndex(initialMapSelection);
|
listBoxMap.setSelectedItemIndex(initialMapSelection);
|
||||||
|
|
||||||
labelMapInfo.registerGraphicComponent(containerName,"labelMapInfo");
|
labelMapInfo.registerGraphicComponent(containerName,"labelMapInfo");
|
||||||
labelMapInfo.init(xoffset+100, mapPos-labelOffset-6, 200, 40);
|
labelMapInfo.init(xoffset+100, mapPos-labelOffset-10, 200, 40);
|
||||||
|
|
||||||
// MapFilter
|
// MapFilter
|
||||||
labelMapFilter.registerGraphicComponent(containerName,"labelMapFilter");
|
labelMapFilter.registerGraphicComponent(containerName,"labelMapFilter");
|
||||||
@ -1679,18 +1679,21 @@ void MenuStateCustomGame::render() {
|
|||||||
const Metrics &metrics= Metrics::getInstance();
|
const Metrics &metrics= Metrics::getInstance();
|
||||||
FontMetrics *fontMetrics= NULL;
|
FontMetrics *fontMetrics= NULL;
|
||||||
if(Renderer::renderText3DEnabled == false) {
|
if(Renderer::renderText3DEnabled == false) {
|
||||||
fontMetrics = CoreData::getInstance().getMenuFontNormal()->getMetrics();
|
fontMetrics = labelPlayers[i].getFont()->getMetrics();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fontMetrics = CoreData::getInstance().getMenuFontNormal3D()->getMetrics();
|
fontMetrics = labelPlayers[i].getFont3D()->getMetrics();
|
||||||
}
|
}
|
||||||
if(fontMetrics == NULL) {
|
if(fontMetrics == NULL) {
|
||||||
throw runtime_error("fontMetrics == NULL");
|
throw runtime_error("fontMetrics == NULL");
|
||||||
}
|
}
|
||||||
int curWidth = (metrics.toVirtualX(fontMetrics->getTextWidth(labelPlayers[i].getText())));
|
//int curWidth = (metrics.toVirtualX(fontMetrics->getTextWidth(labelPlayers[i].getText())));
|
||||||
|
int curWidth = (fontMetrics->getTextWidth(labelPlayers[i].getText()));
|
||||||
|
int newOffsetPosition = labelPlayers[i].getX() + curWidth + 2;
|
||||||
|
|
||||||
|
//printf("labelPlayers[i].getX() = %d curWidth = %d labelPlayerNames[i].getX() = %d offsetPosition = %d newOffsetPosition = %d [%s]\n",labelPlayers[i].getX(),curWidth,labelPlayerNames[i].getX(),offsetPosition,newOffsetPosition,labelPlayers[i].getText().c_str());
|
||||||
|
|
||||||
if(labelPlayers[i].getX() + curWidth >= labelPlayerNames[i].getX()) {
|
if(labelPlayers[i].getX() + curWidth >= labelPlayerNames[i].getX()) {
|
||||||
int newOffsetPosition = labelPlayers[i].getX() + curWidth + 2;
|
|
||||||
if(offsetPosition < newOffsetPosition) {
|
if(offsetPosition < newOffsetPosition) {
|
||||||
offsetPosition = newOffsetPosition;
|
offsetPosition = newOffsetPosition;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,9 @@ Text * FontMetrics::getTextHandler() {
|
|||||||
|
|
||||||
float FontMetrics::getTextWidth(const string &str) {
|
float FontMetrics::getTextWidth(const string &str) {
|
||||||
if(textHandler != NULL) {
|
if(textHandler != NULL) {
|
||||||
return (textHandler->Advance(str.c_str()) * Font::scaleFontValue);
|
//printf("str [%s] textHandler->Advance = %f Font::scaleFontValue = %f\n",str.c_str(),textHandler->Advance(str.c_str()),Font::scaleFontValue);
|
||||||
|
//return (textHandler->Advance(str.c_str()) * Font::scaleFontValue);
|
||||||
|
return (textHandler->Advance(str.c_str()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float width= 0.f;
|
float width= 0.f;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user