bool MovementComponent::serialize(XMLElement &n) const { if (!ComponentBase::serialize(n)) return(false); XMLElement *l_acceleration = n.GetDocument()->NewElement("acceleration"); l_acceleration->SetAttribute("x", m_p->acceleration.x); l_acceleration->SetAttribute("y", m_p->acceleration.y); n.InsertEndChild(l_acceleration); XMLElement *l_limit = n.GetDocument()->NewElement("limit"); l_limit->SetAttribute("x1", m_p->limit_x.first()); l_limit->SetAttribute("x2", m_p->limit_x.second()); l_limit->SetAttribute("y1", m_p->limit_y.first()); l_limit->SetAttribute("y2", m_p->limit_y.second()); n.InsertEndChild(l_limit); XMLElement *l_velocity = n.GetDocument()->NewElement("velocity"); l_velocity->SetAttribute("x", m_p->velocity.x); l_velocity->SetAttribute("y", m_p->velocity.y); n.InsertEndChild(l_velocity); return(true); }
bool Box2DSceneLayer::serialize(XMLElement &n) const { if (!SceneLayerBase::serialize(n)) return(false); XMLElement *l_child = n.GetDocument()->NewElement("gravity"); b2Vec2 l_gravity = m_p->world.GetGravity(); l_child->SetAttribute("x", l_gravity.x); l_child->SetAttribute("y", l_gravity.y); n.InsertEndChild(l_child); return(true); }
bool RenderComponent::serialize(XMLElement &n) const { if (!ComponentBase::serialize(n)) return(false); XMLElement *l_mesh = n.GetDocument()->NewElement("mesh"); if (m_p->mesh && !m_p->mesh->serialize(*l_mesh)) { MMWARNING("Render component '" << id().str() << "' serialization failed to serialize mesh!"); return(false); } n.InsertEndChild(l_mesh); return(true); }
bool SceneBase::serialize(XMLElement &n) const { n.SetAttribute("id", id().str().c_str()); n.SetAttribute("type", type().str().c_str()); SceneLayerList::const_reverse_iterator l_i; SceneLayerList::const_reverse_iterator l_c = m_p->layers.rend(); for (l_i = m_p->layers.rbegin(); l_i != l_c; ++l_i) { XMLElement *l_element = n.GetDocument()->NewElement("layer"); if ((*l_i)->serialize(*l_element)) n.InsertEndChild(l_element); } return(true); }
bool EngineBase::serialize(XMLElement &n) const { n.SetAttribute("fps", m_p->fps); n.SetAttribute("sleep", m_p->sleep); if (m_p->scene_manager) { XMLElement *l_element = n.GetDocument()->NewElement("scenes"); if (!m_p->scene_manager->serialize(*l_element)) { MMWARNING("Scene Manager serialization failed"); return(false); } n.InsertEndChild(l_element); } return(true); }
bool SplashSceneLayer::serialize(XMLElement &n) const { if (!SceneLayerBase::serialize(n)) return(false); n.SetAttribute("fade", m_p->fade); n.SetAttribute("exposure", m_p->exposure); n.SetAttribute("autokill", m_p->autoKill ? "true" : "false"); XMLElement *l_mesh = n.GetDocument()->NewElement("mesh"); if (m_p->mesh && !m_p->mesh->serialize(*l_mesh)) { MMWARNING("Splash scene layer '" << id().str() << "' serialization failed to serialize mesh!"); return(false); } n.InsertEndChild(l_mesh); return(true); }