diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2019-09-03 13:06:58 -0400 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2019-09-03 13:06:58 -0400 |
commit | 6441c3e2081abe085b98578b67253f0f3ade0ca2 (patch) | |
tree | 7987d6d634fd6be84dab06419f6435c4858fd5b3 | |
parent | 9c9f72c29a71a1813e9bc42d57998676237b57e3 (diff) |
save json to file
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | src/engine.cpp | 6 |
2 files changed, 5 insertions, 2 deletions
@@ -3,4 +3,5 @@ out .*.swp .*.swo *.o +*.json diff --git a/src/engine.cpp b/src/engine.cpp index 539515c..afd325d 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -30,6 +30,8 @@ #include "components/Position.hpp" #include "components/Velocity.hpp" +#include <fstream> + using namespace std::chrono_literals; namespace cr = std::chrono; typedef std::chrono::high_resolution_clock mc; @@ -117,7 +119,8 @@ void Engine::run(void) // Done, bring logic thread back logicThread.join(); - cereal::JSONOutputArchive archive (std::cout); + std::ofstream saveFile ("save.json"); + cereal::JSONOutputArchive archive (saveFile); std::string name ("entity"); int i = 0; for (entityx::Entity e : entities.entities_for_debugging()) { @@ -126,7 +129,6 @@ void Engine::run(void) entities.entity_serialize(e, true, archive); archive.finishNode(); } - std::cout << std::endl; } bool Engine::shouldRun(void) |