Exemple #1
0
bool GuiConfig::HandleConfigOK(const CEGUI::EventArgs& e)
{
	Editbox* playerName = static_cast<Editbox*>(winMgr.getWindow("CONFIGPLAYERNAME"));
/*
	if (_stricmp(GConfig->GetPlayerName(), playerName->getText().c_str()))
	{
		if (GClientGame)
		{
			GClientGame->SendMessageNick(playerName->getText().c_str());
		}

	}
	*/
	bool bScreenConfigHasChanged = false;

	{
		Checkbox *pcb = (Checkbox*)winMgr.getWindow("CHKBFS");
		bScreenConfigHasChanged |= GConfig->IsEnable("CHKBFS") != pcb->isSelected();
		GConfig->SetEnable("CHKBFS", (int)pcb->isSelected() );
	}
	{
		Checkbox *pcb = (Checkbox*)winMgr.getWindow("CHKBVSYNC");
		bScreenConfigHasChanged |= GConfig->IsEnable("CHKBVSYNC") != pcb->isSelected();
		GConfig->SetEnable("CHKBVSYNC", (int)pcb->isSelected() );
	}


	GConfig->SetPlayerName(playerName->getText().c_str());


	// Resolution
	Combobox* resCB = static_cast<Combobox*>(winMgr.getWindow("RESOLUTION"));
	ListboxItem *resib = resCB->getSelectedItem();
	if (resib)
	{
		int selres = resCB->getItemIndex(resib);

		bScreenConfigHasChanged |= (GConfig->GetQuality("Width") != mResolutions[selres].width);
		bScreenConfigHasChanged |= (GConfig->GetQuality("Height") != mResolutions[selres].height);

		GConfig->SetQuality("Width", mResolutions[selres].width);
		GConfig->SetQuality("Height", mResolutions[selres].height);
	}


	if (bScreenConfigHasChanged)
	{
		tstring onoksschanged = ".00 ";
		onoksschanged += GLoc->GetString("OK");
		((ZProtoGUI*)GProtoGui)->mMessageboxGui.Show(GLoc->GetString("SCREENCHANGED"), onoksschanged.c_str(), mOnOK);

		Hide();
	}
	else
	{
		mOnOK();
		Hide();
	}
	return true;
}
Exemple #2
0
bool GuiConfig::handleChkMusicChanged(const CEGUI::EventArgs& e)
{
	Checkbox *pcb = (Checkbox*)winMgr.getWindow("CHKMUSIC");
	GConfig->SetEnable("CHKMUSIC", (int)pcb->isSelected() );
	return true;
}