本文整理汇总了C++中XMLAttributes::getValueAsInteger方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLAttributes::getValueAsInteger方法的具体用法?C++ XMLAttributes::getValueAsInteger怎么用?C++ XMLAttributes::getValueAsInteger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLAttributes
的用法示例。
在下文中一共展示了XMLAttributes::getValueAsInteger方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: elementImagesetStart
//----------------------------------------------------------------------------//
void Imageset_xmlHandler::elementImagesetStart(const XMLAttributes& attributes)
{
// get name of the imageset.
const String name(attributes.getValueAsString(ImagesetNameAttribute));
// get texture image filename
const String filename(
attributes.getValueAsString(ImagesetImageFileAttribute));
// get resource group to use for image file.
const String resource_group(
attributes.getValueAsString(ImagesetResourceGroupAttribute));
Logger& logger(Logger::getSingleton());
logger.logEvent("Started creation of Imageset from XML specification:");
logger.logEvent("---- CEGUI Imageset name: " + name);
logger.logEvent("---- Source texture file: " + filename +
" in resource group: " +
(resource_group.empty() ? "(Default)" : resource_group));
// Create imageset object from image file
d_imageset = new Imageset(name, filename, resource_group);
// set native resolution for imageset
const float native_hres = static_cast<float>(
attributes.getValueAsInteger(ImagesetNativeHorzResAttribute, 640));
const float native_vres = static_cast<float>(
attributes.getValueAsInteger(ImagesetNativeVertResAttribute, 480));
d_imageset->setNativeResolution(Size(native_hres, native_vres));
// set auto-scaling as needed
d_imageset->setAutoScalingEnabled(
attributes.getValueAsBool(ImagesetAutoScaledAttribute, false));
}
示例2: Image
//----------------------------------------------------------------------------//
SVGImage::SVGImage(const XMLAttributes& attributes) :
Image(attributes.getValueAsString(ImageNameAttribute),
glm::vec2(static_cast<float>(attributes.getValueAsInteger(ImageXOffsetAttribute, 0)),
static_cast<float>(attributes.getValueAsInteger(ImageYOffsetAttribute, 0))),
Rectf(glm::vec2(static_cast<float>(attributes.getValueAsInteger(ImageXPosAttribute, 0)),
static_cast<float>(attributes.getValueAsInteger(ImageYPosAttribute, 0))),
Sizef(static_cast<float>(attributes.getValueAsInteger(ImageWidthAttribute, 0)),
static_cast<float>(attributes.getValueAsInteger(ImageHeightAttribute, 0)))),
PropertyHelper<AutoScaledMode>::fromString(attributes.getValueAsString(ImageAutoScaledAttribute)),
Sizef(static_cast<float>(attributes.getValueAsInteger(ImageNativeHorzResAttribute, 640)),
static_cast<float>(attributes.getValueAsInteger(ImageNativeVertResAttribute, 480)))),
d_svgData(&SVGDataManager::getSingleton().getSVGData(
attributes.getValueAsString(ImageSVGDataAttribute))),
d_useGeometryAntialiasing(true)
{
}
示例3: elementStart
/*************************************************************************
SAX2 Handler methods
*************************************************************************/
void Animate_xmlHandler::elementStart(const String& element, const XMLAttributes& attributes)
{
// handle an Animate element (extract all element attributes and use data to define an Animate)
if(element == AnimateManagerElement)
{
}
else if(element == AnimateElement)
{
String name(attributes.getValueAsString(AnimateNameAttribute));
bool loop = attributes.getValueAsBool(AnimatePlayLoop);
int id = attributes.getValueAsInteger(AnimateID, -1);
int totalTime = attributes.getValueAsInteger(AnimateTime, -1);
bool alpha = attributes.getValueAsBool( AnimateAlphaMode );
int loopType = attributes.getValueAsInteger(AnimateAlphaType, 1 );
d_animate = AnimateManager::getSingleton().createAnimate(name, id, loop, totalTime, alpha, loopType );
}
else if (element == AniamteItemElement )
{
if(d_animate == 0)
{
throw GenericException("Aniamte::xmlHandler::startElement - Invalid file struct.");
}
const Image* pImage = PropertyHelper::stringToImage(attributes.getValueAsString(AniamteImage));
if(pImage)
{
d_animate->defineAnimateKey(pImage);
AnimateManager::getSingleton().addAnimateImageset(pImage->getImagesetName());
}
}
else
{
throw FileIOException("Aniamte::xmlHandler::startElement - Unexpected data was found while parsing the animatefile: '" + element + "' is unknown.");
}
}
示例4: notifyDisplaySizeChanged
//----------------------------------------------------------------------------//
BasicImage::BasicImage(const XMLAttributes& attributes) :
d_name(attributes.getValueAsString(ImageNameAttribute)),
d_texture(&System::getSingleton().getRenderer()->getTexture(
attributes.getValueAsString(ImageTextureAttribute))),
d_pixelSize(static_cast<float>(attributes.getValueAsInteger(ImageWidthAttribute, 0)),
static_cast<float>(attributes.getValueAsInteger(ImageHeightAttribute, 0))),
d_area(Vector2f(static_cast<float>(attributes.getValueAsInteger(ImageXPosAttribute, 0)),
static_cast<float>(attributes.getValueAsInteger(ImageYPosAttribute, 0))),
d_pixelSize),
d_pixelOffset(Vector2f(
static_cast<float>(attributes.getValueAsInteger(ImageXOffsetAttribute, 0)),
static_cast<float>(attributes.getValueAsInteger(ImageYOffsetAttribute, 0)))),
d_nativeResolution(Sizef(
static_cast<float>(attributes.getValueAsInteger(ImageNativeHorzResAttribute, 640)),
static_cast<float>(attributes.getValueAsInteger(ImageNativeVertResAttribute, 480))))
{
d_autoScaled = PropertyHelper<AutoScaledMode>::fromString(attributes.getValueAsString(ImageAutoScaledAttribute));
// force initialisation of the autoscaling fields.
notifyDisplaySizeChanged(
System::getSingleton().getRenderer()->getDisplaySize());
}
示例5: elementImageStart
//----------------------------------------------------------------------------//
void Imageset_xmlHandler::elementImageStart(const XMLAttributes& attributes)
{
if (!d_imageset)
throw InvalidRequestException("Imageset_xmlHandler::elementImageStart: "
"Attempt to access null object.");
const String name(attributes.getValueAsString(ImageNameAttribute));
Rect rect;
rect.d_left =
static_cast<float>(attributes.getValueAsInteger(ImageXPosAttribute));
rect.d_top =
static_cast<float>(attributes.getValueAsInteger(ImageYPosAttribute));
rect.setWidth(
static_cast<float>(attributes.getValueAsInteger(ImageWidthAttribute)));
rect.setHeight(
static_cast<float>(attributes.getValueAsInteger(ImageHeightAttribute)));
const Point offset(
static_cast<float>(attributes.getValueAsInteger(ImageXOffsetAttribute, 0)),
static_cast<float>(attributes.getValueAsInteger(ImageYOffsetAttribute, 0)));
d_imageset->defineImage(name, rect, offset);
}
示例6: elementStart
/*************************************************************************
SAX2 Handler methods
*************************************************************************/
void Font_xmlHandler::elementStart(const String& element, const XMLAttributes& attributes)
{
// handle a Mapping element
if (element == MappingElement)
{
if (!d_font->d_freetype)
{
String image_name(attributes.getValueAsString(MappingImageAttribute));
utf32 codepoint = (utf32)attributes.getValueAsInteger(MappingCodepointAttribute);
int horzAdvance = attributes.getValueAsInteger(MappingHorzAdvanceAttribute, -1);
Font::glyphDat mapDat;
mapDat.d_image = &d_font->d_glyph_images->getImage(image_name);
// calculate advance width if it was not specified
if (horzAdvance == AutoGenerateHorzAdvance)
{
horzAdvance = (int)(mapDat.d_image->getWidth() + mapDat.d_image->getOffsetX());
}
mapDat.d_horz_advance_unscaled = horzAdvance;
mapDat.d_horz_advance = (uint)(((float)horzAdvance) * (d_font->d_autoScale ? d_font->d_horzScaling : 1.0f));
d_font->d_cp_map[codepoint] = mapDat;
}
else
{
Logger::getSingleton().logEvent((utf8*)"Mapping element encountered. This element is invalid for dynamic fonts.", Informative);
}
}
// handle root Font element
else if (element == FontElement)
{
// get name of font we are creating
String font_name(attributes.getValueAsString(FontNameAttribute));
// get filename for the font
String filename(attributes.getValueAsString(FontFilenameAttribute));
// get resource group for font file.
String resourceGroup(attributes.getValueAsString(FontResourceGroupAttribute));
Logger::getSingleton().logEvent("Started creation of Font '" + font_name + "' via XML file.", Informative);
//
// load auto-scaling configuration
//
float hres, vres;
bool auto_scale;
// get native horizontal resolution
hres = (float)attributes.getValueAsInteger(FontNativeHorzResAttribute, 640);
// get native vertical resolution
vres = (float)attributes.getValueAsInteger(FontNativeVertResAttribute, 480);
// get auto-scaling setting
auto_scale = attributes.getValueAsBool(FontAutoScaledAttribute, false);
//
// get type of font
//
String font_type(attributes.getValueAsString(FontTypeAttribute));
// dynamic (ttf) font
if (font_type == FontTypeDynamic)
{
// get size of font
uint size = (uint)attributes.getValueAsInteger(FontSizeAttribute, 12);
// extract codepoint range
utf32 first_codepoint = (utf32)attributes.getValueAsInteger(FontFirstCodepointAttribute, 32);
utf32 last_codepoint = (utf32)attributes.getValueAsInteger(FontLastCodepointAttribute, 127);
// build string containing the required code-points.
for (; first_codepoint <= last_codepoint; ++first_codepoint)
{
d_glyphSet += first_codepoint;
}
uint flags = attributes.getValueAsBool(FontAntiAliasedAttribute, true) ? 0 : NoAntiAlias;
// perform pre-initialisation
d_font->setNativeResolution(Size(hres, vres));
d_font->setAutoScalingEnabled(auto_scale);
// Finalise construction of font without glyphs.
// Glyphs will defined after we know which ones we need.
d_font->constructor_impl(font_name, filename, resourceGroup, size, flags, String(""));
}
// static (Imageset based) font
else if (font_type == FontTypeStatic)
{
d_font->d_name = font_name;
d_font->d_freetype = false;
// load the Imageset
d_font->d_glyph_images = ImagesetManager::getSingleton().createImageset(filename, resourceGroup);
//.........这里部分代码省略.........