refactor: extract constants into separate constants.hpp file

This commit is contained in:
2026-04-25 16:25:47 +08:00
parent 055c4d687b
commit 8b5717a655
11 changed files with 43 additions and 31 deletions

View File

@@ -51,8 +51,7 @@ void App::init() {
glfwSetKeyCallback(m_window.get_glfw_window(), key_callback);
glfwSetScrollCallback(m_window.get_glfw_window(), mouse_scroll_callback);
glfwSetCursorEnterCallback(m_window.get_glfw_window(), cursor_enter_callback);
glfwSetCharCallback(m_window.get_glfw_window(), char_callback);
PerlinNoise::init();
m_renderer.init();
@@ -192,6 +191,15 @@ void App::cursor_enter_callback(GLFWwindow* window, int entered) {
}
}
void App::char_callback(GLFWwindow* window, unsigned int c) {
ImGuiIO& io = ImGui::GetIO();
App* app = static_cast<App*>(glfwGetWindowUserPointer(window));
ASSERT_MSG(app, "nullptr");
if (io.WantCaptureKeyboard && app->m_window.is_mouse_enable()) {
ImGui_ImplGlfw_CharCallback(window, c);
}
}
void App::render() {
if (glfwGetWindowAttrib(m_window.get_glfw_window(), GLFW_ICONIFIED) != 0)

View File

@@ -7,17 +7,9 @@ static InputState input_state;
namespace Input {
InputState& get_input_state() {
return input_state;
}
}

View File

@@ -1,6 +1,6 @@
#include <Cubed/config.hpp>
#include <Cubed/map_table.hpp>
#include <Cubed/texture_manager.hpp>
#include <Cubed/constants.hpp>
#include <Cubed/map_table.hpp>
#include <Cubed/tools/cubed_assert.hpp>
#include <Cubed/tools/log.hpp>

View File

@@ -1,6 +1,6 @@
#include <Cubed/shader.hpp>
#include <Cubed/tools/font.hpp>
#include <Cubed/constants.hpp>
#include <Cubed/shader.hpp>
#include <Cubed/tools/log.hpp>
#include <Cubed/tools/shader_tools.hpp>