From 7fc056496ba2fb79a9c83cc3edf792ccacfb870a Mon Sep 17 00:00:00 2001 From: Lenheart <947330670@qq.com> Date: Wed, 18 Mar 2026 04:23:15 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AEREA?= =?UTF-8?q?DME=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加项目README文件,包含项目介绍、特性、构建说明、快速开始示例和项目结构等信息 --- README.md | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..ede9519 --- /dev/null +++ b/README.md @@ -0,0 +1,111 @@ +# Frostbite2D + +一个现代化的跨平台2D游戏引擎,使用C++17开发。 + +## 特性 + +- **跨平台支持** - Windows、Linux、macOS、Nintendo Switch +- **现代渲染** - OpenGL渲染器,支持批量渲染和着色器管理 +- **完整的游戏开发框架** - 场景管理、精灵系统、资源管理 +- **高效的工具集** - 二进制读取器、PVF归档格式、脚本解析器 +- **智能指针系统** - 引用计数指针,避免内存泄漏 + +## 构建 + +本项目使用 [XMake](https://xmake.io/) 作为构建系统。 + +### 前置要求 + +- C++17 兼容编译器 +- XMake +- SDL2、SDL2_image、GLM、Glad + +### 基本构建 + +```bash +xmake build +``` + +### 调试构建 + +```bash +xmake build -m debug +``` + +### 发布构建 + +```bash +xmake build -m release +``` + +### 平台特定构建 + +```bash +xmake build -p windows +xmake build -p linux +xmake build -p switch +``` + +## 快速开始 + +```cpp +#include +#include +#include +#include +#include + +using namespace frostbite2D; + +int main(int argc, char **argv) { + AppConfig config = AppConfig::createDefault(); + config.windowConfig.width = 1280; + config.windowConfig.height = 720; + config.windowConfig.title = "My Game"; + + Application& app = Application::get(); + if (!app.init(config)) { + return -1; + } + + auto scene = MakePtr(); + SceneManager::get().PushScene(scene); + + auto sprite = Sprite::createFromFile("assets/player.png"); + if (sprite) { + sprite->SetPosition(100, 100); + scene->AddActor(sprite); + } + + app.run(); + app.shutdown(); + + return 0; +} +``` + +## 项目结构 + +``` +Frostbite2D/ +├── Frostbite2D/ # 引擎核心代码 +│ ├── include/ # 公共头文件 +│ │ └── frostbite2D/ +│ │ ├── 2d/ # 2D图形组件 +│ │ ├── core/ # 核心引擎类 +│ │ ├── graphics/ # 图形渲染系统 +│ │ ├── scene/ # 场景管理 +│ │ ├── types/ # 类型定义 +│ │ └── utils/ # 工具类 +│ └── src/ # 实现文件 +├── Game/ # 游戏应用示例 +│ ├── assets/ # 游戏资源 +│ ├── include/ # 游戏头文件 +│ └── src/ # 游戏源文件 +├── platform/ # 平台配置 +└── xmake.lua # XMake构建配置 +``` + +## 许可证 + +MIT License