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

@@ -8,9 +8,9 @@
constexpr char WINDOW_CAPTION[] = "ViBe3 Physics (JailDesigner 2025)"; constexpr char WINDOW_CAPTION[] = "ViBe3 Physics (JailDesigner 2025)";
// Resolución por defecto (usada si no se especifica en CLI) // Resolución por defecto (usada si no se especifica en CLI)
constexpr int DEFAULT_SCREEN_WIDTH = 320; // Ancho lógico por defecto (si no hay -w) constexpr int DEFAULT_SCREEN_WIDTH = 640; // Ancho lógico por defecto (si no hay -w)
constexpr int DEFAULT_SCREEN_HEIGHT = 240; // Alto lógico por defecto (si no hay -h) constexpr int DEFAULT_SCREEN_HEIGHT = 360; // Alto lógico por defecto (si no hay -h)
constexpr int DEFAULT_WINDOW_ZOOM = 3; // Zoom inicial de ventana (1x = sin zoom) constexpr int DEFAULT_WINDOW_ZOOM = 2; // Zoom inicial de ventana (1x = sin zoom)
// Configuración de zoom dinámico de ventana // Configuración de zoom dinámico de ventana
constexpr int WINDOW_ZOOM_MIN = 1; // Zoom mínimo (320x240) constexpr int WINDOW_ZOOM_MIN = 1; // Zoom mínimo (320x240)
@@ -22,7 +22,6 @@ constexpr int WINDOW_DECORATION_HEIGHT = 30; // Altura estimada de decoraciones
constexpr float GRAVITY_FORCE = 0.2f; // Fuerza de gravedad (píxeles/frame²) constexpr float GRAVITY_FORCE = 0.2f; // Fuerza de gravedad (píxeles/frame²)
// Configuración de interfaz // Configuración de interfaz
constexpr Uint64 TEXT_DURATION = 2000; // Duración del texto informativo (ms) - OBSOLETO, usar NOTIFICATION_DURATION
constexpr float THEME_TRANSITION_DURATION = 0.5f; // Duración de transiciones LERP entre temas (segundos) constexpr float THEME_TRANSITION_DURATION = 0.5f; // Duración de transiciones LERP entre temas (segundos)
// Configuración de notificaciones (sistema Notifier) // Configuración de notificaciones (sistema Notifier)

View File

@@ -45,8 +45,8 @@ int main(int argc, char* argv[]) {
} else if (strcmp(argv[i], "-w") == 0 || strcmp(argv[i], "--width") == 0) { } else if (strcmp(argv[i], "-w") == 0 || strcmp(argv[i], "--width") == 0) {
if (i + 1 < argc) { if (i + 1 < argc) {
width = atoi(argv[++i]); width = atoi(argv[++i]);
if (width < 640) { if (width < 320) {
std::cerr << "Error: Ancho mínimo es 640px\n"; std::cerr << "Error: Ancho mínimo es 320\n";
return -1; return -1;
} }
} else { } else {
@@ -56,8 +56,8 @@ int main(int argc, char* argv[]) {
} else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--height") == 0) { } else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--height") == 0) {
if (i + 1 < argc) { if (i + 1 < argc) {
height = atoi(argv[++i]); height = atoi(argv[++i]);
if (height < 480) { if (height < 240) {
std::cerr << "Error: Alto mínimo es 480px\n"; std::cerr << "Error: Alto mínimo es 240\n";
return -1; return -1;
} }
} else { } else {

View File

@@ -39,16 +39,11 @@ static SDL_Rect getPhysicalViewport(SDL_Renderer* renderer) {
} }
UIManager::UIManager() UIManager::UIManager()
: text_renderer_(nullptr) : text_renderer_debug_(nullptr)
, text_renderer_debug_(nullptr)
, text_renderer_notifier_(nullptr) , text_renderer_notifier_(nullptr)
, notifier_(nullptr) , notifier_(nullptr)
, help_overlay_(nullptr) , help_overlay_(nullptr)
, show_debug_(false) , show_debug_(false)
, show_text_(true)
, text_()
, text_pos_(0)
, text_init_time_(0)
, fps_last_time_(0) , fps_last_time_(0)
, fps_frame_count_(0) , fps_frame_count_(0)
, fps_current_(0) , fps_current_(0)
@@ -63,7 +58,6 @@ UIManager::UIManager()
UIManager::~UIManager() { UIManager::~UIManager() {
// Limpieza: Los objetos creados con new deben ser eliminados // Limpieza: Los objetos creados con new deben ser eliminados
delete text_renderer_;
delete text_renderer_debug_; delete text_renderer_debug_;
delete text_renderer_notifier_; delete text_renderer_notifier_;
delete notifier_; delete notifier_;
@@ -81,12 +75,10 @@ void UIManager::initialize(SDL_Renderer* renderer, ThemeManager* theme_manager,
current_font_size_ = calculateFontSize(physical_width, physical_height); current_font_size_ = calculateFontSize(physical_width, physical_height);
// Crear renderers de texto // Crear renderers de texto
text_renderer_ = new TextRenderer();
text_renderer_debug_ = new TextRenderer(); text_renderer_debug_ = new TextRenderer();
text_renderer_notifier_ = new TextRenderer(); text_renderer_notifier_ = new TextRenderer();
// Inicializar renderers con tamaño dinámico // 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_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); 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_); 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 // Actualizar sistema de notificaciones
notifier_->update(current_time); notifier_->update(current_time);
} }
@@ -138,11 +125,6 @@ void UIManager::render(SDL_Renderer* renderer,
physical_window_width_ = physical_width; physical_window_width_ = physical_width;
physical_window_height_ = physical_height; 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 // Renderizar debug HUD si está activo
if (show_debug_) { if (show_debug_) {
renderDebugHUD(engine, scene_manager, current_mode, current_app_mode, 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; current_font_size_ = new_font_size;
// Reinicializar text renderers con nuevo tamaño // Reinicializar text renderers con nuevo tamaño
if (text_renderer_) {
text_renderer_->reinitialize(current_font_size_);
}
if (text_renderer_debug_) { if (text_renderer_debug_) {
text_renderer_debug_->reinitialize(current_font_size_); text_renderer_debug_->reinitialize(current_font_size_);
} }
@@ -211,13 +190,6 @@ void UIManager::updatePhysicalWindowSize(int width, int height) {
notifier_->updateWindowSize(width, 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 === // === Métodos privados ===
void UIManager::renderDebugHUD(const Engine* engine, 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 { std::string UIManager::gravityDirectionToString(int direction) const {
switch (direction) { switch (direction) {
case 0: return "Abajo"; // DOWN case 0: return "Abajo"; // DOWN

View File

@@ -111,14 +111,6 @@ class UIManager {
*/ */
void updatePhysicalWindowSize(int width, int height); 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 === // === Getters ===
/** /**
@@ -131,11 +123,6 @@ class UIManager {
*/ */
int getCurrentFPS() const { return fps_current_; } int getCurrentFPS() const { return fps_current_; }
/**
* @brief Verifica si texto obsoleto está visible
*/
bool isTextObsoleteVisible() const { return show_text_; }
private: private:
/** /**
* @brief Renderiza HUD de debug (solo si show_debug_ == true) * @brief Renderiza HUD de debug (solo si show_debug_ == true)
@@ -153,12 +140,6 @@ class UIManager {
const Shape* active_shape, const Shape* active_shape,
float shape_convergence); 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 * @brief Convierte dirección de gravedad a string
* @param direction Dirección como int (cast de GravityDirection) * @param direction Dirección como int (cast de GravityDirection)
@@ -175,7 +156,6 @@ class UIManager {
int calculateFontSize(int physical_width, int physical_height) const; int calculateFontSize(int physical_width, int physical_height) const;
// === Recursos de renderizado === // === Recursos de renderizado ===
TextRenderer* text_renderer_; // Texto obsoleto (DEPRECATED)
TextRenderer* text_renderer_debug_; // HUD de debug TextRenderer* text_renderer_debug_; // HUD de debug
TextRenderer* text_renderer_notifier_; // Notificaciones TextRenderer* text_renderer_notifier_; // Notificaciones
Notifier* notifier_; // Sistema de notificaciones Notifier* notifier_; // Sistema de notificaciones
@@ -183,12 +163,6 @@ class UIManager {
// === Estado de UI === // === Estado de UI ===
bool show_debug_; // HUD de debug activo (tecla F12) 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 === // === Sistema de FPS ===
Uint64 fps_last_time_; // Último tiempo de actualización de FPS Uint64 fps_last_time_; // Último tiempo de actualización de FPS