diff --git a/assets/games/liminal/example-scene.xml b/assets/games/liminal/example-scene.xml deleted file mode 100644 index 5d3fdab1..00000000 --- a/assets/games/liminal/example-scene.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - Hi, I'm Ethereality. - - - - - - Hi, I'm Craig. - - - - - - - - - - - - - - - - - <string lang="en">Do you think Craig is cool?</string> - - - Yes - - - No - - - Maybe - - - - - - - Are you unsure? - - - - - - - I agree, Craig is cool. - - - - - I disagree, Craig is cool. - - - - - - - - - - - - - \ No newline at end of file diff --git a/assets/games/liminal/test.xml b/assets/games/liminal/test.xml index f6b4e749..8d2fad5b 100644 --- a/assets/games/liminal/test.xml +++ b/assets/games/liminal/test.xml @@ -1,4 +1,4 @@ - + diff --git a/src/dawnliminal/game/LiminalGame.cpp b/src/dawnliminal/game/LiminalGame.cpp index baee4bb4..482819a5 100644 --- a/src/dawnliminal/game/LiminalGame.cpp +++ b/src/dawnliminal/game/LiminalGame.cpp @@ -5,11 +5,11 @@ #include "game/DawnGame.hpp" #include "scenes/HelloWorldScene.hpp" -#include "scenes/ExtendedScene.hpp" +#include "vnscenes/VNSceneTest.hpp" using namespace Dawn; Scene * Dawn::dawnGameGetInitialScene(DawnGame *game) { // return new HelloWorldScene(game); - return new ExtendedScene(game); + return new VNSceneTest(game); } \ No newline at end of file diff --git a/src/dawntools/scenetool/SceneGen.cpp b/src/dawntools/scenetool/SceneGen.cpp index a47b4880..3f9e49f5 100644 --- a/src/dawntools/scenetool/SceneGen.cpp +++ b/src/dawntools/scenetool/SceneGen.cpp @@ -13,73 +13,15 @@ void SceneGen::generate( std::string tabs ) { struct ClassGenInfo classInfo; - classInfo.clazz = scene->name; - classInfo.constructorArgs = "DawnGame *game"; - classInfo.extendArgs = "game"; - - std::string baseClassName = "Scene"; - - // Determine extends - if(scene->extend.empty()) { - classInfo.includes.push_back("scene/Scene.hpp"); - } else { - classInfo.includes.push_back(scene->extend + ".hpp"); - - // Get last slash of scene->extend - auto lastSlash = scene->extend.find_last_of('/'); - if(lastSlash != std::string::npos) { - baseClassName = scene->extend.substr(lastSlash + 1); - } else { - baseClassName = scene->extend; - } - } - classInfo.extend = baseClassName; - // classInfo.extend = "Scene"; - struct MethodGenInfo methodAssets; - methodAssets.name = "getRequiredAssets"; - methodAssets.isOverride = true; - methodAssets.type = "std::vector"; - line(&methodAssets.body, "auto assMan = &this->game->assetManager;", ""); - struct MethodGenInfo methodInit; - methodInit.name = "stage"; - methodInit.isOverride = true; - if(scene->extend.empty()) { - line(&methodAssets.body, "std::vector assets;", ""); - } else { - line(&methodAssets.body, "std::vector assets = " + baseClassName + "::getRequiredAssets();", ""); - line(&methodInit.body, baseClassName + "::stage();", ""); - } - - // Generate - int32_t assetNumber = 0; - int32_t childNumber = 0; - int32_t componentNumber = 0; - std::map assetMap; - - auto sceneItems = scene->items.begin(); - while(sceneItems != scene->items.end()) { - SceneItemGenerator::generate( - assetNumber, - componentNumber, - childNumber, - assetMap, - classInfo.includes, - &classInfo.publicProperties, - &methodInit.body, - &methodAssets.body, - "", - "this", - &(*sceneItems), - "" - ); - ++sceneItems; - } - - // Seal methods - line(&methodAssets.body, "return assets;", ""); + SceneGenerator::generate( + scene, + classInfo, + methodAssets, + methodInit + ); // Add in methods CodeGen::methodGen(&classInfo.publicCode, methodAssets); diff --git a/src/dawntools/scenetool/SceneGen.hpp b/src/dawntools/scenetool/SceneGen.hpp index 1cb5f1d5..e1361eed 100644 --- a/src/dawntools/scenetool/SceneGen.hpp +++ b/src/dawntools/scenetool/SceneGen.hpp @@ -4,8 +4,7 @@ // https://opensource.org/licenses/MIT #pragma once -#include "util/parser/SceneParser.hpp" -#include "util/generator/SceneItemGenerator.hpp" +#include "util/generator/SceneGenerator.hpp" namespace Dawn { class SceneGen : public CodeGen { diff --git a/src/dawntools/util/generator/CMakeLists.txt b/src/dawntools/util/generator/CMakeLists.txt index 23878c43..7872a4c8 100644 --- a/src/dawntools/util/generator/CMakeLists.txt +++ b/src/dawntools/util/generator/CMakeLists.txt @@ -10,6 +10,7 @@ set( ${DAWN_TOOL_SOURCES} ${D}/SceneItemGenerator.cpp ${D}/SceneAssetGenerator.cpp + ${D}/SceneGenerator.cpp ${D}/SceneItemComponentGenerator.cpp CACHE INTERNAL diff --git a/src/dawntools/util/generator/SceneGenerator.cpp b/src/dawntools/util/generator/SceneGenerator.cpp new file mode 100644 index 00000000..cca882dc --- /dev/null +++ b/src/dawntools/util/generator/SceneGenerator.cpp @@ -0,0 +1,79 @@ +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#include "SceneGenerator.hpp" + +using namespace Dawn; + +void SceneGenerator::generate( + struct Scene *scene, + struct ClassGenInfo &classInfo, + struct MethodGenInfo &methodAssets, + struct MethodGenInfo &methodInit +) { + classInfo.clazz = scene->name; + classInfo.constructorArgs = "DawnGame *game"; + classInfo.extendArgs = "game"; + + std::string baseClassName = "Scene"; + + // Determine extends + if(scene->extend.empty()) { + classInfo.includes.push_back("scene/Scene.hpp"); + } else { + classInfo.includes.push_back(scene->extend + ".hpp"); + + // Get last slash of scene->extend + auto lastSlash = scene->extend.find_last_of('/'); + baseClassName = scene->extend; + if(lastSlash != std::string::npos) { + baseClassName = scene->extend.substr(lastSlash + 1); + } + } + classInfo.extend = baseClassName; + + methodAssets.name = "getRequiredAssets"; + methodAssets.isOverride = true; + methodAssets.type = "std::vector"; + line(&methodAssets.body, "auto assMan = &this->game->assetManager;", ""); + + methodInit.name = "stage"; + methodInit.isOverride = true; + + if(scene->extend.empty()) { + line(&methodAssets.body, "std::vector assets;", ""); + } else { + line(&methodAssets.body, "std::vector assets = " + baseClassName + "::getRequiredAssets();", ""); + line(&methodInit.body, baseClassName + "::stage();", ""); + } + + // Generate + int32_t assetNumber = 0; + int32_t childNumber = 0; + int32_t componentNumber = 0; + std::map assetMap; + + auto sceneItems = scene->items.begin(); + while(sceneItems != scene->items.end()) { + SceneItemGenerator::generate( + assetNumber, + componentNumber, + childNumber, + assetMap, + classInfo.includes, + &classInfo.publicProperties, + &methodInit.body, + &methodAssets.body, + "", + "this", + &(*sceneItems), + "" + ); + ++sceneItems; + } + + // Seal methods + line(&methodAssets.body, "return assets;", ""); +} \ No newline at end of file diff --git a/src/dawntools/util/generator/SceneGenerator.hpp b/src/dawntools/util/generator/SceneGenerator.hpp new file mode 100644 index 00000000..bd6f87c1 --- /dev/null +++ b/src/dawntools/util/generator/SceneGenerator.hpp @@ -0,0 +1,21 @@ +// Copyright (c) 2023 Dominic Masters +// +// This software is released under the MIT License. +// https://opensource.org/licenses/MIT + +#pragma once +#include "util/parser/SceneParser.hpp" +#include "SceneItemGenerator.hpp" +#include "util/CodeGen.hpp" + +namespace Dawn { + class SceneGenerator : public CodeGen { + public: + static void generate( + struct Scene *scene, + struct ClassGenInfo &classInfo, + struct MethodGenInfo &methodAssets, + struct MethodGenInfo &methodInit + ); + }; +} \ No newline at end of file diff --git a/src/dawntools/vnscenetool/VNSceneGen.cpp b/src/dawntools/vnscenetool/VNSceneGen.cpp index 27b71697..b1e25953 100644 --- a/src/dawntools/vnscenetool/VNSceneGen.cpp +++ b/src/dawntools/vnscenetool/VNSceneGen.cpp @@ -14,139 +14,138 @@ void VNSceneGen::test( std::vector *body, std::vector *includes ) { + std::string initType = ""; + std::string toInclude = ""; + std::string initArgs = ""; + std::vector afterLines; -// std::string initType = ""; -// std::string toInclude = ""; -// std::string initArgs = ""; -// std::vector afterLines; + switch(event->type) { + case VN_SCENE_EVENT_TYPE_TEXT: + initType = "VNTextEvent"; + toInclude = "games/vn/events/VNTextEvent.hpp"; + line(&afterLines, eventName + "->" + "text = \"" + event->text.texts.begin()->text + "\";", ""); + break; -// switch(event->type) { -// case VN_SCENE_EVENT_TYPE_TEXT: -// initType = "VNTextEvent"; -// toInclude = "games/vn/events/VNTextEvent.hpp"; -// line(&afterLines, eventName + "->" + "text = \"" + event->text.texts.begin()->text + "\";", ""); -// break; + case VN_SCENE_EVENT_TYPE_POSITION: + initType = "VNPositionEvent"; + toInclude = "games/vn/events/VNPositionEvent.hpp"; + line(&afterLines, eventName + "->item = " + event->position.item + ";", ""); + if(event->position.x != "") line(&afterLines, eventName + "->" + "to.x = " + event->position.x + ";", ""); + if(event->position.y != "") line(&afterLines, eventName + "->" + "to.y = " + event->position.y + ";", ""); + if(event->position.z != "") line(&afterLines, eventName + "->" + "to.z = " + event->position.z + ";", ""); + break; -// case VN_SCENE_EVENT_TYPE_POSITION: -// initType = "VNPositionEvent"; -// toInclude = "games/vn/events/VNPositionEvent.hpp"; -// line(&afterLines, eventName + "->item = " + event->position.item + ";", ""); -// if(event->position.x != "") line(&afterLines, eventName + "->" + "to.x = " + event->position.x + ";", ""); -// if(event->position.y != "") line(&afterLines, eventName + "->" + "to.y = " + event->position.y + ";", ""); -// if(event->position.z != "") line(&afterLines, eventName + "->" + "to.z = " + event->position.z + ";", ""); -// break; + case VN_SCENE_EVENT_TYPE_SET: + initType = "VNSetEvent<" + event->set.type + ">"; + toInclude = "games/vn/events/VNSetEvent.hpp"; + line(&afterLines, eventName + "->modifies = &" + event->set.property + ";", ""); + line(&afterLines, eventName + "->to = " + event->set.to + ";", ""); + if(event->set.from != "") line(&afterLines, eventName + "->from = " + event->set.from + ";", ""); + if(event->set.duration != "") line(&afterLines, eventName + "->duration = " + event->set.duration + ";", ""); + break; -// case VN_SCENE_EVENT_TYPE_SET: -// initType = "VNSetEvent<" + event->set.type + ">"; -// toInclude = "games/vn/events/VNSetEvent.hpp"; -// line(&afterLines, eventName + "->modifies = &" + event->set.property + ";", ""); -// line(&afterLines, eventName + "->to = " + event->set.to + ";", ""); -// if(event->set.from != "") line(&afterLines, eventName + "->from = " + event->set.from + ";", ""); -// if(event->set.duration != "") line(&afterLines, eventName + "->duration = " + event->set.duration + ";", ""); -// break; + case VN_SCENE_EVENT_TYPE_WAIT: + initType = "VNWaitEvent"; + toInclude = "games/vn/events/VNWaitEvent.hpp"; + line(&afterLines, eventName + "->duration = " + event->wait.duration + ";", ""); + break; -// case VN_SCENE_EVENT_TYPE_WAIT: -// initType = "VNWaitEvent"; -// toInclude = "games/vn/events/VNWaitEvent.hpp"; -// line(&afterLines, eventName + "->duration = " + event->wait.duration + ";", ""); -// break; + case VN_SCENE_EVENT_TYPE_PARALLEL: { + initType = "VNParallelEvent"; + toInclude = "games/vn/events/VNParallelEvent.hpp"; -// case VN_SCENE_EVENT_TYPE_PARALLEL: { -// initType = "VNParallelEvent"; -// toInclude = "games/vn/events/VNParallelEvent.hpp"; + auto itParallel = event->parallel.events.events.begin(); + while(itParallel != event->parallel.events.events.end()) { + std::string pEventName = "pEvent" + std::to_string((*eventIndex)++); + VNSceneGen::test( + pEventName, + &(*itParallel), + eventIndex, + &afterLines, + includes + ); + line(&afterLines, eventName + "->events.push_back(" + pEventName + ");", ""); + line(&afterLines, "", ""); + ++itParallel; + } + break; + } -// auto itParallel = event->parallel.events.events.begin(); -// while(itParallel != event->parallel.events.events.end()) { -// std::string pEventName = "pEvent" + std::to_string((*eventIndex)++); -// VNSceneGen::test( -// pEventName, -// &(*itParallel), -// eventIndex, -// &afterLines, -// includes -// ); -// line(&afterLines, eventName + "->events.push_back(" + pEventName + ");", ""); -// line(&afterLines, "", ""); -// ++itParallel; -// } -// break; -// } + case VN_SCENE_EVENT_TYPE_MARKER: + initType = "VNDummyEvent"; + toInclude = "games/vn/events/VNDummyEvent.hpp"; + line(&afterLines, "auto marker_" + event->marker.name + " = " + eventName + ";", ""); + break; -// case VN_SCENE_EVENT_TYPE_MARKER: -// initType = "VNDummyEvent"; -// toInclude = "games/vn/events/VNDummyEvent.hpp"; -// line(&afterLines, "auto marker_" + event->marker.name + " = " + eventName + ";", ""); -// break; + case VN_SCENE_EVENT_TYPE_GOTO_MARKER: + initType = "VNDummyEvent"; + toInclude = "games/vn/events/VNDummyEvent.hpp"; + line(&afterLines, eventName + "->then(marker_" + event->gotoMarker.name + ");", ""); + break; -// case VN_SCENE_EVENT_TYPE_GOTO_MARKER: -// initType = "VNDummyEvent"; -// toInclude = "games/vn/events/VNDummyEvent.hpp"; -// line(&afterLines, eventName + "->then(marker_" + event->gotoMarker.name + ");", ""); -// break; + case VN_SCENE_EVENT_TYPE_CHOICES: { + initType = "VNChoiceEvent"; + toInclude = "games/vn/events/VNChoiceEvent.hpp"; + line(&afterLines, eventName + "->key = \"" + event->choices.key+ "\";", ""); + line(&afterLines, eventName + "->text = \"" + event->choices.titles.begin()->text + "\";", ""); + auto itChoices = event->choices.choices.begin(); + while(itChoices != event->choices.choices.end()) { + line(&afterLines, eventName + "->choices[\"" + itChoices->value + "\"] = \"" + itChoices->texts.begin()->text + "\";", ""); + ++itChoices; + } + break; + } -// case VN_SCENE_EVENT_TYPE_CHOICES: { -// initType = "VNChoiceEvent"; -// toInclude = "games/vn/events/VNChoiceEvent.hpp"; -// line(&afterLines, eventName + "->key = \"" + event->choices.key+ "\";", ""); -// line(&afterLines, eventName + "->text = \"" + event->choices.titles.begin()->text + "\";", ""); -// auto itChoices = event->choices.choices.begin(); -// while(itChoices != event->choices.choices.end()) { -// line(&afterLines, eventName + "->choices[\"" + itChoices->value + "\"] = \"" + itChoices->texts.begin()->text + "\";", ""); -// ++itChoices; -// } -// break; -// } + case VN_SCENE_EVENT_TYPE_CHOICE_SET: + initType = "VNChoiceSetEvent"; + toInclude = "games/vn/events/VNChoiceSetEvent.hpp"; + line(&afterLines, eventName + "->key = \"" + event->choiceSet.key + "\";", ""); + line(&afterLines, eventName + "->value = \"" + event->choiceSet.value + "\";", ""); + break; -// case VN_SCENE_EVENT_TYPE_CHOICE_SET: -// initType = "VNChoiceSetEvent"; -// toInclude = "games/vn/events/VNChoiceSetEvent.hpp"; -// line(&afterLines, eventName + "->key = \"" + event->choiceSet.key + "\";", ""); -// line(&afterLines, eventName + "->value = \"" + event->choiceSet.value + "\";", ""); -// break; + case VN_SCENE_EVENT_TYPE_IF: { + initType = "VNIfEvent"; + toInclude = "games/vn/events/VNIfEvent.hpp"; + line(&afterLines, eventName + "->key = \"" + event->ifEvent.key + "\";", ""); + line(&afterLines, eventName + "->value = \"" + event->ifEvent.value + "\";", ""); -// case VN_SCENE_EVENT_TYPE_IF: { -// initType = "VNIfEvent"; -// toInclude = "games/vn/events/VNIfEvent.hpp"; -// line(&afterLines, eventName + "->key = \"" + event->ifEvent.key + "\";", ""); -// line(&afterLines, eventName + "->value = \"" + event->ifEvent.value + "\";", ""); + std::string ifPrevious = ""; + std::string ifFirst = ""; + auto itIf = event->ifEvent.events.events.begin(); + while(itIf != event->ifEvent.events.events.end()) { + std::string ifEventName = "ifEvent" + std::to_string((*eventIndex)++); + VNSceneGen::test( + ifEventName, + &(*itIf), + eventIndex, + &afterLines, + includes + ); + if(!ifPrevious.empty()) line(&afterLines, ifPrevious + "->then(" + ifEventName + ");", ""); + ifPrevious = ifEventName; + if(ifFirst == "") ifFirst = ifEventName; + ++itIf; + } -// std::string ifPrevious = ""; -// std::string ifFirst = ""; -// auto itIf = event->ifEvent.events.events.begin(); -// while(itIf != event->ifEvent.events.events.end()) { -// std::string ifEventName = "ifEvent" + std::to_string((*eventIndex)++); -// VNSceneGen::test( -// ifEventName, -// &(*itIf), -// eventIndex, -// &afterLines, -// includes -// ); -// if(!ifPrevious.empty()) line(&afterLines, ifPrevious + "->then(" + ifEventName + ");", ""); -// ifPrevious = ifEventName; -// if(ifFirst == "") ifFirst = ifEventName; -// ++itIf; -// } + if(ifFirst == "" || ifPrevious == "") { + std::cout << "If event must have at least one event" << std::endl; + assertUnreachable(); + } -// if(ifFirst == "" || ifPrevious == "") { -// std::cout << "If event must have at least one event" << std::endl; -// assertUnreachable(); -// } + line(&afterLines, eventName + "->ifTrue = " + ifFirst + ";", ""); + line(&afterLines, eventName + "->ifEnd = " + ifPrevious + ";", ""); + break; + } -// line(&afterLines, eventName + "->ifTrue = " + ifFirst + ";", ""); -// line(&afterLines, eventName + "->ifEnd = " + ifPrevious + ";", ""); -// break; -// } + default: + std::cout << "Unknown event type: " << event->type << std::endl; + assertUnreachable(); + } -// default: -// std::cout << "Unknown event type: " << event->type << std::endl; -// assertUnreachable(); -// } + if(!toInclude.empty()) includes->push_back(toInclude); -// if(!toInclude.empty()) includes->push_back(toInclude); - -// line(body, "auto " + eventName + " = vnManager->createEvent<" + initType + ">(" + initArgs + ");", ""); -// lines(body, afterLines, ""); + line(body, "auto " + eventName + " = vnManager->createEvent<" + initType + ">(" + initArgs + ");", ""); + lines(body, afterLines, ""); } void VNSceneGen::generate( @@ -154,86 +153,52 @@ void VNSceneGen::generate( struct VNScene *scene, std::string tabs ) { - std::cout << "Gen Scene" << std::endl; + struct ClassGenInfo classInfo; + struct MethodGenInfo methodAssets; + struct MethodGenInfo methodInit; -// struct ClassGenInfo classInfo; -// classInfo.clazz = "TestScene"; -// classInfo.extend = "Scene"; -// classInfo.constructorArgs = "DawnGame *game"; -// classInfo.extendArgs = "game"; -// classInfo.includes.push_back("scene/Scene.hpp"); + // Load Scene + SceneGenerator::generate( + &scene->scene, + classInfo, + methodAssets, + methodInit + ); -// struct MethodGenInfo methodAssets; -// methodAssets.name = "getRequiredAssets"; -// methodAssets.isOverride = true; -// methodAssets.type = "std::vector"; -// line(&methodAssets.body, "auto assMan = &this->game->assetManager;", ""); -// line(&methodAssets.body, "std::vector assets;", ""); -// line(&methodAssets.body, "return assets;", ""); -// struct MethodGenInfo methodStage; -// methodStage.name = "stage"; -// methodStage.isOverride = "true"; -// line(&methodStage.body, "// test", ""); + // Events + classInfo.includes.push_back("games/vn/components/VNManager.hpp"); + line(&methodInit.body, "auto vnItem = this->createSceneItem();", ""); + line(&methodInit.body, "auto vnManager = vnItem->addComponent();", ""); + line(&methodInit.body, "VNEvent *previous = vnManager->createEvent();", ""); + line(&methodInit.body, "auto eventStart = previous;", ""); -// // TEST -// line(&methodStage.body, "auto canvas = UICanvas::create(this);", ""); -// line(&methodStage.body, "", ""); + int32_t eventIndex = 0; + auto itEvents = scene->events.events.begin(); + std::string previous = "eventStart"; + while(itEvents != scene->events.events.end()) { + line(&methodInit.body, "", ""); + std::string eventName = "event" + std::to_string(eventIndex++); + VNSceneGen::test( + eventName, + &(*itEvents), + &eventIndex, + &methodInit.body, + &classInfo.includes + ); + line(&methodInit.body, previous + "->then(" + eventName + ");", ""); + previous = eventName; + ++itEvents; + } + line(&methodInit.body, "", ""); + line(&methodInit.body, "vnManager->setEvent(eventStart);", ""); -// classInfo.includes.push_back("scene/components/display/Camera.hpp"); -// line(&methodStage.body, "auto camera = Camera::create(this);", ""); -// line(&methodStage.body, "camera->fov = 0.436332f;", ""); -// line(&methodStage.body, "camera->transform->lookAt(glm::vec3(10, 10, 10), glm::vec3(0, 0, 0));", ""); -// // Items -// int32_t itemRefIndex = 0; -// auto itItems = scene->items.begin(); -// while(itItems != scene->items.end()) { -// struct VNSceneItem item = *itItems; -// if(item.ref.empty()) item.ref = "item" + std::to_string(itemRefIndex++); -// classInfo.includes.push_back(item.prefab + ".hpp"); - -// line(&methodStage.body, "", ""); -// line(&methodStage.body, "auto " + item.ref + " = " + item.className + "::create(this);", ""); + // Add in methods + CodeGen::methodGen(&classInfo.publicCode, methodAssets); + line(&classInfo.publicCode, "", ""); + CodeGen::methodGen(&classInfo.publicCode, methodInit); -// ++itItems; -// } - -// line(&methodStage.body, "", ""); - -// // Events -// classInfo.includes.push_back("games/vn/components/VNManager.hpp"); -// line(&methodStage.body, "auto vnItem = this->createSceneItem();", ""); -// line(&methodStage.body, "auto vnManager = vnItem->addComponent();", ""); -// line(&methodStage.body, "VNEvent *previous = vnManager->createEvent();", ""); -// line(&methodStage.body, "auto eventStart = previous;", ""); - -// int32_t eventIndex = 0; -// auto itEvents = scene->events.events.begin(); -// std::string previous = "eventStart"; -// while(itEvents != scene->events.events.end()) { -// line(&methodStage.body, "", ""); -// std::string eventName = "event" + std::to_string(eventIndex++); -// VNSceneGen::test( -// eventName, -// &(*itEvents), -// &eventIndex, -// &methodStage.body, -// &classInfo.includes -// ); -// line(&methodStage.body, previous + "->then(" + eventName + ");", ""); -// previous = eventName; -// ++itEvents; -// } - -// line(&methodStage.body, "", ""); -// line(&methodStage.body, "vnManager->setEvent(eventStart);", ""); - -// // Add in methods -// CodeGen::methodGen(&classInfo.protectedCode, methodAssets); -// line(&classInfo.protectedCode, "", ""); -// CodeGen::methodGen(&classInfo.protectedCode, methodStage); - -// CodeGen::classGen(out, classInfo); + CodeGen::classGen(out, classInfo); } \ No newline at end of file diff --git a/src/dawntools/vnscenetool/VNSceneGen.hpp b/src/dawntools/vnscenetool/VNSceneGen.hpp index c70c9aed..6dd05f59 100644 --- a/src/dawntools/vnscenetool/VNSceneGen.hpp +++ b/src/dawntools/vnscenetool/VNSceneGen.hpp @@ -6,6 +6,7 @@ #pragma once #include "VNSceneParser.hpp" #include "util/CodeGen.hpp" +#include "util/generator/SceneGenerator.hpp" namespace Dawn { class VNSceneGen : public CodeGen { diff --git a/src/dawntools/vnscenetool/VNSceneTool.cpp b/src/dawntools/vnscenetool/VNSceneTool.cpp index 0f287b9c..23fac8b2 100644 --- a/src/dawntools/vnscenetool/VNSceneTool.cpp +++ b/src/dawntools/vnscenetool/VNSceneTool.cpp @@ -42,7 +42,7 @@ int32_t VNSceneTool::start() { VNSceneGen::generate(&outputData, &scene, ""); // Load output file from name and type - File outputFile = File(flags["output"] + "/vnscenes/TestScene.hpp"); + File outputFile = File(flags["output"] + "/vnscenes/" + scene.scene.name + ".hpp"); if(!outputFile.mkdirp()) { std::cout << "Failed to create output directory!" << std::endl; return 1;