mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-18 00:27:02 +08:00
feat: add texture hot-reload
This commit is contained in:
@@ -29,9 +29,6 @@ private:
|
||||
|
||||
Window m_window{m_renderer};
|
||||
|
||||
|
||||
GLuint m_texture_array = 0;
|
||||
|
||||
inline static double last_time = glfwGetTime();
|
||||
inline static double current_time = glfwGetTime();
|
||||
inline static double delta_time = 0.0f;
|
||||
|
||||
@@ -16,9 +16,14 @@ struct MouseState {
|
||||
bool right = false;
|
||||
};
|
||||
|
||||
struct KeyState {
|
||||
bool r = false;
|
||||
};
|
||||
|
||||
struct InputState {
|
||||
MoveState move_state;
|
||||
MouseState mouse_state;
|
||||
KeyState key_state;
|
||||
};
|
||||
|
||||
namespace Input {
|
||||
|
||||
@@ -6,20 +6,26 @@
|
||||
|
||||
class TextureManager {
|
||||
private:
|
||||
bool m_need_reload = false;
|
||||
GLuint m_block_status_array;
|
||||
GLuint m_texture_array;
|
||||
GLuint m_ui_array;
|
||||
void load_block_status(unsigned status_id);
|
||||
void load_block_texture(unsigned block_id);
|
||||
void load_ui_texture(unsigned id);
|
||||
|
||||
public:
|
||||
TextureManager();
|
||||
~TextureManager();
|
||||
|
||||
|
||||
void delet_texture();
|
||||
GLuint get_block_status_array() const;
|
||||
GLuint get_texture_array() const;
|
||||
GLuint get_ui_array() const;
|
||||
// Must call after MapTable::init_map() and glfwMakeContextCurrent(window);
|
||||
void init_texture();
|
||||
void hot_reload();
|
||||
void need_reload();
|
||||
void update();
|
||||
|
||||
};
|
||||
@@ -6,12 +6,16 @@ public:
|
||||
Window(Renderer& renderer);
|
||||
~Window();
|
||||
|
||||
bool is_mouse_enable() const;
|
||||
const GLFWwindow* get_glfw_window() const;
|
||||
GLFWwindow* get_glfw_window();
|
||||
void init();
|
||||
void update_viewport();
|
||||
void toggle_fullscreen();
|
||||
void toggle_mouse_able();
|
||||
|
||||
private:
|
||||
bool m_mouse_enable = false;
|
||||
float m_aspect;
|
||||
GLFWwindow* m_window;
|
||||
int m_width;
|
||||
|
||||
Reference in New Issue
Block a user