Esempio n. 1
0
void SceneGame::popUpKeyboard() {
	if(keyboardUp == false) {
		keyboardUp = true;
		
		// add black background
		IGSprite* keyboardBlack = new IGSprite("BackgroundBlack", IGPoint(240,160), 4, SceneGameTagKeyboardBlack);
		keyboardBlack->setOpacity(64);
		this->addChild(keyboardBlack);

		// display the selected letter
		IGSprite* selectedLetterBackground = new IGSprite("GameAlphabetSelectedLetterBackground", IGPoint(240,48), 5, SceneGameTagKeyboardLabelSelectedBackground);
		this->addChild(selectedLetterBackground);
		char buffer[200];
		sprintf(buffer, "Selected Letter: %c", selectedChar);
		IGLabel* labelSelectedLetter = new IGLabel("FontCourierNew18", std::string(buffer), IGPoint(240,48), IGRect(480,30), 6, SceneGameTagKeyboardLabelSelectedLetter);
		labelSelectedLetter->setColor(255, 255, 255, 255);
		this->addChild(labelSelectedLetter);

		// add the keys
		for(int i=GameAlphabetA; i<=GameAlphabetESC; i++) {
			GameAlphabetLetter* letterButton = new GameAlphabetLetter(i, isLetterUsed(i));
			this->addChild(letterButton);
		}
	}
}
void SceneGameMenu::errorMessageStart() {
	IGSprite* spriteBlackBackground = new IGSprite("background_black", IGPoint(160,240), 5, GameMenuTagErrorBlackBackground);
	spriteBlackBackground->setOpacity(192);
	IGSprite* spriteErrorBackground = new IGSprite("game_menu_error_background", IGPoint(160,280), 6, GameMenuTagErrorBackground);
	GameMenuButtonErrorContinue* buttonContinue = new GameMenuButtonErrorContinue();
	this->addChild(spriteBlackBackground);
	this->addChild(spriteErrorBackground);
	this->addChild(buttonContinue);
}
void SceneAchievements::updateAchievements() {
	int i;
	// start by getting rid of all the old achievements
	for(i=0; i<4*5; i++) // 4 element for each of 5 achivments on the page
	  removeChildByTag(AchievementsTagItems+i);

	// figure out what achievements need displaying
	int start = pageNumber*5;
	int end = start+5;
	if(end >= ACHIEVEMENT_NUM)
		end = ACHIEVEMENT_NUM;

	// display them
	int curTag = AchievementsTagItems;
	int curItem = 0;
	for(i=start; i<end; i++) {
		Achievement a = Achievements::getInstance()->getAchievement(i);
		
		// row background
		IGSprite* spriteRowBackground = new IGSprite("achievements_row_background", IGPoint(160,116+68*curItem), 5, curTag);
		this->addChild(spriteRowBackground);
		curTag++;

		// name and description
		IGLabel* labelName = new IGLabel("font_gabriola_16b", a.name.c_str(), IGPoint(196,105+68*curItem), IGRect(232,34), 6, curTag);
		labelName->setColor(255,255,255,255);
		this->addChild(labelName);
		curTag++;
		IGLabel* labelDescription = new IGLabel("font_gabriola_14", a.description.c_str(), IGPoint(196,127+68*curItem), IGRect(232,34), 6, curTag);
		labelDescription->setColor(196,207,226,255);
		this->addChild(labelDescription);
		curTag++;

		// trophy
		if(a.achieved) {
			IGSprite* spriteTrophy = new IGSprite("achievements_trophy", IGPoint(44,116+68*curItem), 6, curTag);
			this->addChild(spriteTrophy);
		} else {
			IGSprite* spriteTrophy = new IGSprite("achievements_locked_trophy", IGPoint(44,116+68*curItem), 6, curTag);
			this->addChild(spriteTrophy);

			// dim everything out
			labelName->setOpacity(128);
			labelDescription->setOpacity(128);
			spriteTrophy->setOpacity(128);
		}
		curTag++;

		curItem++;
	}
}
void SceneOptions::resetPressed() {
	if(resetConfirmUp)
		return;
	resetConfirmUp = true;
	
	// add reset confirm dialog
	IGSprite* spriteBlackBackground = new IGSprite("background_black", IGPoint(160,240), 5, OptionsTagResetBlackBackground);
	spriteBlackBackground->setOpacity(192);
	IGSprite* spriteResetConfirmBackground = new IGSprite("options_reset_confirm_background", IGPoint(160,203), 6, OptionsTagResetBackground);
	OptionsButtonResetYes* buttonYes = new OptionsButtonResetYes();
	OptionsButtonResetCancel* buttonCancel = new OptionsButtonResetCancel();
	this->addChild(spriteBlackBackground);
	this->addChild(spriteResetConfirmBackground);
	this->addChild(buttonYes);
	this->addChild(buttonCancel);
}