当前位置: 首页>>代码示例>>C++>>正文


C++ XMLAttributes::GetValue方法代码示例

本文整理汇总了C++中XMLAttributes::GetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLAttributes::GetValue方法的具体用法?C++ XMLAttributes::GetValue怎么用?C++ XMLAttributes::GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XMLAttributes的用法示例。


在下文中一共展示了XMLAttributes::GetValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: beginElement

 virtual void beginElement(const string &name,const XMLAttributes &atts)
 {
     if (name == "description")
     {
         font->name = atts.GetValue("family");
     }
     else if (name == "metrics")
     {
         font->height = atoi(atts.GetValue("height").c_str());
         font->ascender = atoi(atts.GetValue("ascender").c_str());
         font->descender = atoi(atts.GetValue("descender").c_str());
     }
     else if (name == "texture")
     {
         font->imgfile = atts.GetValue("file");
         font->imgw = atoi(atts.GetValue("width").c_str());
         font->imgh = atoi(atts.GetValue("height").c_str());
     }
     else if (name == "padding")
     {
         font->padl = atoi(atts.GetValue("left").c_str());
         font->padt = atoi(atts.GetValue("top").c_str());
         font->padr = atoi(atts.GetValue("right").c_str());
         font->padb = atoi(atts.GetValue("bottom").c_str());
     }
     else if (name == "char")
     {
         eavlBitmapFont::Character c;
         c.id = atts.GetValue("id");
         c.c = char(c.id[0]);
         if (c.id.length() == 1)
         {
             font->shortmap[(int)(unsigned char)(c.c)] = font->chars.size();
         }
         c.offx = atoi(atts.GetValue("offset_x").c_str());
         c.offy = atoi(atts.GetValue("offset_y").c_str());
         c.x = atoi(atts.GetValue("rect_x").c_str());
         c.y = atoi(atts.GetValue("rect_y").c_str());
         c.w = atoi(atts.GetValue("rect_w").c_str());
         c.h = atoi(atts.GetValue("rect_h").c_str());
         c.adv = atoi(atts.GetValue("advance").c_str());
         font->chars.push_back(c);
     }
     else if (name == "kerning")
     {
         // we should now be parsing a character which has just
         // been added to the end of the list in the font
         eavlBitmapFont::Character &c = font->chars[font->chars.size()-1];
         string s = atts.GetValue("id");
         char shortid = char(s[0]);
         if (s.length() == 1)
         {
             c.kern[(int)(unsigned char)(shortid)] = atoi(atts.GetValue("advance").c_str());
             //cerr << "c.c="<<c.c<<" id="<<shortid<<" kern="<<c.kern[(int)(unsigned char)(shortid)]<<endl;
         }
     }
 }
开发者ID:optimus-prime,项目名称:EAVL,代码行数:57,代码来源:eavlBitmapFont.cpp


注:本文中的XMLAttributes::GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。