Eliminado código DEPRECATED de ui_manager

This commit is contained in:
2025-10-19 15:02:13 +02:00
parent f25cb96a91
commit ce50a29019
4 changed files with 8 additions and 84 deletions

View File

@@ -39,16 +39,11 @@ static SDL_Rect getPhysicalViewport(SDL_Renderer* renderer) {
}
UIManager::UIManager()
: text_renderer_(nullptr)
, text_renderer_debug_(nullptr)
: text_renderer_debug_(nullptr)
, text_renderer_notifier_(nullptr)
, notifier_(nullptr)
, help_overlay_(nullptr)
, show_debug_(false)
, show_text_(true)
, text_()
, text_pos_(0)
, text_init_time_(0)
, fps_last_time_(0)
, fps_frame_count_(0)
, fps_current_(0)
@@ -63,7 +58,6 @@ UIManager::UIManager()
UIManager::~UIManager() {
// Limpieza: Los objetos creados con new deben ser eliminados
delete text_renderer_;
delete text_renderer_debug_;
delete text_renderer_notifier_;
delete notifier_;
@@ -81,12 +75,10 @@ void UIManager::initialize(SDL_Renderer* renderer, ThemeManager* theme_manager,
current_font_size_ = calculateFontSize(physical_width, physical_height);
// Crear renderers de texto
text_renderer_ = new TextRenderer();
text_renderer_debug_ = new TextRenderer();
text_renderer_notifier_ = new TextRenderer();
// Inicializar renderers con tamaño dinámico
text_renderer_->init(renderer, "data/fonts/FunnelSans-Regular.ttf", current_font_size_, true);
text_renderer_debug_->init(renderer, "data/fonts/FunnelSans-Regular.ttf", current_font_size_, true);
text_renderer_notifier_->init(renderer, "data/fonts/FunnelSans-Regular.ttf", current_font_size_, true);
@@ -115,11 +107,6 @@ void UIManager::update(Uint64 current_time, float delta_time) {
fps_text_ = "fps: " + std::to_string(fps_current_);
}
// Actualizar texto obsoleto (DEPRECATED)
if (show_text_) {
show_text_ = !(SDL_GetTicks() - text_init_time_ > TEXT_DURATION);
}
// Actualizar sistema de notificaciones
notifier_->update(current_time);
}
@@ -138,11 +125,6 @@ void UIManager::render(SDL_Renderer* renderer,
physical_window_width_ = physical_width;
physical_window_height_ = physical_height;
// Renderizar texto obsoleto centrado (DEPRECATED - mantener temporalmente)
if (show_text_) {
renderObsoleteText(current_screen_width);
}
// Renderizar debug HUD si está activo
if (show_debug_) {
renderDebugHUD(engine, scene_manager, current_mode, current_app_mode,
@@ -191,9 +173,6 @@ void UIManager::updatePhysicalWindowSize(int width, int height) {
current_font_size_ = new_font_size;
// Reinicializar text renderers con nuevo tamaño
if (text_renderer_) {
text_renderer_->reinitialize(current_font_size_);
}
if (text_renderer_debug_) {
text_renderer_debug_->reinitialize(current_font_size_);
}
@@ -211,13 +190,6 @@ void UIManager::updatePhysicalWindowSize(int width, int height) {
notifier_->updateWindowSize(width, height);
}
void UIManager::setTextObsolete(const std::string& text, int pos, int current_screen_width) {
text_ = text;
text_pos_ = pos;
text_init_time_ = SDL_GetTicks();
show_text_ = true;
}
// === Métodos privados ===
void UIManager::renderDebugHUD(const Engine* engine,
@@ -424,27 +396,6 @@ void UIManager::renderDebugHUD(const Engine* engine,
}
}
void UIManager::renderObsoleteText(int current_screen_width) {
// DEPRECATED: Sistema antiguo de texto centrado
// Mantener por compatibilidad temporal hasta migrar todo a Notifier
// Calcular escala dinámica basada en resolución física
float text_scale_x = static_cast<float>(physical_window_width_) / 426.0f;
float text_scale_y = static_cast<float>(physical_window_height_) / 240.0f;
// Obtener color del tema actual (LERP interpolado)
int margin = 8;
Color text_color = theme_manager_->getInterpolatedColor(0);
int text_color_r = text_color.r;
int text_color_g = text_color.g;
int text_color_b = text_color.b;
// Renderizar texto centrado usando coordenadas físicas
text_renderer_->printPhysical(text_pos_, margin, text_.c_str(),
text_color_r, text_color_g, text_color_b,
text_scale_x, text_scale_y);
}
std::string UIManager::gravityDirectionToString(int direction) const {
switch (direction) {
case 0: return "Abajo"; // DOWN

View File

@@ -111,14 +111,6 @@ class UIManager {
*/
void updatePhysicalWindowSize(int width, int height);
/**
* @brief Establece texto obsoleto (DEPRECATED - usar Notifier en su lugar)
* @param text Texto a mostrar
* @param pos Posición X del texto
* @param current_screen_width Ancho de pantalla (para cálculos)
*/
void setTextObsolete(const std::string& text, int pos, int current_screen_width);
// === Getters ===
/**
@@ -131,11 +123,6 @@ class UIManager {
*/
int getCurrentFPS() const { return fps_current_; }
/**
* @brief Verifica si texto obsoleto está visible
*/
bool isTextObsoleteVisible() const { return show_text_; }
private:
/**
* @brief Renderiza HUD de debug (solo si show_debug_ == true)
@@ -153,12 +140,6 @@ class UIManager {
const Shape* active_shape,
float shape_convergence);
/**
* @brief Renderiza texto obsoleto centrado (DEPRECATED)
* @param current_screen_width Ancho lógico de pantalla
*/
void renderObsoleteText(int current_screen_width);
/**
* @brief Convierte dirección de gravedad a string
* @param direction Dirección como int (cast de GravityDirection)
@@ -175,7 +156,6 @@ class UIManager {
int calculateFontSize(int physical_width, int physical_height) const;
// === Recursos de renderizado ===
TextRenderer* text_renderer_; // Texto obsoleto (DEPRECATED)
TextRenderer* text_renderer_debug_; // HUD de debug
TextRenderer* text_renderer_notifier_; // Notificaciones
Notifier* notifier_; // Sistema de notificaciones
@@ -183,12 +163,6 @@ class UIManager {
// === Estado de UI ===
bool show_debug_; // HUD de debug activo (tecla F12)
bool show_text_; // Texto obsoleto visible (DEPRECATED)
// === Sistema de texto obsoleto (DEPRECATED) ===
std::string text_; // Texto a mostrar
int text_pos_; // Posición X del texto
Uint64 text_init_time_; // Tiempo de inicio de texto
// === Sistema de FPS ===
Uint64 fps_last_time_; // Último tiempo de actualización de FPS