コード例 #1
0
ファイル: GameForm.cpp プロジェクト: muffinista/palm-pitch
void CGameForm::InitScreen() {

	UInt16 player_names[] = {MainP0NameField, 
							MainP1NameField,
							MainP2NameField,
							MainP3NameField};

	if ( gManager->CutThroat() == true ) {
		player_names[2] = player_names[3];
	}


	for ( Int16 i = 0; i < gManager->numPlayers; i++ ) {
		names[i].Attach(this, player_names[i]);
		names[i].Replace((const char *)gManager->players[i]->getName() );		

		if ( gManager->CutThroat() == true ) {

			CString foo;
			foo.Format("%d pts", gManager->scores[i]);

			if ( i == 1 || i == 2 ) {
				CField tmpscore;

				if ( i == 1 ) {
					tmpscore.Attach(this, MainP1ScoreField);
				}
				else {
					tmpscore.Attach(this, MainP3ScoreField);
				}
				
				tmpscore.Replace(foo);
			}
			else {
				CString tmp = gManager->players[i]->getName() + ": " + foo;
				names[i].Replace( tmp );
			}

		}

	}
	
	bidder_name.Attach(this, MainBidderField);
	bidder_name.Replace( (const char *)(*gManager->tbl->winning_bidder)->getName() );

	if ( gManager->CutThroat() == false ) {

		ns_score.Attach(this, MainNSScoreField);
		ew_score.Attach(this, MainEWScoreField);

		char score0str[4];
		char score1str[4];

		StrPrintF(score0str, "%d", gManager->scores[0] );
		StrPrintF(score1str, "%d", gManager->scores[1] );

		ns_score.Replace( score0str );
		ew_score.Replace( score1str );
	}
	else {

		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), NSScoreLabel ) );
		FrmHideObject( FrmGetActiveForm(), FrmGetObjectIndex( FrmGetActiveForm(), EWScoreLabel ) );
	}


	played_cards.Attach(this, MainPlayedCardsGadget );
	played_cards.CurrentTrick(gManager->trk);

	player_hand.Attach(this, MainPlayerHandGadget );
	player_hand.CurrentTrick(gManager->trk);
	player_hand.CurrentPlayer(gManager->players[gManager->humanIndex]);

}