Exemple #1
0
/* ============================================================================
* Funktion:        LoadDifficultyMenue
* Input:           ACCOUNT user
* Output:               -
*
* Beschreibung:    Laden eines neuen Spiels bzw. Auswahl der gewuenschten
*                   Schwierigkeitsstufe.
* ============================================================================
*/
void LoadDifficultyMenue(ACCOUNT user) {
   /* Initialisierung der Variablen */
	int iStatus = 0, iTemp = 1, iLength = 0, i, m_Exit = 0;
   char *cMenu[SUDOKU_DIFFICULTIES] = { "Easy                   ", 
												"Medium                 ", 
												"Hard                   ",
												"Exit                   "
											 }
			,highLight[2];
	
	sprintf(highLight, "%c", 16);
	for (i = 0; i < SUDOKU_DIFFICULTIES; i++)
	{
		printTo((WINDOW_WIDTH-17)/2, 43+i, cMenu[i], 0);
	}
	printTo((WINDOW_WIDTH-17)/2, 47, "                         ", 0);
   printTo(((WINDOW_WIDTH-17)/2)-5, 43, highLight, 0);
   gotoxy(WINDOW_WIDTH-1,0);

   /* Bewegen der Pfeile in der Navigation */
   do
   {
		iStatus = control();

		printTo(((WINDOW_WIDTH-17)/2)-5, 42+iTemp, " ", 0);

		if (iStatus == 2) 
		{
			if (iTemp > 1) 
			{
				iTemp--;
			}
		}
		else if (iStatus == 3) 
		{
			if (iTemp < SUDOKU_DIFFICULTIES && iTemp > 0)
			{
				iTemp++;
			}
		}
		
        printTo(((WINDOW_WIDTH-17)/2)-5, 42+iTemp, highLight, 0);
        gotoxy(WINDOW_WIDTH-1,0);
   } while (iStatus != 6);

   /* Generierung des Spiels */
	if(iTemp != 4) 
   {
		generateGame(iTemp, user);
	}
	return;
}
void MainWindow::generateRandom()
{
	generateGame(4);
}
void MainWindow::generateHard()
{
	generateGame(3);
}
void MainWindow::generateMedium()
{
	generateGame(2);
}
void MainWindow::generateEasy()
{
	generateGame(1);
}