//static Ref<ResSprite> ResSprite::Load(pugi::xml_node el, File& fi){ const char *texResName; if(pugi::xml_attribute a = el.attribute("tex")){ texResName = a.value(); }else{ throw ting::Exc("ResSprite::Load(): there is no \"tex\" attribute found"); } ASSERT(texResName) // M_RESMANIMPL_LOG(<< "ResSprite::Load(): texResName = " << texResName << std::endl) Ref<ResTexture> tex = resman::ResMan::Inst().Load<ResTexture>(texResName); ASSERT(tex.IsValid()) //read xy attribute Vec2f xy; if(pugi::xml_attribute a = el.attribute("xy")){ xy = Vec2f::ParseXY(a.value()); }else{ throw ting::Exc("ResSprite::Load(): there is no \"xy\" attribute found"); } //read wh attribute Vec2f wh; if(pugi::xml_attribute a = el.attribute("wh")){ wh = Vec2f::ParseXY(a.value()); }else{ throw ting::Exc("ResSprite::Load(): there is no \"wh\" attribute found"); } //read dim (dimensions) attribute Vec2f dim; if(pugi::xml_attribute a = el.attribute("dim")){ dim = Vec2f::ParseXY(a.value()); }else{ dim = wh; } //read pivot attribute Vec2f pivot; if(pugi::xml_attribute a = el.attribute("pivot")){ pivot = Vec2f::ParseXY(a.value()); }else{ pivot.SetToZero(); } return Ref<ResSprite>(new ResSprite(tex, xy, wh, dim, pivot)); }