diff --git a/CMakeLists.txt b/CMakeLists.txt index ee733ba..1361459 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,25 +1,25 @@ cmake_minimum_required(VERSION 3.10.0) -project(opencge VERSION 0.1.0 LANGUAGES C CXX) +project(Boundard VERSION 0.1.0 LANGUAGES C CXX) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -add_library(opencge STATIC - src/opencge.cpp +add_library(boundard STATIC + src/boundard.cpp src/game.cpp src/render.cpp src/config.cpp src/engine.cpp ) -target_include_directories(opencge PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) -target_compile_features(opencge PUBLIC cxx_std_17) +target_include_directories(boundard PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_compile_features(boundard PUBLIC cxx_std_17) find_package(glfw3 REQUIRED) find_package(Vulkan REQUIRED) find_package(PkgConfig REQUIRED) pkg_check_modules(JSONCPP REQUIRED IMPORTED_TARGET jsoncpp) -target_link_libraries(opencge PUBLIC glfw Vulkan::Vulkan PkgConfig::JSONCPP) +target_link_libraries(boundard PUBLIC glfw Vulkan::Vulkan PkgConfig::JSONCPP) add_executable(square_example examples/square/main.cpp) -target_link_libraries(square_example PRIVATE opencge) +target_link_libraries(square_example PRIVATE boundard) -add_executable(opencge_engine src/engine_main.cpp) -target_link_libraries(opencge_engine PRIVATE opencge) +add_executable(boundard_engine src/engine_main.cpp) +target_link_libraries(boundard_engine PRIVATE boundard) diff --git a/examples/square/main.cpp b/examples/square/main.cpp index 9f17f18..5a627e2 100644 --- a/examples/square/main.cpp +++ b/examples/square/main.cpp @@ -1,13 +1,13 @@ #include -#include +#include namespace { void register_square_behaviors() { - auto& behaviors = openceg::BehaviorRegistry::getInstance(); + auto& behaviors = boundard::BehaviorRegistry::getInstance(); - behaviors.register_init("square_init", [](openceg::Actor& actor) { + behaviors.register_init("square_init", [](boundard::Actor& actor) { actor.set_position({0.0F, 0.0F}); actor.set_facing({1.0F, 0.0F}); if (actor.mesh() != nullptr) { @@ -17,7 +17,7 @@ void register_square_behaviors() { behaviors.register_tick( "square_tick", - [](openceg::Actor& actor, float dt, const openceg::render::InputMap& input) { + [](boundard::Actor& actor, float dt, const boundard::render::InputMap& input) { const float t = actor.age(); actor.set_facing({ std::cos(t * 1.5F), @@ -45,5 +45,5 @@ void register_square_behaviors() { int main(int argc, char** argv) { register_square_behaviors(); - return openceg::run_engine(argc, argv, "examples/square/config.ceg"); + return boundard::run_engine(argc, argv, "examples/square/config.ceg"); } diff --git a/include/actor.hpp b/include/actor.hpp index a8f8467..5b852a4 100644 --- a/include/actor.hpp +++ b/include/actor.hpp @@ -9,11 +9,11 @@ #include #include -namespace openceg::render { +namespace boundard::render { class InputMap; } -namespace openceg { +namespace boundard { class Actor { private: @@ -109,4 +109,4 @@ class Actor { void set_mesh(std::shared_ptr mesh) { mesh_ = std::move(mesh); } }; -} // namespace openceg +} // namespace boundard diff --git a/include/behavior.hpp b/include/behavior.hpp index faa1650..db41bdb 100644 --- a/include/behavior.hpp +++ b/include/behavior.hpp @@ -7,11 +7,11 @@ #include -namespace openceg::render { +namespace boundard::render { class InputMap; } -namespace openceg { +namespace boundard { using ActorInitHandler = std::function; using ActorTickHandler = std::function; @@ -62,4 +62,4 @@ class BehaviorRegistry { std::unordered_map tick_handlers_; }; -} // namespace openceg +} // namespace boundard diff --git a/include/openceg.hpp b/include/boundard.hpp similarity index 100% rename from include/openceg.hpp rename to include/boundard.hpp diff --git a/include/config.hpp b/include/config.hpp index ab91692..943a64a 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -5,7 +5,7 @@ #include #include -namespace openceg { +namespace boundard { struct WindowConfig { int width = 800; @@ -51,4 +51,4 @@ class ConfigLoader { std::string last_error_; }; -} // namespace openceg +} // namespace boundard diff --git a/include/engine.hpp b/include/engine.hpp index aa1f234..f5b96e5 100644 --- a/include/engine.hpp +++ b/include/engine.hpp @@ -1,9 +1,9 @@ #pragma once -namespace openceg { +namespace boundard { // 通用引擎入口:读取 config.ceg,实例化场景并驱动 Actor 的 init/tick。 // 具体游戏行为通过 BehaviorRegistry 注册,因此引擎本身不内置任何游戏逻辑。 int run_engine(int argc, char** argv, const char* default_config_path = "config.ceg"); -} // namespace openceg +} // namespace boundard diff --git a/include/game.hpp b/include/game.hpp index b72fa2a..2a83f64 100644 --- a/include/game.hpp +++ b/include/game.hpp @@ -1,7 +1,7 @@ #pragma once #include -namespace openceg { +namespace boundard { class Game { private: size_t id_cnt; @@ -18,4 +18,4 @@ class Game { void launch(); size_t new_id(); }; -} // namespace openceg +} // namespace boundard diff --git a/include/mesh.hpp b/include/mesh.hpp index 8137723..28f3eb7 100644 --- a/include/mesh.hpp +++ b/include/mesh.hpp @@ -7,7 +7,7 @@ #include #include -namespace openceg { +namespace boundard { // 渲染组件:描述 Actor 的几何形状、颜色和纹理占位。 class Mesh { @@ -48,4 +48,4 @@ class Mesh { std::array color_{1.0F, 1.0F, 1.0F, 1.0F}; }; -} // namespace openceg +} // namespace boundard diff --git a/include/render.hpp b/include/render.hpp index c865890..5510f09 100644 --- a/include/render.hpp +++ b/include/render.hpp @@ -13,7 +13,7 @@ #include -namespace openceg::render { +namespace boundard::render { struct InputEvent { enum class Type { @@ -136,4 +136,4 @@ class RenderLoop { std::vector actors_; }; -} // namespace openceg::render +} // namespace boundard::render diff --git a/src/boundard.cpp b/src/boundard.cpp new file mode 100644 index 0000000..ae6a32a --- /dev/null +++ b/src/boundard.cpp @@ -0,0 +1 @@ +#include diff --git a/src/config.cpp b/src/config.cpp index 179de26..3617a49 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -8,7 +8,7 @@ #include #include -namespace openceg { +namespace boundard { namespace { std::string lowercase(std::string value) { @@ -320,4 +320,4 @@ const std::string& ConfigLoader::last_error() const { return last_error_; } -} // namespace openceg +} // namespace boundard diff --git a/src/engine.cpp b/src/engine.cpp index a4bbfec..7503756 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -7,9 +7,9 @@ #include #include -#include +#include -namespace openceg { +namespace boundard { int run_engine(int argc, char** argv, const char* default_config_path) { std::string config_path = default_config_path != nullptr ? default_config_path : "config.ceg"; @@ -114,4 +114,4 @@ int run_engine(int argc, char** argv, const char* default_config_path) { return 0; } -} // namespace openceg +} // namespace boundard diff --git a/src/engine_main.cpp b/src/engine_main.cpp index a0a5f2c..f840697 100644 --- a/src/engine_main.cpp +++ b/src/engine_main.cpp @@ -1,5 +1,5 @@ #include int main(int argc, char** argv) { - return openceg::run_engine(argc, argv); + return boundard::run_engine(argc, argv); } diff --git a/src/game.cpp b/src/game.cpp index 3e9414b..8595d47 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1,6 +1,6 @@ #include -namespace openceg { +namespace boundard { Game::Game() { id_cnt = 0; } Game::~Game() = default; diff --git a/src/opencge.cpp b/src/opencge.cpp deleted file mode 100644 index df2e194..0000000 --- a/src/opencge.cpp +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/src/render.cpp b/src/render.cpp index bdae664..1c39128 100644 --- a/src/render.cpp +++ b/src/render.cpp @@ -12,7 +12,7 @@ #include #include -namespace openceg::render { +namespace boundard::render { namespace { @@ -1337,4 +1337,4 @@ void Renderer::Impl::destroy() { initialized = false; } -} // namespace openceg::render +} // namespace boundard::render