/******************************************************************************* Copyright (c) 2009, Charles McGarvey All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include #include #include "mippleton.hh" #include "deserializer.hh" #include "serializable.hh" #include "aabb.hh" #include "scene.hh" namespace dc { class scene::scene_impl : public mippleton { static bool loadBox(aabb& theBox, serializable_ptr obj) { std::vector numbers; if (obj->get(numbers)) { if (numbers.size() == 6) { double num; if (numbers[0]->getNumber(num)) { } } } return false; } public: scene_impl(const std::string& name) : mippleton(name) { loadFromFile(); } void loadFromFile() { std::string filePath = scene::getPathToResource(getName()); deserializer in(filePath, true); serializable_ptr root = in.deserialize(); if (root) { std::map rootObj; if (root->get(rootObj)) { std::map::iterator it; if ((it = rootObj.find("playfield_bounds")) != rootObj.end()) { loadBox(playfieldBounds, (*it).second); } if ((it = rootObj.find("maximum_bounds")) != rootObj.end()) { loadBox(maximumBounds, (*it).second); } //for (i = rootObj.begin(); i != rootObj.end(); i++) //{ //sequences.insert(std::pair((*i).first, //sequence((*i).second))); //} } } } aabb playfieldBounds; aabb maximumBounds; }; scene::scene(const std::string& name) : // pass through impl(scene::scene_impl::retain(name), &scene::scene_impl::release) {} void scene::draw(scalar alpha) { } /** * Specialized search location for scene files. They can be found in the * "scenes" subdirectory of any of the searched directories. */ std::string scene::getPathToResource(const std::string& name) { return resource::getPathToResource("scenes/" + name + ".json"); } } // namespace dc /** vim: set ts=4 sw=4 tw=80: *************************************************/