SUNENGINE 0.0.2
A simple and bright C++ game engine.
 
Loading...
Searching...
No Matches
ModelManager.h
1#ifndef ModelManager_H
2#define ModelManager_H
3
4#include "AzulCore.h"
5
6#include <string>
7#include <map>
8
16class ModelManager
17{
18private:
19 friend class ModelManagerAttorney;
20
21 static ModelManager* ptrInstance;
22
23 ModelManager();
24 ModelManager(const ModelManager&) = delete;
25 ModelManager& operator=(const ModelManager&) = delete;
26 ~ModelManager() = default;
27
28 static ModelManager& Instance()
29 {
30 if (ptrInstance == nullptr)
31 ptrInstance = new ModelManager();
32 return *ptrInstance;
33 };
34
38 const std::string DefaultPath;
39
43 std::map<std::string, Model*> storageMap;
44
48 static void Delete() { Instance().privDelete(); }
49 void privDelete();
50
51 Model* privGet(const std::string& key);
52 void privLoad(const std::string& key, const Model::PreMadeModels model);
53 void privLoad(const std::string& key, const std::string& path);
54 void privLoad(const std::string& key, int planeSize, int u, int v);
55
56public:
60 static const std::string defaultSpriteModelKey;
61
68 static Model* Get(const std::string& key) { return Instance().privGet(key); }
69
76 static void Load(const std::string& key, const Model::PreMadeModels model) { Instance().privLoad(key, model); }
77
84 static void Load(const std::string& key, const std::string& path) { Instance().privLoad(key, path); }
85
94 static void Load(const std::string& key, int planeSize, int u, int v) { Instance().privLoad(key, planeSize, u, v); }
95};
96
97#endif
static Model * Get(const std::string &key)
Retrieves a Model object by its key (private implementation).
Definition ModelManager.h:68
static void Load(const std::string &key, const Model::PreMadeModels model)
Loads a pre-made Model object (private implementation).
Definition ModelManager.h:76
static const std::string defaultSpriteModelKey
Default key for sprite models.
Definition ModelManager.h:60
const std::string DefaultPath
Default path for loading models.
Definition ModelManager.h:38
static void Load(const std::string &key, int planeSize, int u, int v)
Loads a Model object with specified parameters (private implementation).
Definition ModelManager.h:94
std::map< std::string, Model * > storageMap
Map storing Model objects associated with their keys.
Definition ModelManager.h:43
static void Load(const std::string &key, const std::string &path)
Loads a Model object from a file path (private implementation).
Definition ModelManager.h:84
static void Delete()
Deletes all managed Model objects and the singleton instance.
Definition ModelManager.h:48