Files
simian/include/TextureManager.h
nick d7add3964d
CI / build-and-test (push) Successful in 2m37s
Sync Docs to Gitea Wiki / Sync docs to Gitea wiki (push) Successful in 10s
feat: additonal components, updated docs
2026-03-09 17:37:29 +13:00

39 lines
854 B
C++

#pragma once
#include "raylib.h"
#include <string>
#include <unordered_map>
struct TextureSource {
std::string path;
};
class TextureManager
{
public:
TextureManager();
~TextureManager();
// Load a texture from a file
// Returns a unique ID for the texture, or 0 on failure
unsigned int Load(const std::string& path);
// Unload a texture by ID
void Unload(unsigned int id);
// Get a texture by ID (returns nullptr if not found)
Texture2D* Get(unsigned int id);
// Get source metadata for a texture if available
const TextureSource* GetSource(unsigned int id) const;
// Unload all textures
void UnloadAll();
private:
std::unordered_map<unsigned int, Texture2D> textures;
std::unordered_map<unsigned int, TextureSource> textureSources;
unsigned int nextId;
bool unloaded;
};