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


C++ ConfigVar::GetI方法代码示例

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


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

示例1: GetPosition

void
Entity::UpdateDebug()
{
    int debug = cv_debug_entity.GetI();

    m_DirectionNode->setVisible( debug > 0 );
    m_SolidCollisionNode->setVisible( debug > 0 && m_Solid );
    m_TalkCollisionNode->setVisible( debug > 0 && m_Talkable );

    // debug output
    if( debug > 0 )
    {
        DEBUG_DRAW.SetColour( Ogre::ColourValue::White );
        DEBUG_DRAW.SetScreenSpace( true );
        DEBUG_DRAW.SetTextAlignment( DEBUG_DRAW.CENTER );
        DEBUG_DRAW.SetFadeDistance( 40, 50 );

        Ogre::Vector3 entity_pos = GetPosition();

        DEBUG_DRAW.Text( entity_pos, 0, 0, m_Name );
        DEBUG_DRAW.Text( entity_pos, 0, 12, m_AnimationCurrentName );

        if( debug > 1 )
        {
            static Ogre::String move_state_string[] = { "NONE", "WALKMESH", "LINEAR", "JUMP" };

            DEBUG_DRAW.Text( entity_pos, 0, 24, Ogre::StringConverter::toString( entity_pos ) );
            DEBUG_DRAW.Text( entity_pos, 0, 36, "Triangle: " + Ogre::StringConverter::toString( m_MoveTriangleId ) );
            DEBUG_DRAW.Text( entity_pos, 0, 48, "Move state: " + move_state_string[ m_State ] );
            switch( m_State )
            {
                case Entity::WALKMESH:
                {
                    DEBUG_DRAW.Line3d( entity_pos, m_MovePosition );
                }
                break;

                case Entity::LINEAR:
                {
                    DEBUG_DRAW.Text( m_LinearStart, 0, 0, "Start: " + Ogre::StringConverter::toString( m_LinearStart ) );
                    DEBUG_DRAW.Text( m_LinearEnd, 0, 0, "End: " + Ogre::StringConverter::toString( m_LinearEnd ) );
                    DEBUG_DRAW.Line3d( m_LinearStart, m_LinearEnd );
                }
                break;

                case Entity::JUMP:
                {
                    DEBUG_DRAW.Text( m_JumpStart, 0, 0, "Start: " + Ogre::StringConverter::toString( m_JumpStart ) );
                    DEBUG_DRAW.Text( m_JumpEnd, 0, 0, "End: " + Ogre::StringConverter::toString( m_JumpEnd ) );
                    Ogre::Vector3 distance = m_JumpEnd - m_JumpStart;
                    Ogre::Vector3 pos1, pos2, pos3;
                    pos1.x = m_JumpStart.x + distance.x * 0.25f;
                    pos1.y = m_JumpStart.y + distance.y * 0.25f;
                    float current1 = m_JumpSeconds / 4;
                    pos1.z = current1 * current1 * -13.08f + current1 * ( ( distance.z ) / m_JumpSeconds + m_JumpSeconds * 13.08f ) + m_JumpStart.z;
                    pos2.x = m_JumpStart.x + distance.x * 0.5f;
                    pos2.y = m_JumpStart.y + distance.y * 0.5f;
                    float current2 = current1 * 2;
                    pos2.z = current2 * current2 * -13.08f + current2 * ( ( distance.z ) / m_JumpSeconds + m_JumpSeconds * 13.08f ) + m_JumpStart.z;
                    pos3.x = m_JumpStart.x + distance.x * 0.75f;
                    pos3.y = m_JumpStart.y + distance.y * 0.75f;
                    float current3 = current1 * 3;
                    pos3.z = current3 * current3 * -13.08f + current3 * ( ( distance.z ) / m_JumpSeconds + m_JumpSeconds * 13.08f ) + m_JumpStart.z;
                    DEBUG_DRAW.Line3d( m_JumpStart, pos1 );
                    DEBUG_DRAW.Line3d( pos1, pos2 );
                    DEBUG_DRAW.Line3d( pos2, pos3 );
                    DEBUG_DRAW.Line3d( pos3, m_JumpEnd );
                }
                break;
            }
        }
    }
}
开发者ID:DeejStar,项目名称:q-gears,代码行数:73,代码来源:Entity.cpp

示例2: if

void
UiWidget::Update()
{
    if(m_Visible != true)
    {
        return;
    }

    if(m_AnimationCurrent != nullptr)
    {
        float delta_time = Timer::getSingleton().GetGameTimeDelta();
        float time = m_AnimationCurrent->GetTime();

        // if animation ended
        if(time + delta_time >= m_AnimationEndTime)
        {
            if(time != m_AnimationEndTime)
            {
                m_AnimationCurrent->AddTime(m_AnimationEndTime - time);
            }

            for(unsigned int i = 0; i < m_AnimationSync.size(); ++i)
            {
                ScriptManager::getSingleton().ContinueScriptExecution(m_AnimationSync[i]);
            }
            m_AnimationSync.clear();

            if(m_AnimationState == UiAnimation::DEFAULT && m_AnimationDefault != "")
            {
                // in case of cycled default we need to sync with end
                time = time + delta_time - m_AnimationCurrent->GetLength();
                PlayAnimation(m_AnimationDefault, UiAnimation::DEFAULT, time, -1);
            }
            else
            {
                m_AnimationCurrent = NULL;
            }
        }
        else
        {
            m_AnimationCurrent->AddTime(delta_time);
        }
    }
    else if( m_AnimationCurrent == NULL && m_AnimationState == UiAnimation::DEFAULT && m_AnimationDefault != "" )
    {
        PlayAnimation( m_AnimationDefault, UiAnimation::DEFAULT, 0, -1 );
    }



    if( m_UpdateTransformation == true )
    {
        UpdateTransformation();
    }



    for( unsigned int i = 0; i < m_Children.size(); ++i )
    {
        m_Children[ i ]->Update();
    }


    // debug output
    if(cv_debug_ui.GetI() >= 1)
    {
        float local_x1 = -m_FinalOrigin.x;
        float local_y1 = -m_FinalOrigin.y;
        float local_x2 = m_FinalSize.x + local_x1;
        float local_y2 = m_FinalSize.y + local_y1;
        float x = m_FinalTranslate.x;
        float y = m_FinalTranslate.y;

        DEBUG_DRAW.SetScreenSpace(true);

        DEBUG_DRAW.SetColour(Ogre::ColourValue(1, 0, 0, 1));

        int x1, y1, x2, y2, x3, y3, x4, y4;

        if(m_FinalRotation != 0)
        {
            float cos = Ogre::Math::Cos(Ogre::Radian(Ogre::Degree(m_FinalRotation)));
            float sin = Ogre::Math::Sin(Ogre::Radian(Ogre::Degree(m_FinalRotation)));

            x1 = static_cast<int>(local_x1 * cos - local_y1 * sin + x);
            y1 = static_cast<int>(local_x1 * sin + local_y1 * cos + y);
            x2 = static_cast<int>(local_x2 * cos - local_y1 * sin + x);
            y2 = static_cast<int>(local_x2 * sin + local_y1 * cos + y);
            x3 = static_cast<int>(local_x2 * cos - local_y2 * sin + x);
            y3 = static_cast<int>(local_x2 * sin + local_y2 * cos + y);
            x4 = static_cast<int>(local_x1 * cos - local_y2 * sin + x);
            y4 = static_cast<int>(local_x1 * sin + local_y2 * cos + y);
        }
        else
        {
            x1 = static_cast<int>(local_x1 + x);
            y1 = static_cast<int>(local_y1 + y);
            x2 = static_cast<int>(local_x2 + x);
            y2 = static_cast<int>(local_y1 + y);
            x3 = static_cast<int>(local_x2 + x);
//.........这里部分代码省略.........
开发者ID:adrielvel,项目名称:q-gears,代码行数:101,代码来源:UiWidget.cpp


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