mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-17 16:17:02 +08:00
refactor: extract constants into separate constants.hpp file
This commit is contained in:
@@ -20,7 +20,9 @@ public:
|
||||
static void window_reshape_callback(GLFWwindow* window, int new_width, int new_height);
|
||||
static void mouse_scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
|
||||
static void cursor_enter_callback(GLFWwindow* window, int entered);
|
||||
static void char_callback(GLFWwindow* window, unsigned int ch);
|
||||
static int start_cubed_application(int argc, char** argv);
|
||||
|
||||
static unsigned int seed();
|
||||
static float delte_time();
|
||||
static float get_fps();
|
||||
|
||||
@@ -1,25 +1,10 @@
|
||||
#pragma once
|
||||
#include <array>
|
||||
#include <toml++/toml.hpp>
|
||||
|
||||
#include <Cubed/tools/cubed_assert.hpp>
|
||||
|
||||
namespace Cubed {
|
||||
|
||||
constexpr int WORLD_SIZE_Y = 256;
|
||||
constexpr int MAX_BLOCK_NUM = 7;
|
||||
constexpr int MAX_UI_NUM = 1;
|
||||
|
||||
constexpr int CHUCK_SIZE = 16;
|
||||
constexpr int PRE_LOAD_DISTANCE = 24;
|
||||
constexpr int MAX_DISTANCE = 128;
|
||||
constexpr int MAX_BLOCK_STATUS = 1;
|
||||
constexpr int MAX_CHARACTER = 128;
|
||||
constexpr float NORMAL_FOV = 70.0f;
|
||||
|
||||
constexpr int MAX_BIOME_SUM = 4;
|
||||
using HeightMapArray = std::array<std::array<float, CHUCK_SIZE>, CHUCK_SIZE>;
|
||||
|
||||
|
||||
template <typename T>
|
||||
concept TomlValueType =
|
||||
|
||||
22
include/Cubed/constants.hpp
Normal file
22
include/Cubed/constants.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include <array>
|
||||
namespace Cubed {
|
||||
|
||||
constexpr int WORLD_SIZE_Y = 256;
|
||||
constexpr int CHUCK_SIZE = 16;
|
||||
|
||||
constexpr int MAX_BLOCK_NUM = 7;
|
||||
constexpr int MAX_UI_NUM = 1;
|
||||
constexpr int MAX_BLOCK_STATUS = 1;
|
||||
constexpr int MAX_BIOME_SUM = 4;
|
||||
constexpr int MAX_CHARACTER = 128;
|
||||
|
||||
constexpr int PRE_LOAD_DISTANCE = 24;
|
||||
|
||||
constexpr int MAX_DISTANCE = 128;
|
||||
|
||||
constexpr float DEFAULT_FOV = 70.0f;
|
||||
|
||||
using HeightMapArray = std::array<std::array<float, CHUCK_SIZE>, CHUCK_SIZE>;
|
||||
|
||||
}
|
||||
@@ -29,6 +29,8 @@ private:
|
||||
bool m_need_save_config = false;
|
||||
int m_theme = 0;
|
||||
void show_settings_tab_item();
|
||||
void show_world_tab_item();
|
||||
void show_player_tab_item();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include <Cubed/config.hpp>
|
||||
#include <Cubed/constants.hpp>
|
||||
#include <Cubed/tools/cubed_assert.hpp>
|
||||
|
||||
namespace Cubed {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Cubed/config.hpp>
|
||||
#include <Cubed/constants.hpp>
|
||||
#include <Cubed/primitive_data.hpp>
|
||||
#include <Cubed/shader.hpp>
|
||||
#include <Cubed/ui/text.hpp>
|
||||
@@ -34,7 +35,7 @@ private:
|
||||
World& m_world;
|
||||
|
||||
float m_aspect = 0.0f;
|
||||
float m_fov = NORMAL_FOV;
|
||||
float m_fov = DEFAULT_FOV;
|
||||
glm::mat4 m_p_mat, m_v_mat, m_m_mat, m_mv_mat, m_mvp_mat;
|
||||
|
||||
GLuint m_mv_loc;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <Cubed/config.hpp>
|
||||
#include <Cubed/primitive_data.hpp>
|
||||
|
||||
namespace Cubed {
|
||||
|
||||
Reference in New Issue
Block a user