#pragma once #include // for SDL_Window #include // for SDL_Event #include // for SDL_Renderer #include // for unique_ptr #include // for string #include "backends/renderer_interface.h" namespace vibe4 { class WindowManager { public: WindowManager(); ~WindowManager(); // Inicialización y limpieza bool initialize(const char* title, int width, int height, int zoom = 1); void shutdown(); // Getters para la ventana SDL_Window* getWindow() const { return window_; } RendererInterface* getRenderer() const { return renderer_.get(); } // Getter específico para compatibilidad con dbgtxt.h SDL_Renderer* getSDLRenderer() const; // Sistema de render-to-texture para postprocesado bool setRenderTarget(); // Activa renderizado a textura lógica void presentFrame(); // Presenta textura final con zoom/efectos // Control de ventana void setTitle(const char* title); bool setFullscreen(bool enable); bool setRealFullscreen(bool enable); void setZoom(int zoom); int getZoom() const { return current_zoom_; } // Información de la ventana void getSize(int& width, int& height) const; void getLogicalSize(int& width, int& height) const; bool isFullscreen() const { return fullscreen_enabled_; } bool isRealFullscreen() const { return real_fullscreen_enabled_; } // Control de zoom dinámico int calculateMaxZoom() const; void zoomIn(); void zoomOut(); // Información del backend BackendType getBackendType() const; const char* getBackendName() const; private: // Recursos SDL SDL_Window* window_ = nullptr; std::unique_ptr renderer_; // Sistema de render-to-texture SDL_Texture* render_texture_ = nullptr; // Textura de resolución lógica // Estado de la ventana int logical_width_ = 0; int logical_height_ = 0; int current_zoom_ = 1; bool fullscreen_enabled_ = false; bool real_fullscreen_enabled_ = false; // Límites de zoom static constexpr int MIN_ZOOM = 1; static constexpr int MAX_ZOOM = 10; static constexpr int DESKTOP_MARGIN = 30; static constexpr int DECORATION_HEIGHT = 30; // Métodos privados BackendType detectBestBackend() const; std::unique_ptr createRenderer(BackendType type); void updateWindowSize(); bool createSDLWindow(const char* title, int width, int height); }; } // namespace vibe4