mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-09 02:07:04 +08:00
feat: add map table to save block index
This commit is contained in:
@@ -1,26 +1,24 @@
|
||||
#pragma once
|
||||
#include <glad/glad.h>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include <Cubed/gameplay/block.hpp>
|
||||
#include <Cubed/tools/shader_tools.hpp>
|
||||
struct BlockTexture {
|
||||
std::string name;
|
||||
std::vector<GLuint> texture;
|
||||
|
||||
};
|
||||
|
||||
class TextureManager {
|
||||
private:
|
||||
static std::size_t make_hash(std::string);
|
||||
std::unordered_map<std::size_t, BlockTexture> m_block_textures;
|
||||
std::vector<BlockTexture> m_block_textures;
|
||||
|
||||
public:
|
||||
TextureManager();
|
||||
~TextureManager();
|
||||
const BlockTexture& get_block_texture(std::string name);
|
||||
const BlockTexture& get_block_texture(const std::string& block_name);
|
||||
const BlockTexture& get_block_texture(unsigned block_id);
|
||||
void delet_texture();
|
||||
|
||||
void load_block_texture(std::string block_name);
|
||||
void load_block_texture(const std::string& block_name);
|
||||
void load_block_texture(unsigned block_id);
|
||||
// Must call after MapTable::init_map() and glfwMakeContextCurrent(window);
|
||||
void init_texture();
|
||||
};
|
||||
Reference in New Issue
Block a user