Files
vibe4_shaders/source/window_manager.h
Sergio Valor dab71d41b6 Arreglar degradado de fondo restaurando campo alpha en SDL_Vertex
- Identificado que SDL_RenderGeometry requiere campo alpha en SDL_Vertex
- Restaurada implementación original con alpha=1.0f en todos los vértices
- Eliminado código debug temporal y workaround con SDL_RenderFillRect
- El degradado de fondo ahora funciona correctamente como en la versión original

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-28 07:58:29 +02:00

83 lines
2.5 KiB
C++

#pragma once
#include <SDL3/SDL_video.h> // for SDL_Window
#include <SDL3/SDL_events.h> // for SDL_Event
#include <SDL3/SDL_render.h> // for SDL_Renderer
#include <memory> // for unique_ptr
#include <string> // 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<RendererInterface> 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 = 10;
static constexpr int DECORATION_HEIGHT = 30;
// Métodos privados
BackendType detectBestBackend() const;
std::unique_ptr<RendererInterface> createRenderer(BackendType type);
void updateWindowSize();
bool createSDLWindow(const char* title, int width, int height);
};
} // namespace vibe4