Corregido el bug de la asignacion de items del menu de la intro
This commit is contained in:
@@ -739,12 +739,12 @@ void Menu::addItem(std::string text, int hPaddingDown, bool selectable, bool gre
|
||||
{
|
||||
item_t temp;
|
||||
|
||||
if (item.size() == 0)
|
||||
if (item.empty())
|
||||
{// Si es el primer item coge la posición en el eje Y del propio menu
|
||||
temp.rect.y = y;
|
||||
}
|
||||
else
|
||||
{// En caso contrario, coge la posición en el eje Y a partir del elemento anterior
|
||||
{// En caso contrario, coge la posición en el eje Y a partir del último elemento
|
||||
temp.rect.y = item.back().rect.y + item.back().rect.h + item.back().hPaddingDown;
|
||||
}
|
||||
|
||||
@@ -758,11 +758,11 @@ void Menu::addItem(std::string text, int hPaddingDown, bool selectable, bool gre
|
||||
|
||||
setItemCaption(item.size() - 1, text);
|
||||
|
||||
if (item.size() > 0)
|
||||
if (item.size() > 1)
|
||||
{
|
||||
if (item[item.size() - 1].linkedDown)
|
||||
if (item.at(item.size() - 2).linkedDown)
|
||||
{
|
||||
item[item.size()].linkedUp = true;
|
||||
item.back().linkedUp = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -773,13 +773,13 @@ void Menu::addItem(std::string text, int hPaddingDown, bool selectable, bool gre
|
||||
// Cambia el texto de un item
|
||||
void Menu::setItemCaption(int index, std::string text)
|
||||
{
|
||||
item[index].label = text;
|
||||
item[index].rect.w = this->text->lenght(item[index].label);
|
||||
item[index].rect.h = this->text->getCharacterSize();
|
||||
item.at(index).label = text;
|
||||
item.at(index).rect.w = this->text->lenght(item.at(index).label);
|
||||
item.at(index).rect.h = this->text->getCharacterSize();
|
||||
reorganize();
|
||||
|
||||
const std::string texto = item[index].label + ":" + std::to_string(item[index].rect.w);
|
||||
printf("Adding menu item -> %s\n", texto.c_str());
|
||||
const std::string t = item.at(index).label + ":" + std::to_string(item.at(index).rect.w);
|
||||
printf("Adding menu item -> %s\n", t.c_str());
|
||||
}
|
||||
|
||||
// Establece el indice del itemm que se usará por defecto al cancelar el menu
|
||||
|
||||
Reference in New Issue
Block a user