summaryrefslogtreecommitdiffstats
path: root/graphics/AssetManager.hpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-05-10 15:44:51 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-05-10 15:44:51 +0200
commit469a84c10ba60fba4a513c1b1a0eea600cd7b22f (patch)
tree4de3514353341f68fd63d3c12fa0a162008d3209 /graphics/AssetManager.hpp
parent2017-04-23 (diff)
downloadAltCraft-469a84c10ba60fba4a513c1b1a0eea600cd7b22f.tar
AltCraft-469a84c10ba60fba4a513c1b1a0eea600cd7b22f.tar.gz
AltCraft-469a84c10ba60fba4a513c1b1a0eea600cd7b22f.tar.bz2
AltCraft-469a84c10ba60fba4a513c1b1a0eea600cd7b22f.tar.lz
AltCraft-469a84c10ba60fba4a513c1b1a0eea600cd7b22f.tar.xz
AltCraft-469a84c10ba60fba4a513c1b1a0eea600cd7b22f.tar.zst
AltCraft-469a84c10ba60fba4a513c1b1a0eea600cd7b22f.zip
Diffstat (limited to 'graphics/AssetManager.hpp')
-rw-r--r--graphics/AssetManager.hpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/graphics/AssetManager.hpp b/graphics/AssetManager.hpp
new file mode 100644
index 0000000..81be7c4
--- /dev/null
+++ b/graphics/AssetManager.hpp
@@ -0,0 +1,51 @@
+#pragma once
+
+#include <fstream>
+#include <string>
+#include <SOIL.h>
+#include <map>
+#include "../json.hpp"
+
+struct Asset {
+ std::string name = "";
+ std::string hash = "";
+ union AssetData{
+ struct TextureData{
+ int width;
+ int height;
+ unsigned char *imageData;
+ } texture;
+ } data;
+ size_t size = 0;
+ enum AssetType {
+ Unknown,
+ Texture,
+ Sound,
+ Model,
+ Lang,
+ } type = Unknown;
+ bool isParsed();
+ ~Asset();
+};
+
+class AssetManager {
+ AssetManager();
+
+ ~AssetManager();
+
+ AssetManager(const AssetManager &);
+
+ AssetManager &operator=(const AssetManager &);
+
+ std::map<std::string, Asset> assets;
+public:
+ static AssetManager &instance() {
+ static AssetManager assetManager;
+ return assetManager;
+ }
+
+ static Asset &GetAsset(std::string AssetName);
+
+ static void LoadAsset(std::string AssetName);
+};
+