Trabajando en el menu del titulo
This commit is contained in:
@@ -192,7 +192,7 @@ int Menu::getWidestItem()
|
||||
int result = 0;
|
||||
|
||||
// Obtenemos la anchura del item mas ancho
|
||||
for (auto i : item)
|
||||
for (auto &i : item)
|
||||
{
|
||||
result = std::max(result, i.rect.w);
|
||||
}
|
||||
@@ -416,7 +416,7 @@ void Menu::centerMenuOnX(int value)
|
||||
x = (value) - (findWidth() / 2);
|
||||
|
||||
// Reposiciona los elementos del menu
|
||||
for (auto i : item)
|
||||
for (auto &i : item)
|
||||
{
|
||||
i.rect.x = x;
|
||||
}
|
||||
@@ -446,7 +446,7 @@ void Menu::centerMenuElementsOnX()
|
||||
{
|
||||
areElementsCenteredOnX = true;
|
||||
|
||||
for (auto i : item)
|
||||
for (auto &i : item)
|
||||
{
|
||||
i.rect.x = (centerX - (i.rect.w / 2));
|
||||
}
|
||||
@@ -495,6 +495,9 @@ void Menu::setItemCaption(int index, std::string text)
|
||||
item[index].rect.w = this->text->lenght(item[index].label);
|
||||
item[index].rect.h = this->text->getCharacterWidth();
|
||||
reorganize();
|
||||
|
||||
const std::string texto = item[index].label + ":" + std::to_string(item[index].rect.w);
|
||||
printf("Adding menu item -> %s\n", texto.c_str());
|
||||
}
|
||||
|
||||
// Establece el indice del itemm que se usará por defecto al cancelar el menu
|
||||
@@ -559,7 +562,7 @@ int Menu::findHeight()
|
||||
int height = 0;
|
||||
|
||||
// Obtenemos la altura de la suma de alturas de los items
|
||||
for (auto i : item)
|
||||
for (auto &i : item)
|
||||
{
|
||||
height += i.rect.h + i.hPaddingDown;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user