GameObjects

Began to add GameObjects, starting with the player.
This commit is contained in:
onTheZero
2025-08-13 00:59:03 -04:00
parent 237272c17b
commit 4bf6b02255
37 changed files with 2640 additions and 222 deletions

33
ResourceManager.h Normal file
View File

@@ -0,0 +1,33 @@
#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);
};