stuff
This commit is contained in:
+22
-9
@@ -1,20 +1,33 @@
|
||||
#ifndef RESOURCE_MANAGER_CLASS
|
||||
#define RESOURCE_MANAGER_CLASS
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "Folder.h"
|
||||
//#include "font.h"
|
||||
#include "Model.h"
|
||||
#include "SoundSystem.h"
|
||||
class Texture;
|
||||
class Font;
|
||||
|
||||
// Owns every texture and font, so each file only loads once however many things use it.
|
||||
// Sounds are cached by SoundSystem, rigs and animations by CharacterManager.
|
||||
class ResourceManager {
|
||||
public:
|
||||
//std::vector<Font*> fonts;
|
||||
std::vector<Model*> models;
|
||||
std::vector<SoundData*> sounds;
|
||||
public:
|
||||
ResourceManager() {}
|
||||
~ResourceManager(); // needs the GL context, delete this before the window
|
||||
ResourceManager(const ResourceManager&) = delete;
|
||||
|
||||
// Returns nullptr and logs it if the file can't be loaded
|
||||
Texture* GetTexture(const std::string& path);
|
||||
Font* GetFont(const std::string& path);
|
||||
|
||||
// Not cached, every call makes a new texture that's free to be edited
|
||||
Texture* CreateTexture(int width, int height);
|
||||
Texture* CopyTexture(const Texture& source);
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, Texture*> textures;
|
||||
std::unordered_map<std::string, Font*> fonts;
|
||||
std::vector<Texture*> createdTextures;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user