Exemplo n.º 1
0
CQuickConnect::CQuickConnect(void)
{
        assert(!m_pSingleton);

        // Set our singleton
        m_pSingleton = this;

        // Set up the GUI
        CGUI * pGUI = g_pClient->GetGUI();

        float fWidth = (float)pGUI->GetDisplayWidth();
        float fHeight = (float)pGUI->GetDisplayHeight();

        m_GUIElements.pWindow = pGUI->CreateGUIFrameWindow();
        m_GUIElements.pWindow->setText("Quick Connect");
        m_GUIElements.pWindow->setSize(CEGUI::UVector2(CEGUI::UDim(0, 300), CEGUI::UDim(0, 240)));
        m_GUIElements.pWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(0, fWidth/2-150.0f), CEGUI::UDim(0, fHeight/2-120.0f)));
        m_GUIElements.pWindow->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber(&CQuickConnect::OnCloseClick, this));
        m_GUIElements.pWindow->setProperty("FrameEnabled", "false");
        m_GUIElements.pWindow->setVisible(false);

        m_GUIElements.pIPStaticText = pGUI->CreateGUIStaticText(m_GUIElements.pWindow);
        m_GUIElements.pIPStaticText->setText("IP Address:");
        m_GUIElements.pIPStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0, 260), CEGUI::UDim(0, 20)));
        m_GUIElements.pIPStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 20), CEGUI::UDim(0, 20)));
        m_GUIElements.pIPStaticText->setProperty("FrameEnabled", "false");
        m_GUIElements.pIPStaticText->setProperty("BackgroundEnabled", "false");
        m_GUIElements.pIPStaticText->setFont(pGUI->GetFont("tahoma-bold"));

        m_GUIElements.pIPEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pWindow);
        m_GUIElements.pIPEditBox->setText(String("%s:%d", g_pClient->GetHost().Get(), g_pClient->GetPort()).Get());
        m_GUIElements.pIPEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0, 260), CEGUI::UDim(0, 30)));
        m_GUIElements.pIPEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 20), CEGUI::UDim(0, 50)));
        m_GUIElements.pIPEditBox->subscribeEvent(CEGUI::Editbox::EventKeyUp, CEGUI::Event::Subscriber(&CQuickConnect::OnIPEditBoxKeyUp, this));

        m_GUIElements.pPasswordStaticText = pGUI->CreateGUIStaticText(m_GUIElements.pWindow);
        m_GUIElements.pPasswordStaticText->setText("Password (blank for none):");
        m_GUIElements.pPasswordStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0, 260), CEGUI::UDim(0, 20)));
        m_GUIElements.pPasswordStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 20), CEGUI::UDim(0, 90)));
        m_GUIElements.pPasswordStaticText->setProperty("FrameEnabled", "false");
        m_GUIElements.pPasswordStaticText->setProperty("BackgroundEnabled", "false");
        m_GUIElements.pPasswordStaticText->setFont(pGUI->GetFont("tahoma-bold"));

        m_GUIElements.pPasswordEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pWindow);
        m_GUIElements.pPasswordEditBox->setText(g_pClient->GetPassword().Get());
        m_GUIElements.pPasswordEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0, 260), CEGUI::UDim(0, 30)));
        m_GUIElements.pPasswordEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 20), CEGUI::UDim(0, 120)));
        m_GUIElements.pPasswordEditBox->subscribeEvent(CEGUI::Editbox::EventKeyUp, CEGUI::Event::Subscriber(&CQuickConnect::OnIPEditBoxKeyUp, this));
        m_GUIElements.pPasswordEditBox->setProperty("MaskText", "true");

        m_GUIElements.pConnectButton = pGUI->CreateGUIButton(m_GUIElements.pWindow);
        m_GUIElements.pConnectButton->setText("Connect");
        m_GUIElements.pConnectButton->setSize(CEGUI::UVector2(CEGUI::UDim(0, 200), CEGUI::UDim(0, 40)));
        m_GUIElements.pConnectButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 50), CEGUI::UDim(0, 160)));
        m_GUIElements.pConnectButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CQuickConnect::OnConnectButtonClick, this));

        m_bVisible = false;
}
Exemplo n.º 2
0
// GUIText
_MEMBER_FUNCTION_IMPL(GUIText, constructor)
{
	// Get our GUI
	CGUI * pGUI = g_pClient->GetGUI();

	CEGUI::Window * pWindow = pGUI->CreateGUIStaticText();

	if(!pWindow || SQ_FAILED(sq_setinstance(pVM, pWindow)))
	{
		CLogFile::Printf("Can't create GUIText.");
		sq_pushbool(pVM, false);
		return 1;
	}

	//_SET_RELEASE_HOOK(GUIElement);
	CClientScriptManager * pClientScriptManager = g_pClient->GetClientScriptManager();
	pClientScriptManager->GetGUIManager()->Add(pWindow, pClientScriptManager->GetScriptingManager()->Get(pVM));
	pWindow->setVisible(true);
	pWindow->setProperty("FrameEnabled", "false");
	pWindow->setProperty("BackgroundEnabled", "false");
	pWindow->setFont(pGUI->GetFont("tahoma-bold"));
	pWindow->setProperty("TextColours", "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF");
	
	SubscribeGuiEvents(pWindow);

	sq_pushbool(pVM, true);
	return 1;
}
Exemplo n.º 3
0
CSettingsMenu::CSettingsMenu(void)
{
	assert(!m_pSingleton);

	// Set our singleton
	m_pSingleton = this;

	// Set up the GUI
	CGUI * pGUI = g_pClient->GetGUI();

	float fWidth = (float)pGUI->GetDisplayWidth();
	float fHeight = (float)pGUI->GetDisplayHeight();

	m_GUIElements.pWindow = pGUI->CreateGUIFrameWindow();
	m_GUIElements.pWindow->setText("Settings");
	m_GUIElements.pWindow->setSize(CEGUI::UVector2(CEGUI::UDim(0, 520), CEGUI::UDim(0, 390)));
	m_GUIElements.pWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(0, fWidth/2-260), CEGUI::UDim(0, fHeight/2-190)));
	m_GUIElements.pWindow->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked, CEGUI::Event::Subscriber(&CSettingsMenu::OnCloseClick, this));
	m_GUIElements.pWindow->setVisible(false);

	m_GUIElements.pTabControl = pGUI->CreateGUITabControl();
	m_GUIElements.pWindow->addChildWindow( m_GUIElements.pTabControl );
	m_GUIElements.pTabControl->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(0.8f, 0)));

	m_GUIElements.pGeneralPane = pGUI->CreateGUITabContentPane();
	m_GUIElements.pGeneralPane->setText("General");
	m_GUIElements.pTabControl->addChildWindow( m_GUIElements.pGeneralPane );
	m_GUIElements.pGeneralPane->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));

	m_GUIElements.pChatPane = pGUI->CreateGUITabContentPane();
	m_GUIElements.pChatPane->setText("Chat");
	m_GUIElements.pTabControl->addChildWindow( m_GUIElements.pChatPane );
	m_GUIElements.pChatPane->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));

	m_GUIElements.pNickStaticText = pGUI->CreateGUIStaticText(m_GUIElements.pGeneralPane);
	m_GUIElements.pNickStaticText->setText("Name");
	m_GUIElements.pNickStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pNickStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.2f, 0)));
	m_GUIElements.pNickStaticText->setProperty("FrameEnabled", "false");
	m_GUIElements.pNickStaticText->setProperty("BackgroundEnabled", "false");
	m_GUIElements.pNickStaticText->setFont(pGUI->GetFont("tahoma-bold"));

	m_GUIElements.pNickEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pGeneralPane);
	m_GUIElements.pNickEditBox->setText(CGUI::AnsiToCeguiFriendlyString(g_pClient->GetNick()));
	m_GUIElements.pNickEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pNickEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.3f, 0)));

	m_GUIElements.pWindowedStaticText= pGUI->CreateGUIStaticText(m_GUIElements.pGeneralPane);
	m_GUIElements.pWindowedStaticText->setText("Windowed");
	m_GUIElements.pWindowedStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pWindowedStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.5f, 0)));
	m_GUIElements.pWindowedStaticText->setProperty("FrameEnabled", "false");
	m_GUIElements.pWindowedStaticText->setProperty("BackgroundEnabled", "false");
	m_GUIElements.pWindowedStaticText->setFont(pGUI->GetFont("tahoma-bold"));

	m_GUIElements.pWindowedCheckBox = pGUI->CreateGUICheckBox(m_GUIElements.pGeneralPane);
	CEGUI::Checkbox * pCheckBox = (CEGUI::Checkbox *)m_GUIElements.pWindowedCheckBox;
	pCheckBox->setSelected(g_pClient->IsWindowedMode());
	m_GUIElements.pWindowedCheckBox->setText("");
	m_GUIElements.pWindowedCheckBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pWindowedCheckBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.15f, 0), CEGUI::UDim(0.5f, 0)));

	m_GUIElements.pFPSStaticText = pGUI->CreateGUIStaticText(m_GUIElements.pGeneralPane);
	m_GUIElements.pFPSStaticText->setText("Show FPS");
	m_GUIElements.pFPSStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pFPSStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.6f, 0)));
	m_GUIElements.pFPSStaticText->setProperty("FrameEnabled", "false");
	m_GUIElements.pFPSStaticText->setProperty("BackgroundEnabled", "false");
	m_GUIElements.pFPSStaticText->setFont(pGUI->GetFont("tahoma-bold"));

	m_GUIElements.pFPSCheckBox = pGUI->CreateGUICheckBox(m_GUIElements.pGeneralPane);
	CEGUI::Checkbox * pCheckBox2 = (CEGUI::Checkbox *)m_GUIElements.pFPSCheckBox;
	pCheckBox2->setSelected(g_pClient->GetFPSToggle());
	m_GUIElements.pFPSCheckBox->setText("");
	m_GUIElements.pFPSCheckBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pFPSCheckBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.15f, 0), CEGUI::UDim(0.6f, 0)));


	m_GUIElements.pChatFontSizeStaticText = pGUI->CreateGUIStaticText(m_GUIElements.pChatPane);
	m_GUIElements.pChatFontSizeStaticText->setText("Chatfont/Fontsize");
	m_GUIElements.pChatFontSizeStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatFontSizeStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.2f, 0)));
	m_GUIElements.pChatFontSizeStaticText->setProperty("FrameEnabled", "false");
	m_GUIElements.pChatFontSizeStaticText->setProperty("BackgroundEnabled", "false");
	m_GUIElements.pChatFontSizeStaticText->setFont(pGUI->GetFont("tahoma-bold"));

	m_GUIElements.pChatFontEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane);
	m_GUIElements.pChatFontEditBox->setText(CVAR_GET_STRING("chatfont").Get());
	m_GUIElements.pChatFontEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.4f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatFontEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.3f, 0)));

	m_GUIElements.pChatFontSizeEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane);
	m_GUIElements.pChatFontSizeEditBox->setText(CVAR_GET_EX("chatsize").Get());
	m_GUIElements.pChatFontSizeEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatFontSizeEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.65f, 0), CEGUI::UDim(0.3f, 0)));

	m_GUIElements.pChatBackgroundStaticText = pGUI->CreateGUIStaticText(m_GUIElements.pChatPane);
	m_GUIElements.pChatBackgroundStaticText->setText("Background (A,R,G,B)");
	m_GUIElements.pChatBackgroundStaticText->setSize(CEGUI::UVector2(CEGUI::UDim(0.6f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatBackgroundStaticText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.4f, 0)));
	m_GUIElements.pChatBackgroundStaticText->setProperty("FrameEnabled", "false");
	m_GUIElements.pChatBackgroundStaticText->setProperty("BackgroundEnabled", "false");
	m_GUIElements.pChatBackgroundStaticText->setFont(pGUI->GetFont("tahoma-bold"));

	m_GUIElements.pChatBGColorAEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane);
	m_GUIElements.pChatBGColorAEditBox->setText(CVAR_GET_EX("chatbga").Get());
	m_GUIElements.pChatBGColorAEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatBGColorAEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.5f, 0)));

	m_GUIElements.pChatBGColorREditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane);
	m_GUIElements.pChatBGColorREditBox->setText(CVAR_GET_EX("chatbgr").Get());
	m_GUIElements.pChatBGColorREditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatBGColorREditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.35f, 0), CEGUI::UDim(0.5f, 0)));

	m_GUIElements.pChatBGColorGEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane);
	m_GUIElements.pChatBGColorGEditBox->setText(CVAR_GET_EX("chatbgg").Get());
	m_GUIElements.pChatBGColorGEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatBGColorGEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5f, 0), CEGUI::UDim(0.5f, 0)));

	m_GUIElements.pChatBGColorBEditBox = pGUI->CreateGUIEditBox(m_GUIElements.pChatPane);
	m_GUIElements.pChatBGColorBEditBox->setText(CVAR_GET_EX("chatbgb").Get());
	m_GUIElements.pChatBGColorBEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pChatBGColorBEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.65f, 0), CEGUI::UDim(0.5f, 0)));

	m_GUIElements.pSaveButton = pGUI->CreateGUIButton(m_GUIElements.pWindow);
	m_GUIElements.pSaveButton->setText("Save");
	m_GUIElements.pSaveButton->setSize(CEGUI::UVector2(CEGUI::UDim(0.4f, 0), CEGUI::UDim(0.1f, 0)));
	m_GUIElements.pSaveButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.3f, 0), CEGUI::UDim(0.8f, 0)));
	m_GUIElements.pSaveButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CSettingsMenu::OnSaveButtonClick, this));

	m_bVisible = false;
}