Resuelto bug en las entradas de menus al dibujar elementos grises que previamente habian tenido el foco
This commit is contained in:
@@ -656,12 +656,14 @@ void Menu::render()
|
||||
SDL_RenderDrawRect(renderer, &rectBG.rect);
|
||||
}
|
||||
|
||||
// Renderiza el texto
|
||||
for (int i = 0; i < (int)item.size(); ++i)
|
||||
{
|
||||
// Crea una linea por si hay que dibujarla entre los items
|
||||
h_line_t line;
|
||||
line.x1 = selector.rect.x + (selector.rect.w / 6);
|
||||
line.x2 = line.x1 + ((selector.rect.w / 6) * 4);
|
||||
|
||||
// Renderiza el texto
|
||||
for (int i = 0; i < (int)item.size(); ++i)
|
||||
{
|
||||
if (item[i].visible)
|
||||
{
|
||||
// Comprueba si ha de dibujar una linea en el elemento del menu
|
||||
@@ -672,37 +674,38 @@ void Menu::render()
|
||||
SDL_RenderDrawLine(renderer, line.x1, line.y, line.x2, line.y);
|
||||
}
|
||||
|
||||
if (i == selector.index)
|
||||
{
|
||||
// Dibuja el elemento
|
||||
if (item[i].greyed)
|
||||
{ // Tiene prioridad si el elemento es gris
|
||||
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, colorGreyed);
|
||||
}
|
||||
|
||||
else if (i == selector.index)
|
||||
{ // A continuación si tiene el indice
|
||||
const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
|
||||
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, color);
|
||||
}
|
||||
|
||||
else if (i == selector.previousIndex)
|
||||
{
|
||||
{ // O si lo ha tenido
|
||||
const color_t color = {selector.previousItemColor.r, selector.previousItemColor.g, selector.previousItemColor.b};
|
||||
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, color);
|
||||
}
|
||||
|
||||
else if (item[i].selectable)
|
||||
{
|
||||
{ // O si simplemente es un elemento normal
|
||||
text->write(item[i].rect.x, item[i].rect.y, item[i].label);
|
||||
}
|
||||
|
||||
else if (item[i].greyed)
|
||||
{
|
||||
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, colorGreyed);
|
||||
}
|
||||
|
||||
else
|
||||
{ // No seleccionable
|
||||
{ // Si no es seleccionable
|
||||
if ((item[i].linkedUp) && (i == selector.index + 1))
|
||||
{
|
||||
{// Si el elemento está enlazado con el elemento superior se pinta del color del selector
|
||||
const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
|
||||
text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, color);
|
||||
}
|
||||
else // No enlazado con el de arriba
|
||||
{
|
||||
else
|
||||
{ // Si no está enlazado con el elemento superior se pinta con el color normal
|
||||
text->write(item[i].rect.x, item[i].rect.y, item[i].label);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,10 +226,10 @@ void EnterID::fillTexture()
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
// Añade el efecto de degradado en el fondo
|
||||
Texture *gradient = new Texture(renderer, asset->get("title_gradient.png"));
|
||||
SDL_Rect rect = {0, 0, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT};
|
||||
//Texture *gradient = new Texture(renderer, asset->get("title_gradient.png"));
|
||||
//SDL_Rect rect = {0, 0, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT};
|
||||
//gradient->render(renderer, 0, 0, &rect);
|
||||
delete gradient;
|
||||
//delete gradient;
|
||||
|
||||
// Escribe el texto en la textura
|
||||
const int desp = 40;
|
||||
|
||||
Reference in New Issue
Block a user