style: 调整main.cpp的代码格式和include顺序
- 统一缩进为2个空格 - 调整头文件include顺序 - 移除多余的注释分隔线
This commit is contained in:
parent
d5cb194552
commit
e011cea090
|
|
@ -12,9 +12,9 @@
|
||||||
* - SpriteRenderer 精灵渲染
|
* - SpriteRenderer 精灵渲染
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <extra2d.h>
|
|
||||||
#include "game_scene.h"
|
#include "game_scene.h"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <extra2d.h>
|
||||||
|
|
||||||
using namespace extra2d;
|
using namespace extra2d;
|
||||||
|
|
||||||
|
|
@ -22,58 +22,54 @@ using namespace extra2d;
|
||||||
* @brief 程序入口
|
* @brief 程序入口
|
||||||
*/
|
*/
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
// ========================================
|
// ========================================
|
||||||
// 1. 创建应用
|
// 1. 创建应用
|
||||||
// ========================================
|
// ========================================
|
||||||
auto app = Application::create();
|
auto app = Application::create();
|
||||||
|
|
||||||
AppConfig config;
|
AppConfig config;
|
||||||
config.title = "Scene Graph Demo - Extra2D";
|
config.title = "Scene Graph Demo - Extra2D";
|
||||||
config.width = 1280;
|
config.width = 1280;
|
||||||
config.height = 720;
|
config.height = 720;
|
||||||
|
|
||||||
if (!app->init(config)) {
|
if (!app->init(config)) {
|
||||||
printf("Failed to initialize application!\n");
|
printf("Failed to initialize application!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
// ========================================
|
||||||
|
// 2. 获取场景模块和导演
|
||||||
|
// ========================================
|
||||||
|
SceneModule *sceneModule = app->getModule<SceneModule>();
|
||||||
|
if (!sceneModule) {
|
||||||
|
printf("Failed to get SceneModule!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
printf("Application initialized successfully\n");
|
Director *director = sceneModule->getDirector();
|
||||||
printf("Window size: %dx%d\n", app->getWindowWidth(), app->getWindowHeight());
|
if (!director) {
|
||||||
|
printf("Failed to get Director!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// ========================================
|
printf("Scene module and director ready\n");
|
||||||
// 2. 获取场景模块和导演
|
|
||||||
// ========================================
|
|
||||||
SceneModule *sceneModule = app->getModule<SceneModule>();
|
|
||||||
if (!sceneModule) {
|
|
||||||
printf("Failed to get SceneModule!\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Director *director = sceneModule->getDirector();
|
// ========================================
|
||||||
if (!director) {
|
// 3. 创建并运行游戏场景
|
||||||
printf("Failed to get Director!\n");
|
// ========================================
|
||||||
return -1;
|
auto gameScene = makePtr<GameScene>();
|
||||||
}
|
director->runScene(gameScene);
|
||||||
|
|
||||||
printf("Scene module and director ready\n");
|
printf("Game scene started\n");
|
||||||
|
|
||||||
// ========================================
|
// ========================================
|
||||||
// 3. 创建并运行游戏场景
|
// 4. 运行应用主循环
|
||||||
// ========================================
|
// ========================================
|
||||||
auto gameScene = makePtr<GameScene>();
|
app->run();
|
||||||
director->runScene(gameScene);
|
|
||||||
|
|
||||||
printf("Game scene started\n");
|
// ========================================
|
||||||
|
// 5. 清理(自动进行)
|
||||||
|
// ========================================
|
||||||
|
printf("Application shutting down...\n");
|
||||||
|
|
||||||
// ========================================
|
return 0;
|
||||||
// 4. 运行应用主循环
|
|
||||||
// ========================================
|
|
||||||
app->run();
|
|
||||||
|
|
||||||
// ========================================
|
|
||||||
// 5. 清理(自动进行)
|
|
||||||
// ========================================
|
|
||||||
printf("Application shutting down...\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue