#pragma once #include #include // Forward declarations struct SDL_Window; namespace vibe4 { // Tipos de backend disponibles enum class BackendType { METAL, // macOS VULKAN, // Windows/Linux SDL // Fallback básico }; // Estructura para vértices de sprite struct SpriteVertex { float x, y; // Posición float u, v; // Coordenadas de textura float r, g, b, a; // Color }; // Estructura para datos de sprite individual struct SpriteData { float x, y, w, h; // Posición y tamaño float r, g, b; // Color RGB (0-255) }; // Parámetros de efectos CRT struct CRTParams { float scanline_intensity = 0.5f; float curvature_x = 0.1f; float curvature_y = 0.1f; float bloom_factor = 1.2f; float mask_brightness = 0.8f; bool enable_scanlines = true; bool enable_curvature = true; bool enable_bloom = true; }; // Interfaz común para todos los backends de renderizado class RendererInterface { public: virtual ~RendererInterface() = default; // Inicialización y limpieza virtual bool initialize(SDL_Window* window, int width, int height) = 0; virtual void shutdown() = 0; // Control de renderizado virtual bool beginFrame() = 0; virtual void endFrame() = 0; virtual void present() = 0; // Renderizado de fondo degradado virtual void renderGradientBackground( float top_r, float top_g, float top_b, float bottom_r, float bottom_g, float bottom_b ) = 0; // Batch rendering de sprites virtual void renderSpriteBatch( const std::vector& sprites, void* texture_data ) = 0; // Control de efectos CRT virtual void setCRTParams(const CRTParams& params) = 0; virtual void enableCRT(bool enable) = 0; // Información del backend virtual BackendType getBackendType() const = 0; virtual const char* getBackendName() const = 0; // Control de V-Sync virtual void setVSync(bool enable) = 0; // Redimensionado virtual void resize(int width, int height) = 0; protected: // Datos comunes int screen_width_ = 0; int screen_height_ = 0; SDL_Window* window_ = nullptr; CRTParams crt_params_; bool crt_enabled_ = true; bool vsync_enabled_ = true; }; } // namespace vibe4