Esempio n. 1
0
void CMessageSession::CreateDlgMessage (IAnimatron **retpDlg)

//	CreateDlgMessage
//
//	Creates the message dialog box

	{
	const CVisualPalette &VI = m_HI.GetVisuals();
	const CG16bitFont &MediumFont = VI.GetFont(fontMedium);

	//	Figure out where the login dialog box will appear

	RECT rcCenter;
	VI.GetWidescreenRect(m_HI.GetScreen(), &rcCenter);

	RECT rcDlg = rcCenter;
	int cyDlg = 10 * VI.GetFont(fontLarge).GetHeight();
	rcDlg.top = rcCenter.top + (RectHeight(rcCenter) - cyDlg) / 2;
	rcDlg.left = rcCenter.left + (RectWidth(rcCenter) - DLG_WIDTH) / 2;
	rcDlg.right = rcDlg.left + DLG_WIDTH;
	rcDlg.bottom = rcDlg.top + cyDlg;

	//	Create the dialog box and a container for the controls

	IAnimatron *pDlg;
	CAniSequencer *pContainer;
	VI.CreateStdDialog(rcDlg, m_sTitle, &pDlg, &pContainer);

	int y = 0;

	//	Add the message

	IAnimatron *pMessage = new CAniText;
	pMessage->SetPropertyVector(PROP_POSITION, CVector(0, y));
	pMessage->SetPropertyVector(PROP_SCALE, CVector(RectWidth(rcDlg), RectHeight(rcDlg)));
	pMessage->SetPropertyColor(PROP_COLOR, VI.GetColor(colorTextDialogInput));
	pMessage->SetPropertyFont(PROP_FONT, &MediumFont);
	pMessage->SetPropertyString(PROP_TEXT, m_sMessage);

	pContainer->AddTrack(pMessage, 0);

	//	Add close button at the bottom

	IAnimatron *pButton;
	int xButtons = (RectWidth(rcDlg) - DEFAULT_BUTTON_WIDTH) / 2;
	int yButtons = RectHeight(rcDlg) - DEFAULT_BUTTON_HEIGHT;
	VI.CreateButton(pContainer, CMD_CLOSE, xButtons, yButtons, DEFAULT_BUTTON_WIDTH, DEFAULT_BUTTON_HEIGHT, CVisualPalette::OPTION_BUTTON_DEFAULT, CONSTLIT("OK"), &pButton);
	RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_CLOSE);

	//	Done

	*retpDlg = pDlg;
	}
Esempio n. 2
0
void CLoadGameSession::CmdReadComplete (CListSaveFilesTask *pTask)

//	CmdReadComplete
//
//	We've finished loading the list of games

	{
	const CVisualPalette &VI = m_HI.GetVisuals();
	RECT rcRect;
	VI.GetWidescreenRect(m_HI.GetScreen(), &rcRect);

	//	Done with wait animation

	StopPerformance(ID_CTRL_WAIT);

	//	Check for error

	CString sError;
	if (pTask->GetResult(&sError) != NOERROR)
		{
		IAnimatron *pMsg;
		VI.CreateMessagePane(NULL, ID_MESSAGE, ERR_TITLE, strPatternSubst(ERR_DESC, sError), rcRect, 0, &pMsg);

		StartPerformance(pMsg, ID_MESSAGE, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
		return;
		}

	//	If we have no entries, then show a message

	IAnimatron *pList = pTask->GetListHandoff();
	if (pList->GetPropertyInteger(PROP_COUNT) == 0)
		{
		delete pList;

		IAnimatron *pMsg;
		VI.CreateMessagePane(NULL, ID_MESSAGE, ERR_NO_ENTRIES, ERR_NO_ENTRIES_DESC, rcRect, 0, &pMsg);

		StartPerformance(pMsg, ID_MESSAGE, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
		return;
		}

	//	Show the profile

	RECT rcList;
	pList->GetSpacingRect(&rcList);

	pList->SetPropertyVector(PROP_POSITION, CVector(rcRect.left + (RectWidth(rcRect) - RectWidth(rcList)) / 2, rcRect.top));
	pList->SetPropertyVector(PROP_SCALE, CVector(SAVE_ENTRY_WIDTH, RectHeight(rcRect)));
	pList->SetPropertyMetric(PROP_VIEWPORT_HEIGHT, (Metric)RectHeight(rcRect));
	RegisterPerformanceEvent(pList, EVENT_ON_DOUBLE_CLICK, CMD_OK_SESSION);

	StartPerformance(pList, ID_LIST, CReanimator::SPR_FLAG_DELETE_WHEN_DONE);
	}
Esempio n. 3
0
void CNewGameSession::CreatePlayerName (const CString &sName, int x, int y, int cxWidth)

//	CreatePlayerName
//
//	Creates the player name UI section

	{
	const CVisualPalette &VI = m_HI.GetVisuals();
	const CG16bitFont &MediumBoldFont = VI.GetFont(fontMediumBold);
	const CG16bitFont &SubTitleFont = VI.GetFont(fontSubTitle);

	//	Label

	IAnimatron *pLabel = new CAniText;
	pLabel->SetPropertyVector(PROP_POSITION, CVector(x + SMALL_BUTTON_WIDTH + MAJOR_PADDING_HORZ, y));
	pLabel->SetPropertyVector(PROP_SCALE, CVector(cxWidth, 100.0));
	pLabel->SetPropertyColor(PROP_COLOR, VI.GetColor(colorTextDialogInput));
	pLabel->SetPropertyFont(PROP_FONT, &MediumBoldFont);
	pLabel->SetPropertyString(PROP_TEXT, CONSTLIT("name"));

	m_pRoot->AddLine(pLabel);

	//	Create a button

	IAnimatron *pButton;
	VI.CreateImageButtonSmall(NULL, 
			CMD_EDIT_NAME, 
			x, 
			y,
			&VI.GetImage(imageSmallEditIcon),
			0,
			&pButton);

	pButton->SetID(CMD_EDIT_NAME);

	RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_EDIT_NAME);
	m_pRoot->AddLine(pButton);

	//	Player name

	SetPlayerName(sName, x, y, cxWidth);
	}
Esempio n. 4
0
void CNewGameSession::CreatePlayerGenome (GenomeTypes iGenome, int x, int y, int cxWidth)

//	CreatePlayerGenome
//
//	Creates the player genome UI section

	{
	const CVisualPalette &VI = m_HI.GetVisuals();
	const CG16bitFont &MediumBoldFont = VI.GetFont(fontMediumBold);

	//	Label

	IAnimatron *pLabel = new CAniText;
	pLabel->SetPropertyVector(PROP_POSITION, CVector(x, y));
	pLabel->SetPropertyVector(PROP_SCALE, CVector(cxWidth - SMALL_BUTTON_WIDTH - MAJOR_PADDING_HORZ, 100.0));
	pLabel->SetPropertyColor(PROP_COLOR, VI.GetColor(colorTextDialogInput));
	pLabel->SetPropertyFont(PROP_FONT, &MediumBoldFont);
	pLabel->SetPropertyString(PROP_TEXT, CONSTLIT("genome"));
	pLabel->SetPropertyString(PROP_TEXT_ALIGN_HORZ, ALIGN_RIGHT);

	m_pRoot->AddLine(pLabel);

	//	Create a button

	IAnimatron *pButton;
	VI.CreateImageButtonSmall(NULL, 
			CMD_CHANGE_GENOME, 
			x + cxWidth - SMALL_BUTTON_WIDTH, 
			y,
			&VI.GetImage(imageSmallHumanMale),
			0,
			&pButton);

	pButton->SetID(CMD_CHANGE_GENOME);

	RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_CHANGE_GENOME);
	m_pRoot->AddLine(pButton);

	//	Player genome

	SetPlayerGenome(iGenome, x, y, cxWidth);
	}
void CChangePasswordSession::CreateDlg (IAnimatron **retpDlg)

//	CreateDlg
//
//	Creates the dialog box

	{
	const CVisualPalette &VI = m_HI.GetVisuals();
	const CG16bitFont &MediumFont = VI.GetFont(fontMedium);

	//	Figure out where the login dialog box will appear

	RECT rcCenter;
	VI.GetWidescreenRect(m_HI.GetScreen(), &rcCenter);

	RECT rcDlg = rcCenter;
	int cyDlg = 15 * VI.GetFont(fontLarge).GetHeight();
	rcDlg.top = rcCenter.top + (RectHeight(rcCenter) - cyDlg) / 2;
	rcDlg.left = rcCenter.left + (RectWidth(rcCenter) - DLG_WIDTH) / 2;
	rcDlg.right = rcDlg.left + DLG_WIDTH;
	rcDlg.bottom = rcDlg.top + cyDlg;

	//	Create the dialog box and a container for the controls

	IAnimatron *pDlg;
	CAniSequencer *pContainer;
	VI.CreateStdDialog(rcDlg, CONSTLIT("Change Password"), &pDlg, &pContainer);

	int y = 0;

	//	Add a password field

	int cyHeight;
	VI.CreateEditControl(pContainer, ID_CTRL_PASSWORD, 0, y, RectWidth(rcDlg), CVisualPalette::OPTION_EDIT_PASSWORD, CONSTLIT("Old password:"******"New password:"******"Confirm password:"******"Change"), &pButton);
	RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_OK);

	//	Add the cancel button

	int x = xButtons + DLG_SPACING_X + DEFAULT_BUTTON_WIDTH;
	VI.CreateButton(pContainer, ID_CTRL_CANCEL_ACTION, x, yButtons, DEFAULT_BUTTON_WIDTH, DEFAULT_BUTTON_HEIGHT, 0, CONSTLIT("Cancel"), &pButton);
	RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_CANCEL);

	//	Figure out where to show an error message

	m_rcInputError.left = rcDlg.left + xButtons - metricsInputErrorMsgMarginHorz - metricsInputErrorMsgWidth;
	m_rcInputError.top = rcDlg.top + yButtons;
	m_rcInputError.right = m_rcInputError.left + metricsInputErrorMsgWidth;
	m_rcInputError.bottom = m_rcInputError.top + metricsInputErrorMsgHeight;

	//	Done

	*retpDlg = pDlg;
	}
void CLoginSession::CreateDlgSignIn (const CVisualPalette &VI, IAnimatron **retpAni)

//	CreateDlgSingIn
//
//	Creates a message dialog box

	{
	//	Figure out where the login dialog box will appear

	RECT rcCenter;
	RECT rcFull;
	VI.GetWidescreenRect(m_HI.GetScreen(), &rcCenter, &rcFull);

	RECT rcDlg = rcCenter;
	int cyDlg = 18 * VI.GetFont(fontLarge).GetHeight();
	rcDlg.top = rcCenter.top + (RectHeight(rcCenter) - cyDlg) / 2;
	rcDlg.left = rcCenter.left + (RectWidth(rcCenter) - DLG_WIDTH) / 2;
	rcDlg.right = rcDlg.left + DLG_WIDTH;
	rcDlg.bottom = rcDlg.top + cyDlg;

	//	Create the dialog box and a container for the controls

	IAnimatron *pDlg;
	CAniSequencer *pContainer;
	VI.CreateStdDialog(rcDlg, STR_SIGN_IN_TITLE, &pDlg, &pContainer);

	int y = 0;

	//	Add a username field

	int cyHeight;
	IAnimatron *pControl;
	VI.CreateEditControl(pContainer, ID_CTRL_USERNAME, 0, y, RectWidth(rcDlg), 0, CONSTLIT("Username:"******"Password:"******"Sign in automatically"), &pControl, &cyHeight);
	y += cyHeight + DLG_SPACING_Y;
	if (m_Service.HasCapability(ICIService::autoLoginUser))
		pControl->SetPropertyBool(PROP_CHECKED, true);

	//	Some extra space

	y += DLG_SPACING_Y;

	//	Register a new account

	IAnimatron *pButton;
	VI.CreateLink(pContainer, ID_CTRL_REGISTER, 0, y, CONSTLIT("Register a new account"), 0, &pButton, NULL, &cyHeight);
	y += cyHeight;
	RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_SWITCH_TO_REGISTER);

	//	Forgot password

	VI.CreateLink(pContainer, ID_CTRL_PASSWORD_RESET, 0, y, CONSTLIT("Forgot my password"), 0, &pButton, NULL, &cyHeight);
	y += cyHeight + DLG_SPACING_Y;
	RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_PASSWORD_RESET);

	//	Add sign in button at the bottom

	int xButtons = (RectWidth(rcDlg) - (2 * DEFAULT_BUTTON_WIDTH + DLG_SPACING_X)) / 2;
	int yButtons = RectHeight(rcDlg) - DEFAULT_BUTTON_HEIGHT;
	VI.CreateButton(pContainer, ID_CTRL_MAIN_ACTION, xButtons, yButtons, DEFAULT_BUTTON_WIDTH, DEFAULT_BUTTON_HEIGHT, CVisualPalette::OPTION_BUTTON_DEFAULT, CONSTLIT("Sign In"), &pButton);
	RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_SIGN_IN);

	//	Add the cancel button

	int x = xButtons + DLG_SPACING_X + DEFAULT_BUTTON_WIDTH;
	VI.CreateButton(pContainer, ID_CTRL_CANCEL_ACTION, x, yButtons, DEFAULT_BUTTON_WIDTH, DEFAULT_BUTTON_HEIGHT, 0, CONSTLIT("Cancel"), &pButton);
	RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_CANCEL);

	//	Error messages are to the left of the button

	m_rcInputError.left = rcDlg.left + xButtons - metricsInputErrorMsgMarginHorz - metricsInputErrorMsgWidth;
	m_rcInputError.top = rcDlg.top + yButtons;
	m_rcInputError.right = m_rcInputError.left + metricsInputErrorMsgWidth;
	m_rcInputError.bottom = m_rcInputError.top + metricsInputErrorMsgHeight;

	//	Done

	*retpAni = pDlg;
	}
void CLoginSession::CreateDlgRegister (const CVisualPalette &VI, IAnimatron **retpAni)

//	CreateDlgRegister
//
//	Creates a dialog box

	{
	//	Figure out where the login dialog box will appear

	RECT rcCenter;
	RECT rcFull;
	VI.GetWidescreenRect(m_HI.GetScreen(), &rcCenter, &rcFull);

	RECT rcDlg = rcCenter;
	int cyDlg = 22 * VI.GetFont(fontLarge).GetHeight();
	rcDlg.top = rcCenter.top + (RectHeight(rcCenter) - cyDlg) / 2;
	rcDlg.left = rcCenter.left + (RectWidth(rcCenter) - DLG_WIDTH) / 2;
	rcDlg.right = rcDlg.left + DLG_WIDTH;
	rcDlg.bottom = rcDlg.top + cyDlg;

	//	Create the dialog box and a container for the controls

	IAnimatron *pDlg;
	CAniSequencer *pContainer;
	VI.CreateStdDialog(rcDlg, STR_REGISTER_TITLE, &pDlg, &pContainer);

	int y = 0;

	//	Add a username field

	int cyHeight;
	VI.CreateEditControl(pContainer, ID_CTRL_USERNAME, 0, y, RectWidth(rcDlg), 0, CONSTLIT("Username:"******"Password:"******"Confirm password:"******"Email:"), NULL, &cyHeight);
	y += cyHeight + DLG_SPACING_Y;

	//	Auto sign in checkbox

	IAnimatron *pControl;
	VI.CreateCheckbox(pContainer, ID_CTRL_AUTO_SIGN_IN, 0, y, RectWidth(rcDlg), 0, CONSTLIT("Sign in automatically"), &pControl, &cyHeight);
	y += cyHeight + DLG_SPACING_Y;

	//	Some extra space

	y += DLG_SPACING_Y;

	//	Register a new account

	IAnimatron *pButton;
	VI.CreateLink(pContainer, CMD_SWITCH_TO_LOGIN, 0, y, CONSTLIT("I already have an account"), 0, &pButton, NULL, &cyHeight);
	y += cyHeight;
	RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_SWITCH_TO_LOGIN);

	//	Terms of service

	VI.CreateLink(pContainer, CMD_TOS, 0, y, CONSTLIT("Terms of Service"), 0, &pButton, NULL, &cyHeight);
	y += cyHeight + DLG_SPACING_Y;
	RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_TOS);

	//	Add register button at the bottom

	int xButtons = (RectWidth(rcDlg) - (2 * DEFAULT_BUTTON_WIDTH + DLG_SPACING_X)) / 2;
	int yButtons = RectHeight(rcDlg) - DEFAULT_BUTTON_HEIGHT;
	VI.CreateButton(pContainer, ID_CTRL_MAIN_ACTION, xButtons, yButtons, DEFAULT_BUTTON_WIDTH, DEFAULT_BUTTON_HEIGHT, CVisualPalette::OPTION_BUTTON_DEFAULT, CONSTLIT("Register"), &pButton);
	RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_REGISTER);

	//	Add the cancel button

	int x = xButtons + DLG_SPACING_X + DEFAULT_BUTTON_WIDTH;
	VI.CreateButton(pContainer, ID_CTRL_CANCEL_ACTION, x, yButtons, DEFAULT_BUTTON_WIDTH, DEFAULT_BUTTON_HEIGHT, 0, CONSTLIT("Cancel"), &pButton);
	RegisterPerformanceEvent(pButton, EVENT_ON_CLICK, CMD_CANCEL);

	//	Error messages are to the left of the button

	m_rcInputError.left = rcDlg.left + xButtons - metricsInputErrorMsgMarginHorz - metricsInputErrorMsgWidth;
	m_rcInputError.top = rcDlg.top + yButtons;
	m_rcInputError.right = m_rcInputError.left + metricsInputErrorMsgWidth;
	m_rcInputError.bottom = m_rcInputError.top + metricsInputErrorMsgHeight;

	//	Done

	*retpAni = pDlg;
	}
Esempio n. 8
0
void CNewGameSession::CreateShipClass (CShipClass *pClass, int x, int y, int cxWidth)

//	CreateShipClass
//
//	Creates the ship class selection elements

	{
	const CVisualPalette &VI = m_HI.GetVisuals();
	const CG16bitFont &MediumBoldFont = VI.GetFont(fontMediumBold);
	const CG16bitFont &SubTitleFont = VI.GetFont(fontSubTitle);

	//	Create buttons to select the class

	int xCenter = (x + cxWidth / 2);
	int xHalfSpacing = SMALL_SPACING_HORZ / 2;

	IAnimatron *pLeftButton;
	VI.CreateImageButtonSmall(NULL, 
			CMD_PREV_SHIP_CLASS, 
			xCenter - xHalfSpacing - SMALL_BUTTON_WIDTH, 
			y,
			&VI.GetImage(imageSmallLeftIcon),
			0,
			&pLeftButton);

	if (m_iCurShipClass == 0)
		pLeftButton->SetPropertyBool(PROP_ENABLED, false);

	RegisterPerformanceEvent(pLeftButton, EVENT_ON_CLICK, CMD_PREV_SHIP_CLASS);
	m_pRoot->AddLine(pLeftButton);

	IAnimatron *pRightButton;
	VI.CreateImageButtonSmall(NULL, 
			CMD_NEXT_SHIP_CLASS, 
			xCenter + xHalfSpacing, 
			y,
			&VI.GetImage(imageSmallRightIcon),
			0,
			&pRightButton);

	if (m_iCurShipClass + 1 == m_ShipClasses.GetCount())
		pRightButton->SetPropertyBool(PROP_ENABLED, false);

	RegisterPerformanceEvent(pRightButton, EVENT_ON_CLICK, CMD_NEXT_SHIP_CLASS);
	m_pRoot->AddLine(pRightButton);

	//	Label

	IAnimatron *pLabel = new CAniText;
	pLabel->SetPropertyVector(PROP_POSITION, CVector(x, y + SMALL_BUTTON_HEIGHT + SMALL_SPACING_VERT));
	pLabel->SetPropertyVector(PROP_SCALE, CVector(cxWidth, 100.0));
	pLabel->SetPropertyColor(PROP_COLOR, VI.GetColor(colorTextDialogInput));
	pLabel->SetPropertyFont(PROP_FONT, &MediumBoldFont);
	pLabel->SetPropertyString(PROP_TEXT, CONSTLIT("ship class"));
	pLabel->SetPropertyString(PROP_TEXT_ALIGN_HORZ, ALIGN_CENTER);

	m_pRoot->AddLine(pLabel);

	//	Ship class

	SetShipClass(pClass, x, y, cxWidth);
	}