SISTEMA DE RELEASE (Makefile): - Adaptado windows_release de Coffee Crisis a ViBe3 Physics - Comandos Unix-style (rm/cp/mkdir) compatibles con Git Bash/MSYS2 - Compresión ZIP via PowerShell Compress-Archive - LICENSE opcional (si no existe, continúa) - Genera: vibe3_physics-YYYY-MM-DD-win32-x64.zip CARGA DINÁMICA DE RECURSOS: - Añadido Texture::getPackResourceList() - Lista recursos del pack - Añadido Texture::isPackLoaded() - Verifica si pack está cargado - engine.cpp: Descubrimiento dinámico de texturas desde pack - Sin listas hardcodeadas - Usa ResourcePack::getResourceList() - Filtra recursos por patrón "balls/*.png" automáticamente ARQUITECTURA: - Descubrimiento de texturas híbrido: 1. Si existe data/balls/ → escanear disco 2. Si no existe + pack cargado → listar desde pack 3. Ordenar por tamaño (automático) TESTING CONFIRMADO: - ✅ Release con resources.pack funciona sin data/ - ✅ Carga 4 texturas desde pack dinámicamente - ✅ make windows_release genera ZIP válido - ✅ Ejecutable arranca correctamente desde release/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <SDL3/SDL_rect.h> // Para SDL_FRect
|
|
#include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_Texture
|
|
|
|
#include <string> // Para std::string
|
|
#include <vector> // Para std::vector
|
|
|
|
class Texture {
|
|
private:
|
|
SDL_Renderer *renderer_;
|
|
SDL_Texture *texture_;
|
|
|
|
// Dimensiones de la imagen
|
|
int width_;
|
|
int height_;
|
|
|
|
public:
|
|
// Sistema de recursos empaquetados (inicializar desde main)
|
|
static void initResourceSystem(const std::string& packFilePath);
|
|
static std::vector<std::string> getPackResourceList();
|
|
static bool isPackLoaded();
|
|
|
|
// Inicializa las variables
|
|
explicit Texture(SDL_Renderer *renderer);
|
|
Texture(SDL_Renderer *renderer, const std::string &file_path);
|
|
|
|
// Libera la memoria
|
|
~Texture();
|
|
|
|
// Carga una imagen desde la ruta especificada
|
|
bool loadFromFile(const std::string &path);
|
|
|
|
// Libera la textura
|
|
void free();
|
|
|
|
// Renderiza la textura en el punto especificado
|
|
void render(SDL_FRect *src = nullptr, SDL_FRect *dst = nullptr);
|
|
|
|
// Obtiene las dimensiones de la imagen
|
|
int getWidth();
|
|
int getHeight();
|
|
|
|
// Modula el color de la textura
|
|
void setColor(int r, int g, int b);
|
|
|
|
// Getter para batch rendering
|
|
SDL_Texture *getSDLTexture() const { return texture_; }
|
|
};
|