Hi I'm doing an assignment for my uni course and am stuck with using sfml I have to make a game of blackjack with graphics but the graphics will not show this is the main source code that I have so far:
void Shuffle(bool baCardsDealt[]);
void PrintCard(int iCard);
void PrintHand(int iaHand[], const int kiCardCount);
int GetNextCard(bool baCardsDealt[]);
int ScoreHand(int iaHand[], const int kiCardCount);
void PrintScoresAndHands(int iaHouseHand[], const int kiHouseCardCount, int iaPlayerHand[], const int kiPlayerCardCount);
int main() {
using namespace std;
// Seed the random number generator
time_t qTime;
time(&qTime);
srand(qTime);
bool baCardsDealt[52];
int iHouseCardCount = 0;
int iaHouseHand[12];
int iPlayerCardCount = 0;
int iaPlayerHand[12];
// Loop once for each hand
while (true) {
// "Shuffle" the cards; set them all to undealt
Shuffle(baCardsDealt);
// Deal the hands. Get two cards for each
iaPlayerHand[0] = GetNextCard(baCardsDealt);
iaHouseHand[0] = GetNextCard(baCardsDealt);
iaPlayerHand[1] = GetNextCard(baCardsDealt);
iaHouseHand[1] = GetNextCard(baCardsDealt);
iHouseCardCount = 2;
iPlayerCardCount = 2;
// Signal a new hand.
cout << "--------------------------------------------------------" << endl;
cout << "-----------------------New Hand-------------------------" << endl;
cout << "--------------------------------------------------------" << endl;
// Get Player's hits. Calculate the score and redisplay after each hit.
do {
// Print the dealt cards, but only the House's second card.
cout << "House's Hand" << endl;
cout << "** ";
PrintCard(iaHouseHand[1]);
cout << endl;
cout << "Player's Hand: Score = " << ScoreHand(iaPlayerHand, iPlayerCardCount) << endl;
PrintHand(iaPlayerHand, iPlayerCardCount);
// Ask the Player whether he wants a hit or to stay
cout << "Twist(t) or stick(s): ";
cin >> cPlayerChoice;
if (cPlayerChoice == 't') {
iaPlayerHand[iPlayerCardCount] = GetNextCard(baCardsDealt);
++iPlayerCardCount;
} else if (cPlayerChoice == 's') {
bPlayerHits = false;
} else {
cout << "Error: Try Again!" << endl;
}
cout << endl;
// Get the Player's current score to update and check for bust.
iPlayerScore = ScoreHand(iaPlayerHand, iPlayerCardCount);
} while (bPlayerHits && iPlayerScore < 22);
// Once the player is done taking hits, check whether he busted
if (iPlayerScore > 21) {
// The Player busted. The House wins.
cout << "**** The House Wins!!! ****" << endl;
PrintScoresAndHands(iaHouseHand, iHouseCardCount, iaPlayerHand, iPlayerCardCount);
} else {
// If the player didn't bust, then the house takes hits below 17
int iHouseScore = ScoreHand(iaHouseHand, iHouseCardCount);
while (iHouseScore < 17) {
iaHouseHand[iHouseCardCount] = GetNextCard(baCardsDealt);
++iHouseCardCount;
iHouseScore = ScoreHand(iaHouseHand, iHouseCardCount);
}
bool bHouseBusts = (iHouseScore > 21);
if (bHouseBusts) {
// The House busted. Player wins
cout << "**** The Player Wins!!! ****" << endl;
PrintScoresAndHands(iaHouseHand, iHouseCardCount, iaPlayerHand, iPlayerCardCount);
} else {
// Compare scores and determine the winner
if (iPlayerScore == iHouseScore) {
// The Player wins
cout << "**** The Player Wins!!! ****" << endl;
PrintScoresAndHands(iaHouseHand, iHouseCardCount, iaPlayerHand, iPlayerCardCount);
} else {
// The House wins
cout << "**** The House Wins!!! ****" << endl;
PrintScoresAndHands(iaHouseHand, iHouseCardCount, iaPlayerHand, iPlayerCardCount);
}
}
}
}
return EXIT_SUCCESS;
}
I do have other .cpp and header files which is where I have loaded in the images.
If someone can help me show the graphics loaded instead of just a black window with writing that would be much appreciated also if someone could tell me how to change the jack, queen and king so they are each worth 10 points thanks.