style: 调整main.cpp的代码格式和include顺序

- 统一缩进为2个空格
- 调整头文件include顺序
- 移除多余的注释分隔线
This commit is contained in:
ChestnutYueyue 2026-03-03 19:41:20 +08:00
parent d5cb194552
commit e011cea090
1 changed files with 42 additions and 46 deletions

View File

@ -12,9 +12,9 @@
* - SpriteRenderer
*/
#include <extra2d.h>
#include "game_scene.h"
#include <cstdio>
#include <extra2d.h>
using namespace extra2d;
@ -22,58 +22,54 @@ using namespace extra2d;
* @brief
*/
int main(int argc, char **argv) {
// ========================================
// 1. 创建应用
// ========================================
auto app = Application::create();
// ========================================
// 1. 创建应用
// ========================================
auto app = Application::create();
AppConfig config;
config.title = "Scene Graph Demo - Extra2D";
config.width = 1280;
config.height = 720;
AppConfig config;
config.title = "Scene Graph Demo - Extra2D";
config.width = 1280;
config.height = 720;
if (!app->init(config)) {
printf("Failed to initialize application!\n");
return -1;
}
if (!app->init(config)) {
printf("Failed to initialize application!\n");
return -1;
}
// ========================================
// 2. 获取场景模块和导演
// ========================================
SceneModule *sceneModule = app->getModule<SceneModule>();
if (!sceneModule) {
printf("Failed to get SceneModule!\n");
return -1;
}
printf("Application initialized successfully\n");
printf("Window size: %dx%d\n", app->getWindowWidth(), app->getWindowHeight());
Director *director = sceneModule->getDirector();
if (!director) {
printf("Failed to get Director!\n");
return -1;
}
// ========================================
// 2. 获取场景模块和导演
// ========================================
SceneModule *sceneModule = app->getModule<SceneModule>();
if (!sceneModule) {
printf("Failed to get SceneModule!\n");
return -1;
}
printf("Scene module and director ready\n");
Director *director = sceneModule->getDirector();
if (!director) {
printf("Failed to get Director!\n");
return -1;
}
// ========================================
// 3. 创建并运行游戏场景
// ========================================
auto gameScene = makePtr<GameScene>();
director->runScene(gameScene);
printf("Scene module and director ready\n");
printf("Game scene started\n");
// ========================================
// 3. 创建并运行游戏场景
// ========================================
auto gameScene = makePtr<GameScene>();
director->runScene(gameScene);
// ========================================
// 4. 运行应用主循环
// ========================================
app->run();
printf("Game scene started\n");
// ========================================
// 5. 清理(自动进行)
// ========================================
printf("Application shutting down...\n");
// ========================================
// 4. 运行应用主循环
// ========================================
app->run();
// ========================================
// 5. 清理(自动进行)
// ========================================
printf("Application shutting down...\n");
return 0;
return 0;
}