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


C++ CGUI::GetResolution方法代码示例

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


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

示例1: CreateWindows

void CLocalGUI::CreateWindows ( void )
{
    CFilePathTranslator     FileTranslator;
    string                  WorkingDirectory;
    char                    szCurDir [ 1024 ];

    // Set the current directory.
    FileTranslator.SetCurrentWorkingDirectory ( "MTA" );
    FileTranslator.GetCurrentWorkingDirectory ( WorkingDirectory );
    GetCurrentDirectory ( sizeof ( szCurDir ), szCurDir );
    SetCurrentDirectory ( WorkingDirectory.c_str ( ) );

    CGUI* pGUI = CCore::GetSingleton ().GetGUI ();

    // Create chatbox
    m_pChat = new CChat ( pGUI, CVector2D ( 0.0125f, 0.015f ) );
    m_pChat->SetVisible ( false );

    // Create the debug view
    m_pDebugView = new CDebugView ( pGUI, CVector2D ( 0.23f, 0.785f ) );
    m_pDebugView->SetVisible ( false );

	// Create the overlayed version labels
	CVector2D ScreenSize = pGUI->GetResolution ();
    m_pLabelVersionTag = reinterpret_cast < CGUILabel* > ( pGUI->CreateLabel ( "MTA:SA " MTA_DM_BUILDTAG_SHORT ) );
	m_pLabelVersionTag->SetSize ( CVector2D ( m_pLabelVersionTag->GetTextExtent() + 5, 18 ) );
	m_pLabelVersionTag->SetPosition ( CVector2D ( ScreenSize.fX - m_pLabelVersionTag->GetTextExtent() - 5, ScreenSize.fY - 15 ) );
	m_pLabelVersionTag->SetAlpha ( 0.5f );
	m_pLabelVersionTag->SetTextColor ( 255, 255, 255 );
	m_pLabelVersionTag->SetZOrderingEnabled ( false );
    m_pLabelVersionTag->MoveToBack ();
    m_pLabelVersionTag->SetVisible ( false );

    // Create mainmenu
    m_pMainMenu = new CMainMenu ( pGUI );
    m_pMainMenu->SetVisible ( false );

    // Create console
    m_pConsole = new CConsole ( pGUI );
    m_pConsole->SetVisible ( false );

    // Create community registration window
    m_CommunityRegistration.CreateWindows ();
    m_CommunityRegistration.SetVisible ( false );

	// Return the old current dir.
    SetCurrentDirectory ( szCurDir );
}
开发者ID:Gamesnert,项目名称:multitheftauto,代码行数:48,代码来源:CGUI.cpp

示例2: CreateWindows

void CLocalGUI::CreateWindows ( bool bGameIsAlreadyLoaded )
{
    CGUI* pGUI = CCore::GetSingleton ().GetGUI ();

    // Create chatbox
    m_pChat = new CChat ( pGUI, CVector2D ( 0.0125f, 0.015f ) );
    m_pChat->SetVisible ( false );

    // Create the debug view
    m_pDebugView = new CDebugView ( pGUI, CVector2D ( 0.23f, 0.785f ) );
    m_pDebugView->SetVisible ( false );

    // Create the overlayed version labels
    CVector2D ScreenSize = pGUI->GetResolution ();
    SString strText = "MTA:SA " MTA_DM_BUILDTAG_SHORT;
    if ( _NETCODE_VERSION_BRANCH_ID != 0x04 )
        strText += SString( " (%X)", _NETCODE_VERSION_BRANCH_ID );
    m_pLabelVersionTag = reinterpret_cast < CGUILabel* > ( pGUI->CreateLabel ( strText ) );
    m_pLabelVersionTag->SetSize ( CVector2D ( m_pLabelVersionTag->GetTextExtent() + 5, 18 ) );
    m_pLabelVersionTag->SetPosition ( CVector2D ( ScreenSize.fX - m_pLabelVersionTag->GetTextExtent() - 5, ScreenSize.fY - 15 ) );
    m_pLabelVersionTag->SetAlpha ( 0.5f );
    m_pLabelVersionTag->SetTextColor ( 255, 255, 255 );
    m_pLabelVersionTag->SetZOrderingEnabled ( false );
    m_pLabelVersionTag->MoveToBack ();
    m_pLabelVersionTag->SetVisible ( false );

    // Create mainmenu
    m_pMainMenu = new CMainMenu ( pGUI );
    m_pMainMenu->SetVisible ( bGameIsAlreadyLoaded, !bGameIsAlreadyLoaded, false );

    // Create console
    m_pConsole = new CConsole ( pGUI );
    m_pConsole->SetVisible ( false );

    // Create community registration window
    m_CommunityRegistration.CreateWindows ();
    m_CommunityRegistration.SetVisible ( false );

    // Create our news headlines if we're already ingame
    if ( bGameIsAlreadyLoaded )
        m_pMainMenu->GetNewsBrowser()->CreateHeadlines();
}
开发者ID:stymR,项目名称:mtasa-blue,代码行数:42,代码来源:CGUI.cpp

示例3: strBuffer


//.........这里部分代码省略.........
        "Matthew \"Towncivilian\" Wolfe\n"
        "Adamix\n"
        "Aibo\n"
        "Pugwipe\n"
        "The_GTA\n"
        "Phatlooser\n"
        "Dwayne 'The 'Woovie' Rock' Johnson\n"
        "max 'Hobo Pie' Power\n"
        "diegofkda\n"
        "Ren712\n"
        "StifflersMom\n"
        "\n"
        "\n";

    m_strCredits += _("This software makes use of the following libraries and software:");
    m_strCredits +=
        "\n"
        "RakNet (http://www.jenkinssoftware.com/)\n"
        "SA Limit adjuster source code (Credits to Sacky)\n"
        "CEGUI (http://www.cegui.org.uk/)\n"
        "cURL (http://curl.haxx.se/)\n"
        "libpcre (http://www.pcre.org/)\n"
        "Lua (http://www.lua.org/)\n"
        "SQLite (http://www.sqlite.org/)\n"
        "libpng (http://www.libpng.org/)\n"
        "Embedded HTTP Server (http://ehs.fritz-elfert.de/)\n"
        "zlib (http://zlib.net/)\n"
        "bzip2 (http://bzip.org/)\n"
        "UnRAR (http://www.rarlab.com/)\n"
        "tinygettext (https://github.com/tinygettext/tinygettext/)\n"
        "PortAudio (http://www.portaudio.com/)\n"
        "speex (http://www.speex.org/)\n"
        "CEF (https://bitbucket.org/chromiumembedded/cef/)\n";

    // Create our window
    CVector2D RelativeWindow = CVector2D(fWindowX / pManager->GetResolution().fX, fWindowY / pManager->GetResolution().fY);
    m_pWindow = reinterpret_cast<CGUIWindow*>(pManager->CreateWnd(NULL, "Multi Theft Auto: San Andreas " MTA_DM_BUILDTAG_SHORT));
    m_pWindow->SetCloseButtonEnabled(false);
    m_pWindow->SetMovable(false);
    m_pWindow->SetPosition(CVector2D(0.5f - RelativeWindow.fX * 0.5f, 0.5f - RelativeWindow.fY * 0.5f), true);
    m_pWindow->SetSize(CVector2D(fWindowX, fWindowY));            // relative 0.70, 0.50
    m_pWindow->SetSizingEnabled(false);
    m_pWindow->SetVisible(false);
    m_pWindow->SetAlwaysOnTop(true);

    // Credits label
    memset(m_pLabels, 0, sizeof(CGUILabel*) * 30);

    // Create one for every 15th line. This is because of some limit at 500 chars
    float        fStartPosition = 1.0f;
    const char*  szCreditsIterator = m_strCredits.c_str();
    const char*  szCreditsBegin = m_strCredits.c_str();
    unsigned int uiLineCount = 0;
    unsigned int uiLabelIndex = 0;
    while (true)
    {
        // Count every new line
        if (*szCreditsIterator == '\n')
            ++uiLineCount;

        // 15? Create a new label
        if (uiLineCount >= 15 || *szCreditsIterator == 0)
        {
            // Copy out the text we shall put in that label
            std::string strBuffer(szCreditsBegin, szCreditsIterator - szCreditsBegin);

            // Remember where we count from
            szCreditsBegin = szCreditsIterator;
            ++szCreditsBegin;

            // Create the label
            m_pLabels[uiLabelIndex] = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(m_pWindow, strBuffer.c_str()));
            m_pLabels[uiLabelIndex]->SetPosition(CVector2D(0.022f, fStartPosition), true);
            m_pLabels[uiLabelIndex]->SetSize(CVector2D(532.0f, 1200.0f));            // relative 0.95, 6.0
            m_pLabels[uiLabelIndex]->SetHorizontalAlign(CGUI_ALIGN_HORIZONTALCENTER);
            ++uiLabelIndex;

            // Reset the linecount
            uiLineCount = 0;
        }

        // End the loop at 0
        if (*szCreditsIterator == 0)
            break;

        // Increase the credits iterator
        ++szCreditsIterator;
    }

    // Create the OK button
    m_pButtonOK = reinterpret_cast<CGUIButton*>(pManager->CreateButton(m_pWindow, "OK"));
    m_pButtonOK->SetPosition(CVector2D(0.77f, 0.90f), true);
    m_pButtonOK->SetSize(CVector2D(112.0f, 21.0f));            // relative 0.20, 0.07
    m_pButtonOK->SetVisible(true);
    m_pButtonOK->SetAlwaysOnTop(true);

    // Set up the event handlers
    m_pButtonOK->SetClickHandler(GUI_CALLBACK(&CCredits::OnOKButtonClick, this));
    m_pWindow->SetEnterKeyHandler(GUI_CALLBACK(&CCredits::OnOKButtonClick, this));
}
开发者ID:Audifire,项目名称:mtasa-blue,代码行数:101,代码来源:CCredits.cpp

示例4: memset

CCredits::CCredits ( void )
{
    CGUI *pManager = g_pCore->GetGUI ();

    // Create our window
    CVector2D RelativeWindow = CVector2D ( fWindowX / pManager->GetResolution ().fX, fWindowY / pManager->GetResolution ().fY );
    m_pWindow = reinterpret_cast < CGUIWindow* > ( pManager->CreateWnd ( NULL, "Multi Theft Auto: San Andreas " MTA_DM_BUILDTAG_SHORT ) );
    m_pWindow->SetCloseButtonEnabled ( false );
    m_pWindow->SetMovable ( false );
    m_pWindow->SetPosition ( CVector2D ( 0.5f - RelativeWindow.fX*0.5f, 0.5f - RelativeWindow.fY*0.5f ), true );
    m_pWindow->SetSize ( CVector2D ( fWindowX, fWindowY ) );		// relative 0.70, 0.50
    m_pWindow->SetSizingEnabled ( false );
    m_pWindow->SetVisible ( false );
    m_pWindow->SetAlwaysOnTop ( true );

    // Credits label
    memset ( m_pLabels, 0, sizeof ( CGUILabel* ) * 30 );

    // Create one for every 15th line. This is because of some limit at 500 chars
    float fStartPosition = 1.0f;
    const char* szCreditsIterator = g_szCredits;
    const char* szCreditsBegin = g_szCredits;
    unsigned int uiLineCount = 0;
    unsigned int uiLabelIndex = 0;
    while ( true )
    {
        // Count every new line
        if ( *szCreditsIterator == '\n' )
            ++uiLineCount;

        // 15? Create a new label
        if ( uiLineCount >= 15 || *szCreditsIterator == 0 )
        {
            // Copy out the text we shall put in that label
            char szBuffer [512];
            unsigned int uiCreditsSize = (szCreditsIterator - szCreditsBegin);
            if ( uiCreditsSize >= 512 )
                uiCreditsSize = 511;
            memcpy ( szBuffer, szCreditsBegin, uiCreditsSize );
            szBuffer [uiCreditsSize] = 0;

            // Remember where we count from
            szCreditsBegin = szCreditsIterator;
            ++szCreditsBegin;

            // Create the label
            m_pLabels [uiLabelIndex] = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( m_pWindow, szBuffer ) );
            m_pLabels [uiLabelIndex]->SetPosition ( CVector2D ( 0.022f, fStartPosition ), true );
            m_pLabels [uiLabelIndex]->SetSize ( CVector2D ( 532.0f, 1200.0f ) );			// relative 0.95, 6.0
            m_pLabels [uiLabelIndex]->SetHorizontalAlign ( CGUI_ALIGN_HORIZONTALCENTER );
            ++uiLabelIndex;

            // Reset the linecount
            uiLineCount = 0;
        }

        // End the loop at 0
        if ( *szCreditsIterator == 0 )
            break;

        // Increase the credits iterator
        ++szCreditsIterator;
    }

    // Create the OK button
    m_pButtonOK = reinterpret_cast < CGUIButton* > ( pManager->CreateButton ( m_pWindow, "OK" ) );
    m_pButtonOK->SetPosition ( CVector2D ( 0.77f, 0.90f ), true );
    m_pButtonOK->SetSize ( CVector2D ( 112.0f, 21.0f ) );		// relative 0.20, 0.07
    m_pButtonOK->SetVisible ( true );

    // Set up the event handlers
    m_pButtonOK->SetClickHandler ( GUI_CALLBACK ( &CCredits::OnOKButtonClick, this ) );
}
开发者ID:rast,项目名称:multitheftauto,代码行数:73,代码来源:CCredits.cpp


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