Files
LearningOpenGL/ResourceManager.h
onTheZero 4bf6b02255 GameObjects
Began to add GameObjects, starting with the player.
2025-08-13 00:59:03 -04:00

34 lines
1.2 KiB
C++

#pragma once
#include <map>
#include <string>
#include <glad/glad.h>
#include "Shader.h"
#include "LevelMap.h"
class ResourceManager
{
public:
// resource storage
static std::map<std::string, Shader> shaders;
static std::map<std::string, LevelMap> levelMaps;
// loads (and generates) a shader program from file loading vertex, fragment (and geometry) shader's source code. If gShaderFile is not nullptr, it also loads a geometry shader
static Shader LoadShader(const char* vShaderFile, const char* fShaderFile, const char* gShaderFile, std::string name);
// retrieves a stored sader
static Shader GetShader(std::string name);
// properly de-allocates all loaded resources
static void Clear();
static LevelMap LoadLevelMap(const char* filePath, std::string name);
private:
// private constructor, that is we do not want any actual resource manager objects. Its members and functions should be publicly available (static).
ResourceManager() { }
// loads and generates a shader from file
static Shader LoadShaderFromFile(const char* vShaderFile, const char* fShaderFile, const char* gShaderFile = nullptr);
static LevelMap LoadLevelMapFromFile(const char* filePath);
};