bool EngineBase::deserialize(TinyXML::TiXmlElement &n) { /* * Engine deserialization should ideally * take place BEFORE it has been started. */ TinyXML::TiXmlElement *l_element; l_element = n.FirstChildElement("scenes"); n.QueryFloatAttribute("fps", &m_fps); n.QueryFloatAttribute("ups", &m_ups); const char *l_suspendable = n.Attribute("suspendable"); m_suspendable = (l_suspendable && (l_suspendable[0] == 't' || l_suspendable[0] == 'T')); if (l_element && m_scene_manager) m_scene_manager->deserialize(*l_element); else if (l_element && !m_scene_manager) return(false); return(true); }
void GameElements::ConfigurationLoader::parseWeapons( TinyXML::TiXmlElement * root ) { ::std::cout<<"-- Loading weapons"<<::std::endl ; TinyXML::TiXmlElement * rootWeapons = root->FirstChildElement("weapons") ; for(TinyXML::TiXmlElement * element = rootWeapons->FirstChildElement("weapon") ; element!=NULL ; element = element->NextSiblingElement("weapon") ) { ::std::cout<<element->Attribute("name")<<::std::endl ; m_weaponsArchetypes.addArchetype(element) ; } }
void GameElements::ConfigurationLoader::parseMaps( TinyXML::TiXmlElement * root, Ogre::SceneManager * sceneManager ) { ::std::cout<<"-- Loading maps"<<::std::endl; TinyXML::TiXmlElement * rootUnits = root->FirstChildElement("maps") ; for(TinyXML::TiXmlElement * element = rootUnits->FirstChildElement("map") ; element!=NULL ; element = element->NextSiblingElement("map") ) { ::std::cout<<element->Attribute("name")<<::std::endl ; Map * map = new Map(sceneManager, element) ; m_maps.insert(::std::make_pair(map->getName(), map)) ; } }
bool Box2DComponent::deserialize(TinyXML::TiXmlElement &n) { if (!ComponentBase::deserialize(n)) return(false); const char *l_body = n.Attribute("body"); m_body_type = b2_staticBody; if (l_body && l_body[0] == 'k') m_body_type = b2_kinematicBody; if (l_body && l_body[0] == 'd') m_body_type = b2_dynamicBody; n.QueryFloatAttribute("width", &m_size[0]); n.QueryFloatAttribute("height", &m_size[1]); n.QueryFloatAttribute("density", &m_density); n.QueryFloatAttribute("friction", &m_friction); return(true); }