示例#1
0
CFavouritesAddByIP::CFavouritesAddByIP ( void )
{
    CGUI *pManager = g_pCore->GetGUI ();
    CMainMenu *pMainMenu = CLocalGUI::GetSingleton ().GetMainMenu ();

    // Create the window
    m_pWindow = reinterpret_cast < CGUIWindow* > ( pManager->CreateWnd ( NULL, "Add to favourites" ) );
    m_pWindow->SetCloseButtonEnabled ( false );

    CVector2D resolution = CCore::GetSingleton().GetGUI()->GetResolution();
    m_pWindow->SetPosition ( CVector2D ( resolution.fX / 2 - 280.0f / 2, resolution.fY / 2 - 90.0f / 2  ), false );
    m_pWindow->SetSize ( CVector2D ( 280.0f, 90.0f ), false );
    m_pWindow->SetSizingEnabled ( false );
	m_pWindow->SetAlwaysOnTop ( true );

    // Create the controls
    float fPosX = 0.0f;
    float fButtonWidth = (280.0f - 30.0f) / 2;

    //  Host label
    m_pLabelHost = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( m_pWindow, "Host:" ) );
    m_pLabelHost->SetPosition ( CVector2D ( fPosX + 12.0f, 28.0f ), false );
    m_pLabelHost->AutoSize ( "Host:" );
    fPosX += 12.0f + m_pLabelHost->GetSize ().fX;

    //  Host edit
    m_pEditHost = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( m_pWindow ) );
    m_pEditHost->SetPosition ( CVector2D ( fPosX + 5.0f, 24.0f ), false );
    m_pEditHost->SetSize ( CVector2D ( 154.0f, 24.0f ), false );
    m_pEditHost->SetMaxLength ( 128 );          // Just to prevent entering a huge hostname size.. no-one has a hostname over 128 chars i believe
    fPosX += 5.0f + 154.0f;

    //  Port label
    m_pLabelPort = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( m_pWindow, ":" ) );
    m_pLabelPort->SetPosition ( CVector2D ( fPosX + 3.0f, 28.0f ), false );
    m_pLabelPort->AutoSize ( ":" );
    fPosX += 3.0f + m_pLabelPort->GetSize ().fX;

    //  Port edit
    m_pEditPort = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( m_pWindow ) );
    m_pEditPort->SetPosition ( CVector2D ( fPosX + 3.0f, 24.0f ), false );
    m_pEditPort->SetSize ( CVector2D ( 59.0f, 24.0f ), false );
    m_pEditPort->SetMaxLength ( 5 );
    fPosX += 3.0f + 59.0f;

    //  Add button
    m_pButtonAdd = reinterpret_cast < CGUIButton* > ( pManager->CreateButton ( m_pWindow, "Add" ) );
    m_pButtonAdd->SetPosition ( CVector2D ( 12.0f, 60.0f ), false );
    m_pButtonAdd->SetSize ( CVector2D ( fButtonWidth, 20.0f ), false );

    //  Cancel button
    m_pButtonBack = reinterpret_cast < CGUIButton* > ( pManager->CreateButton ( m_pWindow, "Back" ) );
    m_pButtonBack->SetPosition ( CVector2D ( 12.0f + fButtonWidth + 6.0f, 60.0f ), false );
    m_pButtonBack->SetSize ( CVector2D ( fButtonWidth, 20.0f ), false );

    // Register button events
    m_pButtonBack->SetClickHandler ( GUI_CALLBACK ( &CFavouritesAddByIP::OnButtonBackClick, this ) );
}
示例#2
0
CQuestionBox::CQuestionBox ( void )
{
    m_pWindow = NULL;
    m_pMessage = NULL;
    m_uiLastButton = -1;
    m_Callback = NULL;
    m_CallbackParameter = 0;
    m_uiActiveButtons = 0;
    m_uiActiveEditboxes = 0;

    CGUI *pManager = g_pCore->GetGUI ();

    // Create the window
    m_pWindow = reinterpret_cast < CGUIWindow* > ( pManager->CreateWnd ( NULL, "" ) );
    m_pWindow->SetCloseButtonEnabled ( false );
    m_pWindow->SetVisible ( false );
    m_pWindow->SetSizingEnabled ( false );
    m_pWindow->SetAlwaysOnTop ( true );

    // Message label
    m_pMessage = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( m_pWindow, "" ) );
}
示例#3
0
////////////////////////////////////////////////////
//
//  CNewsBrowser::CreateGUI
//
//
//
////////////////////////////////////////////////////
void CNewsBrowser::CreateGUI(void)
{
    CreateHeadlines();
    CGUI* pManager = g_pCore->GetGUI();

    // Create the window
    m_pWindow = reinterpret_cast<CGUIWindow*>(pManager->CreateWnd(NULL, "NEWS"));
    m_pWindow->SetCloseButtonEnabled(true);
    m_pWindow->SetMovable(true);

    CVector2D resolution = CCore::GetSingleton().GetGUI()->GetResolution();
    float     yoff = resolution.fY > 600 ? resolution.fY / 12 : 0.0f;
    m_pWindow->SetPosition(CVector2D(resolution.fX / 2 - 640.0f / 2, resolution.fY / 2 - 480.0f / 2 + yoff), false);
    m_pWindow->SetSize(CVector2D(640.0f, 480.0f));
    m_pWindow->SetSizingEnabled(false);
    m_pWindow->SetAlwaysOnTop(true);

    // Create buttons
    //  OK button
    m_pButtonOK = reinterpret_cast<CGUIButton*>(pManager->CreateButton(m_pWindow, "OK"));
    m_pButtonOK->SetPosition(CVector2D(560.0f - 60, 480.0f - 30));
    m_pButtonOK->SetZOrderingEnabled(false);

    // Set up the events
    m_pWindow->SetEnterKeyHandler(GUI_CALLBACK(&CNewsBrowser::OnOKButtonClick, this));
    m_pButtonOK->SetClickHandler(GUI_CALLBACK(&CNewsBrowser::OnOKButtonClick, this));

    // Create the tab panel and necessary tabs
    m_pTabPanel = reinterpret_cast<CGUITabPanel*>(pManager->CreateTabPanel(m_pWindow));
    m_pTabPanel->SetPosition(CVector2D(0, 20.0f));
    m_pTabPanel->SetSize(CVector2D(640.0f, 480.0f - 60));

    for (uint i = 0; i < m_NewsitemList.size(); i++)
    {
        AddNewsTab(m_NewsitemList[i]);
    }
}
示例#4
0
CCredits::CCredits(void)
{
    CGUI* pManager = g_pCore->GetGUI();

    // Define our credits string
    m_strCredits += "== Multi Theft Auto: San Andreas v" MTA_DM_BUILDTAG_SHORT
                    " ==\n"
                    "\n";

    m_strCredits += _("Programming");
    m_strCredits +=
        "\n\n"

        "Alberto \"ryden\" Alonso\n"
        "Marcus \"mabako\" Bauer\n"
        "Hendrik \"arc_\" van den Berge\n"
        "Stanislav \"lil_Toady\" Bobrov\n"
        "Dan \"Talidan\" Chowdhury\n"
        "Chris \"ccw\" Cockwanger\n"
        "Adge \"Jax\" Cutler\n"
        "Cecill \"ijs\" Etheredge\n"
        "Sebas \"x86\" Lamers\n"
        "Raphael \"Mr.Hankey\" Leiteritz\n"
        "Ed \"eAi\" Lyons\n"
        "Christian \"ChrML\" Myhre Lundheim\n"
        "Qais \"qaisjp\" Patankar\n"
        "Arushan \"aru\" Raj\n"
        "Frank \"Aim\" Spijkerman\n"
        "Pascal \"sbx320\" Stücker\n"
        "Kevin \"Kevuwk\" Whiteside\n"
        "Richard \"Cazomino05\" Whitlock\n"
        "Gamesnert\n"
        "Jusonex\n"
        "\n"
        "\n";

    m_strCredits += _("Contributors");
    m_strCredits +=
        "\n\n"

        "Danish \"Saml1er\" Khan\n"
        "Marek \"botder\" Kulik\n"
        "Arran\n"
        "Iztas\n"
        "impulze\n"
        "JoeBullet\n"
        "lopezloo\n"
        "MX_Master\n"
        "Remp\n"
        "\n"
        "\n";

    m_strCredits += _("Game Design / Scripting");
    m_strCredits +=
        "\n\n"

        "John \"Johnline\" Borsberry\n"
        "Paul \"Brophy\" Brophy\n"
        "Maciej \"MACK\" Cieslak\n"
        "Jacek \"jhxp\" Halas vel Lagoda\n"
        "Brad \"Slothman\" Hammond\n"
        "Norbert \"norby89\" Juhos\n"
        "Kris \"KWKSND\" Kulchisky\n"
        "Dustin \"Ransom\" Morren\n"
        "erorr404\n"
        "Synecy\n"
        "Dutchman101\n"
        "\n"
        "\n";

    if (g_pLocalization->IsLocalized() && !g_pLocalization->GetTranslators().empty())
    {
        m_strCredits += _("Language Localization");
        m_strCredits += "\n\n";
        m_strCredits += g_pLocalization->GetTranslators();
        m_strCredits += "\n\n\n";
    }

    m_strCredits += _("Patch contributors");
    m_strCredits +=
        "\n\n"

        "Lukasz \"W\" Biegaj\n"
        "Florian \"Flobu\" Busse\n"
        "Callum \"Callum\" Dawson\n"
        "Philip \"Fenix\" Farquharson\n"
        "Robin \"robhol\" Holm\n"
        "Patrik \"myonlake\" Juvonen\n"
        "Gabrielius \"Dezash\" Laurinavicius\n"
        "Adam \"50p\" Telega\n"
        "Ilya \"Kenix\" Volkov\n"
        "Gothem\n"
        "rafalh\n"
        "Totto8492\n"
        "CubedDeath\n"
        "GRascm\n"
        "NeO_D-Power\n"
        "Dragon\n"
        "DirtY_iCE\n"
        "Zango\n"
        "lucasc190\n"
        "samt2497\n"
        "MCvarial\n"
        "tvc\n"
        "Audifire\n"
        "Kayl\n"
        "mickdermack\n"
        "Fabio(GNR)\n"
        "LarSoWiTsH\n"
        "dvarnai\n"
        "Loooop\n"
        "Lex128\n"
        "x0rh4x\n"
        "guix\n"
        "[GP_A]XetaQuake\n"
        "asturel\n"
        "FrankZZ\n"
        "John_Michael\n"
        "-ffs-Sniper\n"
        "W\n"
        "Fedor Sinev\n"
        "zneext\n"
        "ZReC\n"
        "Pawelo / 4O4\n"
        "Sergeanur\n"
        "AleksCore\n"
        "tederis\n"
        "CrosRoad95\n"
        "Bonus1702\n"
        "Einheit-101\n"
        "TAPL-93\n"
        "JR10\n"
        "PhrozenByte\n"
        "AboShanab\n"
        "GTX / Timic3\n"
        "FileEX\n"
        "Pirulax\n"
        "\n"
        "\n";

    m_strCredits += _("Special Thanks");
    m_strCredits +=
        "\n\n"

        "Derek \"slush\" Abdine\n"
        "Javier \"jbeta\" Beta\n"
        "Oliver \"Oli\" Brown\n"
        "Wojciech \"Wojjie\" Hlibowicki\n"
        "Chris \"Cray\" McArthur\n"
        "Rob 'Sugar Daddy' Pooley\n"
        "Hans \"Blokker\" Roes\n"
        "Kent \"Kent747\" Simon\n"
        "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));
}
示例#5
0
CServerBrowser::CServerBrowser ( void )
{
    CGUI *pManager = g_pCore->GetGUI ();

    // Initialize
    m_ulLastUpdateTime = 0;
    m_PrevServerBrowserType = INTERNET;

    // Create serverbrowser window
    m_pWindow = reinterpret_cast < CGUIWindow* > ( pManager->CreateWnd ( NULL, "SERVER BROWSER" ) );
    m_pWindow->SetCloseButtonEnabled ( false );
    m_pWindow->SetMovable ( true );
    m_pWindow->SetSizingEnabled ( true );
    CVector2D resolution = CCore::GetSingleton().GetGUI()->GetResolution();
    m_pWindow->SetPosition ( CVector2D ( resolution.fX / 2 - BROWSER_DEFAULTWIDTH / 2, resolution.fY / 2 - BROWSER_DEFAULTHEIGHT / 2  ), false );
    m_pWindow->SetSize ( CVector2D ( BROWSER_DEFAULTWIDTH, BROWSER_DEFAULTHEIGHT ) );
    m_pWindow->SetAlwaysOnTop ( true );
    m_pWindow->SetMinimumSize ( CVector2D ( BROWSER_DEFAULTWIDTH, BROWSER_DEFAULTHEIGHT ) );

	// Create the serverlist tab panel and some tabs
	m_pTabs = reinterpret_cast < CGUITabPanel* > ( pManager->CreateTabPanel ( m_pWindow ) );
	m_pTabs->SetPosition ( CVector2D ( 0.0f, 25.0f ) );
	m_pTabs->SetSize ( CVector2D ( BROWSER_DEFAULTWIDTH, BROWSER_DEFAULTHEIGHT - 60.0f ) );
    
    // Back button
    m_pButtonBack = reinterpret_cast < CGUIButton* > ( pManager->CreateButton ( m_pWindow, "Back" ) );
    m_pButtonBack->SetPosition ( CVector2D ( BROWSER_DEFAULTWIDTH - 123.0f, BROWSER_DEFAULTHEIGHT - 32.0f ), false );
    m_pButtonBack->SetSize ( CVector2D ( 108.0f, 20.0f ), false );

    // Create the serverlist status label
    m_pServerListStatus = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( m_pWindow, "Loading..." ) );
    m_pServerListStatus->SetPosition ( CVector2D ( 14.0f, BROWSER_DEFAULTHEIGHT - 30.0f ) );
	m_pServerListStatus->SetSize ( CVector2D ( 0.40f, 0.40f ), true );
    //m_pServerListStatus->SetMinimumSize ( CVector2D ( 1.0f, 1.0f ) );
    //m_pServerListStatus->SetMaximumSize ( CVector2D ( 1.0f, 1.0f ) );

	// Create locked icon
	m_pLockedIcon = reinterpret_cast < CGUIStaticImage* > ( pManager->CreateStaticImage ( m_pWindow ) );
	m_pLockedIcon->SetVisible ( false );
	m_pLockedIcon->SetFrameEnabled ( false );
	m_pLockedIcon->LoadFromFile ( "cgui\\images\\locked.png" );

    // Serial verification icon
	m_pSerialIcon = reinterpret_cast < CGUIStaticImage* > ( pManager->CreateStaticImage ( m_pWindow ) );
	m_pSerialIcon->SetVisible ( false );
	m_pSerialIcon->SetFrameEnabled ( false );
	m_pSerialIcon->LoadFromFile ( "cgui\\images\\shield.png" );

    //Set necessary handlers
    m_pButtonBack->SetClickHandler ( GUI_CALLBACK ( &CServerBrowser::OnBackClick, this ) );
    m_pWindow->SetSizedHandler ( GUI_CALLBACK ( &CServerBrowser::OnWindowSize, this ) );

    // Create the tabs
    CreateTab ( ServerBrowserType::INTERNET, "Internet" );
	CreateTab ( ServerBrowserType::LAN, "Lan" );
    CreateTab ( ServerBrowserType::FAVOURITES, "Favourites" );
    CreateTab ( ServerBrowserType::RECENTLY_PLAYED, "Recently Played" );
    
    // Create the "Add to favourites by IP" button
    m_pButtonFavouritesByIP = reinterpret_cast < CGUIButton * > ( pManager->CreateButton ( m_pTab [ ServerBrowserType::FAVOURITES ], "Add by host/ip" ) );
    m_pButtonFavouritesByIP->SetPosition ( CVector2D ( 0.30f, 0.93f ), true );
    m_pButtonFavouritesByIP->SetSize ( CVector2D ( 0.25f, 0.04f ), true );
    m_pButtonFavouritesByIP->SetClickHandler ( GUI_CALLBACK ( &CServerBrowser::OnFavouritesByIPClick, this ) );

    // Create the "Add to favourites by IP" dialog
    m_pFavouritesAddByIP.SetCallback ( GUI_CALLBACK ( &CServerBrowser::OnFavouritesByIPAddClick, this ) );

    // Login dialog
    m_pCommunityLogin.SetVisible ( false );
    m_pCommunityLogin.SetCallback ( &CServerBrowser::CompleteConnect );
}
示例#6
0
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 ) );
}
示例#7
0
CQuickConnect::CQuickConnect ( void )
{
    CGUI *pManager = g_pCore->GetGUI ();

    // Create the window
    m_pWindow = reinterpret_cast < CGUIWindow* > ( pManager->CreateWnd ( NULL, "Quick Connect" ) );
    m_pWindow->SetCloseButtonEnabled ( false );
    //m_pWindow->SetMovable ( false );

    CVector2D resolution = CCore::GetSingleton().GetGUI()->GetResolution();
    m_pWindow->SetPosition ( CVector2D ( resolution.fX / 2 - 280.0f / 2, resolution.fY / 2 - 120.0f / 2  ), false );

   // m_pWindow->SetPosition ( CVector2D ( 0.35f, 0.375f ), true );
    m_pWindow->SetSize ( CVector2D ( 280.0f, 120.0f ) );
    m_pWindow->SetSizingEnabled ( false );
	m_pWindow->SetAlwaysOnTop ( true );

    // Create the controls
    //  Host label
    m_pLabelHost = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( m_pWindow, "Host:" ) );
    m_pLabelHost->SetPosition ( CVector2D ( 0.028f, 0.25f ), true );
    m_pLabelHost->AutoSize ( "Host:" );

    //  Host edit
    m_pEditHost = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( m_pWindow ) );
    m_pEditHost->SetPosition ( CVector2D ( 0.17f, 0.2f ), true );
    m_pEditHost->SetSize ( CVector2D ( 154.0f, 24.0f ) );
    m_pEditHost->SetMaxLength ( 128 );          // Just to prevent entering a huge hostname size.. no-one has a hostname over 128 chars i believe
    m_pEditHost->SetTextAcceptedHandler( GUI_CALLBACK( &CQuickConnect::OnConnectButtonClick, this ) );

    //  Port label
    m_pLabelPort = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( m_pWindow, ":" ) );
    m_pLabelPort->SetPosition ( CVector2D ( 0.725f, 0.25f ) );
    m_pLabelPort->AutoSize ( ":" );

    //  Port edit
    m_pEditPort = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( m_pWindow ) );
    m_pEditPort->SetPosition ( CVector2D ( 0.75f, 0.2f ), true );
    m_pEditPort->SetSize ( CVector2D ( 59.0f, 24.0f ) );
    m_pEditPort->SetMaxLength ( 5 );
    m_pEditPort->SetTextAcceptedHandler( GUI_CALLBACK( &CQuickConnect::OnConnectButtonClick, this ) );

    //  Pass label
    m_pLabelPass = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( m_pWindow, "Pass:"******"Pass:"******"Connect" ) );
    m_pButtonConnect->SetPosition ( CVector2D ( 0.04f, 0.71f ), true );
    m_pButtonConnect->SetSize ( CVector2D ( 112.0f, 24.0f ) );

    //  Cancel button
    m_pButtonBack = reinterpret_cast < CGUIButton* > ( pManager->CreateButton ( m_pWindow, "Back" ) );
    m_pButtonBack->SetPosition ( CVector2D ( 0.56f, 0.71f ), true );
    m_pButtonBack->SetSize ( CVector2D ( 112.0f, 24.0f ) );

    // Set up event handlers
    m_pButtonConnect->SetClickHandler ( GUI_CALLBACK ( &CQuickConnect::OnConnectButtonClick, this ) );
    m_pButtonBack->SetClickHandler ( GUI_CALLBACK ( &CQuickConnect::OnBackButtonClick, this ) );
}
示例#8
0
void CCommunityRegistration::CreateWindows ( void )
{
    CGUI *pManager = g_pCore->GetGUI ();
    CMainMenu *pMainMenu = CLocalGUI::GetSingleton ().GetMainMenu ();

    // Create the window
    m_pWindow = reinterpret_cast < CGUIWindow* > ( pManager->CreateWnd ( NULL, "Community Registration" ) );
    m_pWindow->SetCloseButtonEnabled ( false );

    CVector2D resolution = CCore::GetSingleton().GetGUI()->GetResolution();
    m_pWindow->SetPosition ( CVector2D ( resolution.fX / 2 - 300.0f / 2, resolution.fY / 2 - 300.0f / 2  ), false );
    m_pWindow->SetSize ( CVector2D ( 300.0f, 300.0f ), false );
    m_pWindow->SetSizingEnabled ( false );
    m_pWindow->SetAlwaysOnTop ( true );

    m_pLabelUsername = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( m_pWindow, "Username:"******"Username:"******"Email:" ) );
    m_pLabelEmail->SetPosition ( CVector2D ( 15.0f, 85.0f ), false );
    m_pLabelEmail->AutoSize ( "Email:" );

    m_pLabelPassword = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( m_pWindow, "Password:"******"Password:"******"Confirm:" ) );
    m_pLabelConfirm->SetPosition ( CVector2D ( 15.0f, 145.0f ), false );
    m_pLabelConfirm->AutoSize ( "Confirm:" );

    m_pLabelCode = reinterpret_cast < CGUILabel* > ( pManager->CreateLabel ( m_pWindow, "Validation code:" ) );
    m_pLabelCode->SetPosition ( CVector2D ( 15.0f, 180.0f ), false );
    m_pLabelCode->AutoSize ( "Validation code:" );

    m_pEditUsername = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( m_pWindow ) );
    m_pEditUsername->SetPosition ( CVector2D ( 90.0f, 59.0f ), false );
    m_pEditUsername->SetSize ( CVector2D ( 180.0f, 22.0f ), false );
    m_pEditUsername->SetMaxLength ( 32 );

    m_pEditEmail = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( m_pWindow ) );
    m_pEditEmail->SetPosition ( CVector2D ( 90.0f, 84.0f ), false );
    m_pEditEmail->SetSize ( CVector2D ( 180.0f, 22.0f ), false );

    m_pEditPassword = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( m_pWindow ) );
    m_pEditPassword->SetPosition ( CVector2D ( 90.0f, 119.0f ), false );
    m_pEditPassword->SetSize ( CVector2D ( 180.0f, 22.0f ), false );
    m_pEditPassword->SetMasked ( true );
    m_pEditPassword->SetMaxLength ( 32 );

    m_pEditConfirm = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( m_pWindow ) );
    m_pEditConfirm->SetPosition ( CVector2D ( 90.0f, 144.0f ), false );
    m_pEditConfirm->SetSize ( CVector2D ( 180.0f, 22.0f ), false );
    m_pEditConfirm->SetMasked ( true );
    m_pEditConfirm->SetMaxLength ( 32 );

    m_pEditCode = reinterpret_cast < CGUIEdit* > ( pManager->CreateEdit ( m_pWindow ) );
    m_pEditCode->SetPosition ( CVector2D ( 110.0f, 179.0f ), false );
    m_pEditCode->SetSize ( CVector2D ( 85.0f, 22.0f ), false );
    m_pEditCode->SetMaxLength ( 6 );

    m_pImageCode = reinterpret_cast < CGUIStaticImage* > ( pManager->CreateStaticImage ( m_pWindow ) );
    m_pImageCode->SetFrameEnabled ( false );
    m_pImageCode->SetPosition ( CVector2D ( 205.0f, 180.0f ), false );

    m_pButtonRegister = reinterpret_cast < CGUIButton* > ( pManager->CreateButton ( m_pWindow, "Register" ) );
    m_pButtonRegister->SetPosition ( CVector2D ( 100.0f, 270.0f ), false );
    m_pButtonRegister->SetSize ( CVector2D ( 90.0f, 20.0f ), false );
    m_pButtonRegister->SetZOrderingEnabled ( false );

    m_pButtonCancel = reinterpret_cast < CGUIButton* > ( pManager->CreateButton ( m_pWindow, "Cancel" ) );
    m_pButtonCancel->SetPosition ( CVector2D ( 200.0f, 270.0f ), false );
    m_pButtonCancel->SetSize ( CVector2D ( 70.0f, 20.0f ), false );
    m_pButtonRegister->SetZOrderingEnabled ( false );

    m_pButtonRegister->SetClickHandler ( GUI_CALLBACK ( &CCommunityRegistration::OnButtonRegisterClick, this ) );
    m_pButtonCancel->SetClickHandler ( GUI_CALLBACK ( &CCommunityRegistration::OnButtonCancelClick, this ) );

    m_pWindow->SetAlpha ( 0.9f );
}