Compare commits
2 Commits
c79a846b29
...
987dcd0205
| Author | SHA1 | Date | |
|---|---|---|---|
| 987dcd0205 | |||
| d56f23544c |
@@ -80,11 +80,9 @@ void Logo::checkInput() {
|
|||||||
|
|
||||||
// Maneja la reproducción del sonido del logo
|
// Maneja la reproducción del sonido del logo
|
||||||
void Logo::handleSound() {
|
void Logo::handleSound() {
|
||||||
static bool sound_triggered = false;
|
if (!sound_triggered_ && elapsed_time_s_ >= SOUND_TRIGGER_TIME_S) {
|
||||||
|
|
||||||
if (!sound_triggered && elapsed_time_s_ >= SOUND_TRIGGER_TIME_S) {
|
|
||||||
Audio::get()->playSound("logo.wav");
|
Audio::get()->playSound("logo.wav");
|
||||||
sound_triggered = true;
|
sound_triggered_ = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ class Logo {
|
|||||||
float elapsed_time_s_ = 0.0f; // Tiempo transcurrido en segundos
|
float elapsed_time_s_ = 0.0f; // Tiempo transcurrido en segundos
|
||||||
Uint64 last_time_ = 0; // Último timestamp para calcular delta-time
|
Uint64 last_time_ = 0; // Último timestamp para calcular delta-time
|
||||||
SDL_FPoint dest_; // Posición donde dibujar el logo
|
SDL_FPoint dest_; // Posición donde dibujar el logo
|
||||||
|
bool sound_triggered_ = false; // Indica si el sonido del logo ya se reprodujo
|
||||||
|
|
||||||
// --- Métodos internos ---
|
// --- Métodos internos ---
|
||||||
void update(float delta_time); // Actualiza las variables
|
void update(float delta_time); // Actualiza las variables
|
||||||
|
|||||||
@@ -324,8 +324,17 @@ void MenuRenderer::precalculateMenuWidths(const std::vector<std::unique_ptr<Menu
|
|||||||
}
|
}
|
||||||
max_option_width = std::max(max_option_width, element_text_->length(option->getCaption(), -2));
|
max_option_width = std::max(max_option_width, element_text_->length(option->getCaption(), -2));
|
||||||
if (menu_state->getCurrentGroupAlignment() == ServiceMenu::GroupAlignment::LEFT) {
|
if (menu_state->getCurrentGroupAlignment() == ServiceMenu::GroupAlignment::LEFT) {
|
||||||
|
// Usar getMaxValueWidth() para considerar TODOS los valores posibles de la opción
|
||||||
|
int option_max_value_width = option->getMaxValueWidth(element_text_.get());
|
||||||
int max_available_value_width = static_cast<int>(max_menu_width_) - max_option_width - (ServiceMenu::OPTIONS_HORIZONTAL_PADDING * 2) - ServiceMenu::MIN_GAP_OPTION_VALUE;
|
int max_available_value_width = static_cast<int>(max_menu_width_) - max_option_width - (ServiceMenu::OPTIONS_HORIZONTAL_PADDING * 2) - ServiceMenu::MIN_GAP_OPTION_VALUE;
|
||||||
max_value_width = std::max(max_value_width, getTruncatedValueWidth(option->getValueAsString(), max_available_value_width));
|
|
||||||
|
if (option_max_value_width <= max_available_value_width) {
|
||||||
|
// Si el valor más largo cabe, usar su ancho real
|
||||||
|
max_value_width = std::max(max_value_width, option_max_value_width);
|
||||||
|
} else {
|
||||||
|
// Si no cabe, usar el ancho disponible (será truncado)
|
||||||
|
max_value_width = std::max(max_value_width, max_available_value_width);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
size_t total_width = max_option_width + (ServiceMenu::OPTIONS_HORIZONTAL_PADDING * 2);
|
size_t total_width = max_option_width + (ServiceMenu::OPTIONS_HORIZONTAL_PADDING * 2);
|
||||||
|
|||||||
Reference in New Issue
Block a user