Ejemplo n.º 1
0
void logicButtons(bool temp[]) {
	for (int i = 0; i < NUMBER_OF_BUTTON; ++i) {
		if (temp[i] == true) {
			switch (i) {
			case 0:
			    if(!lockButtons)
                {
                    startStopGame();
                }
				temp[i] = false;
				break;
			case 1:
			    if(!lockButtons)
                {
                    setToDefault();
                    loadGame(board);
                    if(availableMatches() == 0)
                    {
                        startStopGame();
                    }
                }
				temp[i] = false;
				break;
			case 2:
				showHelp();
				temp[i] = false;
				break;
			case 3:
				startStopSound();
				temp[i] = false;
				break;
			}
		}
	}
}
Ejemplo n.º 2
0
void GameApplication::generateMatches() {
	std::stringstream text;
	SDL_Color textColor = { 255, 255, 255, 255 };
	text.str("");
	matches = availableMatches();
	text << "Available matches: " << matches;
	if (!wordMatches.loadFromRenderedText(renderer, font, text.str().c_str(), textColor)) {
		printf("Unable to render time texture!\n");
	}
}
Ejemplo n.º 3
0
void GameApplication::logicButtons(bool temp[]) {
	for (int i = 0; i < NUMBER_OF_BUTTON; ++i) {
		if (temp[i] == true) {
			switch (i) {
			case 0:
				if (!lockButtons) {
					startStopGame();
				}
				if (chunk) {
					Mix_PlayChannel(-1, click, 0);
				}
				temp[i] = false;
				break;
			case 1:
				if (!lockButtons) {
					setToDefault();
					loadGame(board);
					if (availableMatches() == 0) {
						startStopGame();
					}
				}
				if (chunk) {
					Mix_PlayChannel(-1, click, 0);
				}
				temp[i] = false;
				break;
			case 2:
				showHelp();
				if (chunk) {
					Mix_PlayChannel(-1, click, 0);
				}
				temp[i] = false;
				break;
			case 3:
				startStopSound();
				if (chunk) {
					Mix_PlayChannel(-1, click, 0);
				}
				temp[i] = false;
				break;
			}
		}
	}
}
Ejemplo n.º 4
0
void GameApplication::logicBoard() {
	eraseTileMap();
	unblockedBoard();

	if (endOfTheGame() && board.isStarted()) {
		youWin = true;
		winGames++;
		allGames++;
		award(calculateAward(calculate()));
		saveStatsFile(allGames, winGames);
		board.stop();
		timer.stop();
		winAnimation.startAnimation(50, 50);
	}
	if (availableMatches() == 0 && board.isStarted()) {
		youLose = true;
		allGames++;
		saveStatsFile(allGames, winGames);
		board.stop();
		timer.stop();
	}
}