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


C++ CClientPlayer::GetRotationDegrees方法代码示例

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


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

示例1: DoRender

void CRadarMap::DoRender ( void )
{
    bool bIsRadarShowing = IsRadarShowing ();

    // Render if showing
    if ( bIsRadarShowing )
    {
        // Get the alpha value from the settings
        int iRadarAlpha;
        g_pCore->GetCVars()->Get ( "mapalpha", iRadarAlpha );

        g_pCore->GetGraphics()->DrawTexture ( m_pRadarImage, static_cast < float > ( m_iMapMinX ),
                                                             static_cast < float > ( m_iMapMinY ),
                                                             m_fMapSize / m_pRadarImage->m_uiSizeX,
                                                             m_fMapSize / m_pRadarImage->m_uiSizeY,
                                                             0.0f, 0.0f, 0.0f,
                                                             SColorARGB ( iRadarAlpha, 255, 255, 255 ) );

        // Grab the info for the local player blip
        CVector2D vecLocalPos;
        CVector vecLocal;
        CVector vecLocalRot;
        if ( m_pManager->GetCamera()->IsInFixedMode() )
        {
            m_pManager->GetCamera()->GetPosition ( vecLocal );
            m_pManager->GetCamera()->GetRotation ( vecLocalRot );
        }
        else
        {
            CClientPlayer* pLocalPlayer = m_pManager->GetPlayerManager ()->GetLocalPlayer ();
            if ( !pLocalPlayer )
                return;
            pLocalPlayer->GetPosition ( vecLocal );
            pLocalPlayer->GetRotationDegrees ( vecLocalRot );
        }

        CalculateEntityOnScreenPosition ( vecLocal, vecLocalPos );

        // Now loop our radar areas
        unsigned short usDimension = m_pRadarAreaManager->GetDimension ();
        CClientRadarArea * pArea = NULL;
        list < CClientRadarArea* > ::const_iterator areaIter = m_pRadarAreaManager->IterBegin ();
        for ( ; areaIter != m_pRadarAreaManager->IterEnd (); areaIter++ )
        {
            pArea = *areaIter;

            if ( pArea->GetDimension() == usDimension )
            {
                // Grab the area image and calculate the position to put it on the screen
                CVector2D vecPos;
                CalculateEntityOnScreenPosition ( pArea, vecPos );

                // Get the area size and work out the ratio
                CVector2D vecSize;
                float fX = (*areaIter)->GetSize ().fX;
                float fY = (*areaIter)->GetSize ().fY;
                float fRatio = 6000.0f / m_fMapSize;

                // Calculate the size of the area
                vecSize.fX = static_cast < float > ( fX / fRatio );
                vecSize.fY = static_cast < float > ( fY / fRatio );
                g_pCore->GetGraphics ()->DrawRectangle ( vecPos.fX, vecPos.fY, vecSize.fX, -vecSize.fY, pArea->GetColor () );
            }
        }

        // Now loop our radar markers
        usDimension = m_pRadarMarkerManager->GetDimension();
        list < CClientRadarMarker* > ::const_iterator markerIter = m_pRadarMarkerManager->IterBegin ();
        for ( ; markerIter != m_pRadarMarkerManager->IterEnd (); markerIter++ )
        {
            if ( (*markerIter)->IsVisible () && (*markerIter)->GetDimension() == usDimension )
            {
                // Grab the marker image and calculate the position to put it on the screen
                float fScale = 1;
                SColor color;
                CTextureItem* pTexture = GetMarkerTexture ( *markerIter, vecLocal.fZ, &fScale, &color );

                if ( pTexture )
                {
                    CVector2D vecPos;
                    CalculateEntityOnScreenPosition ( *markerIter, vecPos );
                    g_pCore->GetGraphics()->DrawTexture ( pTexture, vecPos.fX, vecPos.fY, fScale, fScale, 0.0f, 0.5f, 0.5f, color );
                }
            }
        }

        g_pCore->GetGraphics()->DrawTexture ( m_pLocalPlayerBlip, vecLocalPos.fX, vecLocalPos.fY, 1.0, 1.0, vecLocalRot.fZ, 0.5f, 0.5f );
    }

    // Update visibility of help text
    bool bRequiredTextVisible = bIsRadarShowing && !m_bHideHelpText;
    if ( bRequiredTextVisible != m_bTextVisible )
    {
        m_bTextVisible = bRequiredTextVisible;
        for ( uint i = 0 ; i < m_HelpTextList.size () ; i++ )
            m_HelpTextList[i]->SetVisible ( m_bTextVisible );

        SetupMapVariables ();
    }
}
开发者ID:EagleShen,项目名称:MTA,代码行数:100,代码来源:CRadarMap.cpp


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