- 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>
62 lines
1.8 KiB
C++
62 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "renderer_interface.h"
|
|
#include <SDL3/SDL_render.h>
|
|
#include <vector>
|
|
|
|
namespace vibe4 {
|
|
|
|
// Implementación básica usando SDL_Renderer como fallback
|
|
class SDLRenderer : public RendererInterface {
|
|
public:
|
|
SDLRenderer();
|
|
~SDLRenderer() override;
|
|
|
|
// Implementación de la interfaz
|
|
bool initialize(SDL_Window* window, int width, int height) override;
|
|
void shutdown() override;
|
|
|
|
bool beginFrame() override;
|
|
void endFrame() override;
|
|
void present() override;
|
|
|
|
void renderGradientBackground(
|
|
float top_r, float top_g, float top_b,
|
|
float bottom_r, float bottom_g, float bottom_b
|
|
) override;
|
|
|
|
void renderSpriteBatch(
|
|
const std::vector<SpriteData>& sprites,
|
|
void* texture_data
|
|
) override;
|
|
|
|
void setCRTParams(const CRTParams& params) override;
|
|
void enableCRT(bool enable) override;
|
|
|
|
BackendType getBackendType() const override { return BackendType::SDL; }
|
|
const char* getBackendName() const override { return "SDL Fallback"; }
|
|
|
|
void setVSync(bool enable) override;
|
|
void resize(int width, int height) override;
|
|
|
|
// Getter específico para compatibilidad con dbgtxt.h
|
|
SDL_Renderer* getSDLRenderer() const { return renderer_; }
|
|
|
|
private:
|
|
SDL_Renderer* renderer_ = nullptr;
|
|
SDL_Texture* sprite_texture_ = nullptr;
|
|
|
|
// Buffers para batch rendering
|
|
std::vector<SDL_Vertex> batch_vertices_;
|
|
std::vector<int> batch_indices_;
|
|
|
|
// Métodos auxiliares
|
|
void addSpriteToBatch(float x, float y, float w, float h, float r, float g, float b);
|
|
void clearBatch();
|
|
void renderBatch();
|
|
|
|
// Simulación básica de efectos CRT (sin shaders reales)
|
|
void applyCRTEffectsToColor(float& r, float& g, float& b, float x, float y);
|
|
};
|
|
|
|
} // namespace vibe4
|