本文整理汇总了C++中XMLAttributes::getValueAsFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLAttributes::getValueAsFloat方法的具体用法?C++ XMLAttributes::getValueAsFloat怎么用?C++ XMLAttributes::getValueAsFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLAttributes
的用法示例。
在下文中一共展示了XMLAttributes::getValueAsFloat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: anim_name
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
AnimationDefinitionHandler::AnimationDefinitionHandler(
const XMLAttributes& attributes,
const String& name_prefix) :
d_anim(0)
{
const String anim_name(name_prefix +
attributes.getValueAsString(NameAttribute));
Logger::getSingleton().logEvent(
"Defining animation named: " +
anim_name +
" Duration: " +
attributes.getValueAsString(DurationAttribute) +
" Replay mode: " +
attributes.getValueAsString(ReplayModeAttribute) +
" Auto start: " +
attributes.getValueAsString(AutoStartAttribute, "false"));
d_anim = AnimationManager::getSingleton().createAnimation(anim_name);
d_anim->setDuration(attributes.getValueAsFloat(DurationAttribute));
const String replayMode(attributes.getValueAsString(ReplayModeAttribute,
ReplayModeLoop));
if (replayMode == ReplayModeOnce)
d_anim->setReplayMode(Animation::RM_Once);
else if (replayMode == ReplayModeBounce)
d_anim->setReplayMode(Animation::RM_Bounce);
else
d_anim->setReplayMode(Animation::RM_Loop);
d_anim->setAutoStart(attributes.getValueAsBool(AutoStartAttribute));
}
示例2: elementImagesetStart
//----------------------------------------------------------------------------//
void ImageManager::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("[ImageManager] Started creation of Imageset from XML specification:");
logger.logEvent("[ImageManager] ---- CEGUI Imageset name: " + name);
logger.logEvent("[ImageManager] ---- Source texture file: " + filename);
logger.logEvent("[ImageManager] ---- Source texture resource group: " +
(resource_group.empty() ? "(Default)" : resource_group));
validateImagesetFileVersion(attributes);
Renderer* const renderer = System::getSingleton().getRenderer();
// if the texture already exists,
if (renderer->isTextureDefined(name))
{
Logger::getSingleton().logEvent(
"[ImageManager] WARNING: Using existing texture: " + name);
s_texture = &renderer->getTexture(name);
}
else
{
// create texture from image
s_texture = &renderer->createTexture(name, filename,
resource_group.empty() ? d_imagesetDefaultResourceGroup :
resource_group);
}
// set native resolution for imageset
s_nativeResolution = Sizef(
attributes.getValueAsFloat(ImagesetNativeHorzResAttribute, 640),
attributes.getValueAsFloat(ImagesetNativeVertResAttribute, 480));
// set auto-scaling as needed
s_autoScaled = PropertyHelper<AutoScaledMode>::fromString(
attributes.getValueAsString(ImagesetAutoScaledAttribute, "false"));
}
示例3: progressionStr
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
AnimationKeyFrameHandler::AnimationKeyFrameHandler(
const XMLAttributes& attributes,
Affector& affector)
{
const String progressionStr(
attributes.getValueAsString(ProgressionAttribute));
String log_event(
"\t\tAdding KeyFrame at position: " +
attributes.getValueAsString(PositionAttribute) +
" Value: " +
attributes.getValueAsString(ValueAttribute));
if (!progressionStr.empty())
log_event.append(" Progression: " +
attributes.getValueAsString(ProgressionAttribute, ProgressionLinear));
Logger::getSingleton().logEvent(log_event);
KeyFrame::Progression progression;
if (progressionStr == ProgressionDiscrete)
progression = KeyFrame::P_Discrete;
else if (progressionStr == ProgressionQuadraticAccelerating)
progression = KeyFrame::P_QuadraticAccelerating;
else if (progressionStr == ProgressionQuadraticDecelerating)
progression = KeyFrame::P_QuadraticDecelerating;
else
progression = KeyFrame::P_Linear;
affector.createKeyFrame(
attributes.getValueAsFloat(PositionAttribute),
attributes.getValueAsString(ValueAttribute),
progression,
attributes.getValueAsString(SourcePropertyAttribute));
if (affector.getNumKeyFrames() == 1 && !progressionStr.empty())
Logger::getSingleton().logEvent(
"WARNING: progression type specified for first keyframe in "
"animation will be ignored.");
d_completed = true;
}