mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-18 00:27:02 +08:00
refactor: extract constants into separate constants.hpp file
This commit is contained in:
12
src/app.cpp
12
src/app.cpp
@@ -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)
|
||||
|
||||
@@ -7,17 +7,9 @@ static InputState input_state;
|
||||
|
||||
namespace Input {
|
||||
|
||||
|
||||
|
||||
|
||||
InputState& get_input_state() {
|
||||
return input_state;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user