コード例 #1
0
ファイル: interface.c プロジェクト: outadoc/RicochetRobots
//
// Rafraîchit l'affichage pendant une partie.
// Affiche le plateau de jeu, ainsi qu'un résumé des informations sur la partie en cours.
//
void refreshGameDisplay(GameState *state) {
    if(state == NULL) return;
    
    clear();
    set_tabsize(4);             //taille des tabulations
    
    displayGameBoard(state);    //affichage du plateau de jeu
    displayGameStatus(state);   //affichage d'infos sur le déroulement du jeu
    displayScores(state);       //affichage des scores
    displayCommands();          //affichage d'une aide sur les commandes disponibles
    
    //si on est en solo : affichage des messages de capture
    if(state->playersCount == 1) displayRobotCaptureMessage(state->robots);
}
コード例 #2
0
ファイル: World.cpp プロジェクト: dseerutt/7Wonders
void World::run()
{
#ifndef TESTING
	Display display(m_players);
	display.init();
#endif // !TESTING
	
			//display.test(m_deck);
	while (!m_gameOver)
	{
		if (betweenTurns())
		{
			updateMilitary();
			startAge();

#ifndef TESTING
			display.setAge(m_age);
#endif // !TESTING

		}

#ifndef TESTING
		display.draw();
#endif // !TESTING

		Player& p = *m_players[0];
		play(p);
		playOthers(p);
		endTurn();
	}

	computeScores();
	displayScores();
#ifndef TESTING
	display.drawScores(m_scores);
#endif // !TESTING
}
コード例 #3
0
ファイル: PointerLab.c プロジェクト: forstezt/CS252
int main() {
	
	int numScores = 0;
	int scores[100];	
	int* numScoresPointer = &numScores;

	readScores(scores, numScoresPointer);
	printf("\n\nScores:\n");
	displayScores(scores, numScores);




	int numFreq = 0;
	struct freq frequencies[numScores];
	
	int i;
	for (i = 0; i < numScores; i++) {
		(*(frequencies + i)).number = 0;
	}

	int* numFreqPointer = &numFreq;




	calcHistogram(frequencies, numFreqPointer, scores, numScores);
	printf("\n\n\nUnsorted Histogram:\n");
	displayHistogram(frequencies, numFreq);

	sortHistogram(frequencies, numFreq);
	printf("\n\n\nSorted Histogram:\n");
	displayHistogram(frequencies, numFreq);

	return 0;
}
コード例 #4
0
ファイル: hangman.c プロジェクト: drosales007/EmbeddedHW
void
GPIOFIntHandler(void){
	// Method for handling multiple functions for a select button press

	// Clear the GPIO interrupt
	GPIOPinIntClear(GPIO_PORTF_BASE, GPIO_PIN_1);

	// Disable Interrupts
	GPIOPinIntDisable(GPIO_PORTF_BASE, GPIO_PIN_1);
	GPIOPinIntDisable(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);

	// Check which state we are in
	if (state==0){
		// This state handles the main menu

		if (pointer==0){
			// Begin Classic Mode
			state = 1;
			startClassic();
		}
		else if (pointer==1){
			// Begin Continuous Mode
			state = 3;
			startClassic();
		}
		else if (pointer==2){
			// Show the instructions
			state = 2;
			RIT128x96x4Clear();
			displayInstructions();
			done = 1;
		}
		else if (pointer==3){
			// Show the high scores
			state = 2;
			RIT128x96x4Clear();
			displayScores();
			done = 1;
		}
		else if (pointer==4){
			state = 0;
			initMain();
		}
	}
	else if (state==1){
		// This state handles classic mode

		// Black out the letter that was selected
		int idx = position + position2;
		int pos = 0;
		char *puc_letter = alpha[idx];
		if (idx>12){
			pos = position2 * 10;
			RIT128x96x4StringDraw(puc_letter, pos, 87, 2);
		}
		else {
			pos = position * 10;
			RIT128x96x4StringDraw(puc_letter, pos, 75, 2);
		}

		// Add the letter to the list of selected letters
		int i;
		int wrong = 1;
		int used = 0;
		// Loop through the list until we find an empty spot to place the letter
		for (i=0; i<26; i++){
			if (strcmp(selected[i],"!")==0){
				selected[i] = puc_letter;
				break;
			}
			if (strcmp(selected[i],puc_letter)==0){
				wrong = 0;
				used = 1;
				break;
			}
		}

		// Check to see if the letter was already used
		if (!used){
			// Check the word to see if a letter matches the one selected. If it
			// does, we need to display the letters instead of an underscore
			for (i=0; i<strlen(words[wotd]); i++){
				char w_let = words[wotd][i];
				static char g[3];
				usprintf(g, "%d", w_let);
				char p_let = *puc_letter;
				if (w_let==p_let){
					wrong = 0;
					// Display the letter selected
					RIT128x96x4StringDraw(puc_letter, 10+i*10, 53, 15);
					correct++;
				}
			}
		}

		// Check to see if it was a wrong selection
		if (wrong==1){
			// Increment the number of wrong attempts
			try++;
			// If the selection was wrong, we need to draw a piece of the hangman
			if (try==1){
				drawHead();
			}
			else if (try==2){
				drawBody();
			}
			else if (try==3){
				drawRightArm();
			}
			else if (try==4){