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


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

本文整理汇总了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));
}
开发者ID:ALArmagost,项目名称:IV-Network,代码行数:35,代码来源:CEGUIAnimation_xmlHandler.cpp

示例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"));
}
开发者ID:respu,项目名称:xsilium-engine,代码行数:47,代码来源:ImageManager.cpp

示例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;
}
开发者ID:ALArmagost,项目名称:IV-Network,代码行数:44,代码来源:CEGUIAnimation_xmlHandler.cpp


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