Bottom menu reorganized

This commit is contained in:
2025-12-17 19:23:16 +01:00
parent a671825502
commit 122de2b36f
3 changed files with 83 additions and 85 deletions

View File

@ -66,7 +66,7 @@ void UIRenderer::drawButton(SDL_Renderer* renderer, FontAtlas* font, float cx, f
if (!textOnly) {
// Adjust colors based on state
if (isSelected) {
bgColor = {160, 190, 255, 255};
// Keep caller-provided colors; just add a stronger glow.
SDL_SetRenderDrawColor(renderer, 255, 220, 0, 110);
SDL_FRect glow{x - 10, y - 10, w + 20, h + 20};
SDL_RenderFillRect(renderer, &glow);
@ -134,17 +134,20 @@ void UIRenderer::drawButton(SDL_Renderer* renderer, FontAtlas* font, float cx, f
SDL_SetTextureColorMod(icon, 255, 255, 255);
SDL_SetTextureAlphaMod(icon, 255);
} else if (font) {
// Draw text (smaller scale for tighter buttons)
// Draw text with scale based on button height.
float textScale = 1.2f;
if (h <= 40.0f) {
textScale = 0.90f;
} else if (h <= 54.0f) {
textScale = 1.00f;
} else if (h <= 70.0f) {
textScale = 1.10f;
}
int textW = 0, textH = 0;
font->measure(label, textScale, textW, textH);
float tx = x + (w - static_cast<float>(textW)) * 0.5f;
// Adjust vertical position for better alignment with background buttons
// Vertically center text precisely within the button
// Vertically center text precisely within the button, then nudge down slightly
// to improve optical balance relative to icons and button art.
const float textNudge = 3.0f; // tweak this value to move labels up/down
float ty = y + (h - static_cast<float>(textH)) * 0.5f + textNudge;
// Vertically center text within the button.
float ty = y + (h - static_cast<float>(textH)) * 0.5f;
// Choose text color based on selection state
SDL_Color textColor = {255, 255, 255, 255}; // Default white