From f24107368fa47f911f4491f644ff3755525c91e1 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sat, 19 Aug 2017 20:20:51 +0500 Subject: 2017-08-19 --- old/core/AssetManager.hpp | 75 ----------------------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 old/core/AssetManager.hpp (limited to 'old/core/AssetManager.hpp') diff --git a/old/core/AssetManager.hpp b/old/core/AssetManager.hpp deleted file mode 100644 index 667140a..0000000 --- a/old/core/AssetManager.hpp +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include -#include - -#include -#include -#include - -#include "../world/Block.hpp" -#include "../graphics/Texture.hpp" - -struct TextureCoordinates { - TextureCoordinates(float x = -1, float y = -1, float w = -1, float h = -1) : x(x), y(y), w(w), h(h) {} - - bool operator==(const TextureCoordinates &rhs) const { - return x == rhs.x && - y == rhs.y && - w == rhs.w && - h == rhs.h; - } - - explicit operator bool() const { - return !(*this == TextureCoordinates(-1, -1, -1, -1)); - } - - float x, y, w, h; -}; - -struct BlockTextureId { - //Block sides: 0 - bottom, 1 - top, 2 - north, 3 - south, 4 - west, 5 - east 6 - every side - BlockTextureId(int id = 0, int state = 0, int side = 6) : id(id), state(state), side(side) {} - - int id:9; - int state:4; - int side:3; - - - bool operator<(const BlockTextureId &rhs) const { - if (id < rhs.id) - return true; - if (rhs.id < id) - return false; - if (state < rhs.state) - return true; - if (rhs.state < state) - return false; - return side < rhs.side; - } -}; - -class AssetManager { - Texture *textureAtlas; - std::map assetIds; - std::map assetTextures; - std::map textureAtlasIndexes; -public: - AssetManager(); - - ~AssetManager(); - - void LoadTextureResources(); - - TextureCoordinates GetTextureByAssetName(std::string AssetName); - - std::string GetTextureAssetNameByBlockId(BlockTextureId block); - - GLuint GetTextureAtlas(); - - const std::map &GetTextureAtlasIndexes(); - - void LoadIds(); - - TextureCoordinates GetTextureByBlock(BlockTextureId block); -}; -- cgit v1.2.3