summaryrefslogtreecommitdiffstats
path: root/src/core/AssetManager.hpp
blob: 23b2ba6d0dd2768057e2a00b1a63e341bc59d937 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once

#include <experimental/filesystem>
#include <map>
#include <GL/glew.h>
#include <glm/vec4.hpp>
#include <nlohmann/json.hpp>
#include "../world/Block.hpp"
#include "../graphics/Texture.hpp"

struct TextureCoord{
    unsigned int x,y,w,h;
};

class AssetManager {
    Texture *textureAtlas;
    std::map<std::string,Block> assetIds;
    std::map<std::string,TextureCoord> assetTextures;
public:
    AssetManager();

    ~AssetManager();

    void LoadTextureResources();

    TextureCoord GetTextureByAssetName(std::string AssetName);

    std::string GetTextureAssetNameByBlockId(unsigned short BlockId, unsigned char BlockSide = 0);

    const GLuint GetTextureAtlas();

    void LoadIds();
};