#pragma once #include #include #include #include namespace boundard { struct WindowConfig { int width = 800; int height = 600; std::string title = "OpenCGE"; }; struct MeshConfig { std::string shape = "quad"; std::string texture; std::array color{0.5F, 0.5F, 0.5F, 1.0F}; }; struct ActorConfig { std::string name; std::string type = "actor"; std::string init_function; std::string tick_function; std::array position{0.0F, 0.0F}; std::array facing{1.0F, 0.0F}; float zoom = 1.0F; MeshConfig mesh; std::vector children; }; struct InputBindingConfig { std::string action; std::vector keys; std::vector mouse_buttons; }; struct SceneConfig { std::string name; std::string path; std::vector actors; std::string default_camera; bool grid_background = false; }; struct GameConfig { WindowConfig window; std::vector input_bindings; std::vector scenes; std::string start_scene; // 兼容旧的单场景写法:直接写在游戏配置里的 actors。 std::vector actors; }; // 从 JSON 加载游戏场景配置(类似 Godot 的场景描述)。 class ConfigLoader { public: bool load(const std::string& path); const GameConfig& config() const; const std::string& last_error() const; private: GameConfig config_; std::string last_error_; }; } // namespace boundard