// // serial.cxx // danmaku // // Created by Sam Jaffe on 5/27/19. // Copyright © 2019 Sam Jaffe. All rights reserved. // #include "danmaku/serial.hpp" #include #include "danmaku/actor.hpp" #include "danmaku/bullet_pattern.hpp" #include "danmaku/enemy.hpp" #include "resource_factory/prototype_factory.hpp" namespace danmaku { std::unique_ptr to_actor(Json::Value const & json, graphics::manager const & mgr) { auto & bp_factory = bullet_pattern_factory::instance(); auto get_attack = [&](Json::Value const & j, actor * a) { return bp_factory.get(j["id"].asString(), std::move(a), j, mgr); }; return actor_factory::instance().get(json["type"].asString(), json, engine::to_object(json, mgr), get_attack); } points_map to_points_map(Json::Value const & json) { return {json["damage"].asInt(), json["kill"].asInt()}; } }