// // world.cxx // danmaku // // Created by Sam Jaffe on 5/27/19. // Copyright © 2019 Sam Jaffe. All rights reserved. // #include "danmaku/world.hpp" #include #include "danmaku/level.hpp" #include "danmaku/player.hpp" #include "danmaku/serial.hpp" #include "game/util/env.hpp" using namespace danmaku; Json::Value player_json(std::string const & player_file) { return engine::read_file(env::resource_file("scripts/player/" + player_file)); } std::shared_ptr level_from_path(Json::Value const & json, std::string const & path, std::shared_ptr game) { Json::Value level_json = engine::read_file(path + "/" + json["path"].asString() + "/level.json"); return std::make_shared(json["name"].asString(), level_json, game); } world::world(std::string const & player_file, std::string const & path, Json::Value const & json, std::shared_ptr game) : engine::scene("world", game), player_(to_player(player_json(player_file), graphics_manager())), levels_(to_vector(json["levels"], level_from_path, path, game)) {} world::~world() {} // to_vector(Json::Value const &, ...) #include "danmaku/serial.tpp"