[SDK] In-game popup?

Déja

Beyond the Mod
Joined
Dec 19, 2005
Messages
353
Is there any handy way to spawn a popup from the SDK? I would like to report any errors with my mod in-game, but I was curious if there was already a handy built-in method of spawning a popup box via SDK before I undertake to write one myself.
 
I know it can be done in python, but I'm specifically looking for a way to easily accomplish this from the SDK side.
 
The popup itself must be defined in python (size, title etc).

After you have done that, you can use the following code:
Code:
CvPopupInfo *pInfo;
pInfo = new CvPopupInfo((BUTTONPOPUP_PYTHON_SCREEN));
pInfo->setText(L"nameOfYourPythonPopup");
// you can give some aditional information to pInfo here and read them in your python screen. Take a look at CvPopupInfo
gDLL->getInterfaceIFace()->addPopup(pInfo, GET_PLAYER(getActivePlayer()).getID(), true, true);

Matze
 
For really simple popups (one that doesn't do anything but display a message, and doesn't care about input or anything), you can do this:

Code:
CvPopupInfo* pInfo = new CvPopupInfo();
if (NULL != pInfo)
{
	pInfo->setText(YOUR_TEXT_HERE);
	gDLL->getInterfaceIFace()->addPopup(pInfo, NO_PLAYER, true);
}

Anything more complex will probably require you to create a python popup, or create a new (or use an old, perhaps) popup type. See one of the ButtonPopupTypes in CvEnums.h and see how they do it.
 
Gerikes, keep this up and you'll get special mention in the credits :D MatzeHH, great info. Thanks.
 
Hehe, I have a text file on my desktop called GerikesWisdom.txt and everytime he puts a little nugget of info up in a thread I cut/paste it to that file for later referense. :)
 
Back
Top Bottom