31 lines
663 B
C++
31 lines
663 B
C++
#pragma once
|
|
|
|
#include "raylib.h"
|
|
#include <unordered_map>
|
|
#include <string>
|
|
|
|
class ShaderManager
|
|
{
|
|
public:
|
|
ShaderManager();
|
|
~ShaderManager();
|
|
|
|
// Load a shader from vertex and fragment shader files
|
|
// Returns a unique ID for the shader, or 0 on failure
|
|
unsigned int Load(const std::string& vsPath, const std::string& fsPath);
|
|
|
|
// Unload a shader by ID
|
|
void Unload(unsigned int id);
|
|
|
|
// Get a shader by ID (returns nullptr if not found)
|
|
Shader* Get(unsigned int id);
|
|
|
|
// Unload all shaders
|
|
void UnloadAll();
|
|
|
|
private:
|
|
std::unordered_map<unsigned int, Shader> shaders;
|
|
unsigned int nextId;
|
|
bool unloaded;
|
|
};
|