diff options
Diffstat (limited to 'src/game.cpp')
| -rw-r--r-- | src/game.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/game.cpp b/src/game.cpp index cc975c7..0a7becd 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -17,6 +17,8 @@ void SerializeEntityType(void *TODO, const EntityType &et) { // TODO } +void ParseEntityType(void *TODO, EntityType *et) { } + void SaveSceneFile(const char *sceneFilePath) { // TODO init file @@ -36,11 +38,24 @@ void SaveSceneFile(const char *sceneFilePath) { f.close(); } -void ParseSceneFile(const char *sceneFilePath) { +void LoadSceneFile(const char *sceneFilePath) { AssetHandle sceneAH = AM_Register(sceneFilePath); const Asset *sceneAsset = AM_Get(sceneAH); - // TODO + // EntityTypes + { + long entityTypeCount = 0; // TODO + for (int64_t i = 0; i < entityTypeCount; ++i) { + EntityType et{}; + ParseEntityType(nullptr, &et); // TODO + int64_t existingEntityTypeIndex = EntityType_FindByTypeCode(et.entityTypeCode); + if (existingEntityTypeIndex != -1) { + continue; + } + et.entityHandle = ECS_CreateEntity(); + EntityType_Load(et); + } + } AM_Destroy(sceneAH); } @@ -149,6 +164,9 @@ void RecordImGuiSceneEditor() { if (ImGui::Button("Save")) { SaveSceneFile("test.yaml"); } + if (ImGui::Button("Load")) { + LoadSceneFile("test.yaml"); + } ImGui::End(); } } |
