Esempio n. 1
0
//------------------------------------------------------------------------------ 
// startMenu 
//------------------------------------------------------------------------------ 
// Uppgift: Visar upp startmenyn.
// Indata : (void)
// Utdata : (void)
//------------------------------------------------------------------------------
void TestApp::startMenu() {
	int choice = 0;
	int maxSize = sizeof(startMenuitems) / sizeof(startMenuitems[0]);
	do {
		system("cls");
		cout << " \n /**** HANOI GAME ****/\n\n 1. Start newgame\n 2. Replay\n 0. Exit " << endl;
		choice = getMenuOption(0, maxSize-1);
		doMenuChoice(startMenuitems[choice]);
	} while (startMenuitems[choice] != menu::EXIT);
}
Esempio n. 2
0
//------------------------------------------------------------------------------ 
// gamePlayMenu 
//------------------------------------------------------------------------------ 
// Uppgift: Visar upp gameplay menyn.
// Indata : (void)
// Utdata : (void)
//------------------------------------------------------------------------------
void TestApp::gamePlayMenu() {
	int choice = 0;
	int maxSize = sizeof(gamePlayMenuItems) / sizeof(gamePlayMenuItems[0]);
	do {
		system("cls");
		m_commandMgr->doCommand(new ShowCommand(m_hannoiEngine));
		cout << endl << endl << " 1. Move\n 2. Undo\n 3. Redo\n 4. Reset\n 0. Exit " << endl;
		choice = getMenuOption(0, maxSize - 1);
		doMenuChoice(gamePlayMenuItems[choice]);
	} while (gamePlayMenuItems[choice] != menu::EXIT);
}
Esempio n. 3
0
File: main.c Progetto: cnsoft/librgs
void gameScreenKeyPress(int keyCode) {
	switch(keyCode) {
		case RGS_ESCAPE:
			titleScreen->visible = 1;
		break;
		case RGS_BUTTON1:
			if(dealingScreen->visible == 1) {
				doMenuChoice();
			} else {
				if(jumping == 0) {
					RGS_PlaySpriteAnimation(pimp.pimpSprite->sprite, "jump",0);	
					RGS_PlaySFS(jumpSound);
					jumping = 1;
					pimp.pimpSprite->entity->yVelocity = -300;
				}
			}
		break;
		case RGS_BUTTON2:
			if(dealingScreen->visible == 1) {
				doMenuChoice();
			} else {
				smacko();
			}
		break;
		case RGS_START:
			if(dealingScreen->visible == 1) {
				doMenuChoice();
			} else {
				//				if(RGS_isPaused() == 1)
				//					RGS_Pause(0);
				//				else
				//					RGS_Pause(1);
			}
			break;
			case RGS_UP:
			if(dealingScreen->visible == 1) {
				dealMenuOffset--;
				if(dealMenuOffset < 0)
					dealMenuOffset = 2;
			} else {
				if(pimp.nearestDealer != NULL) {
					dealWithDealer(pimp.nearestDealer);
					doIllegal();
				} else if(pimp.nearestHo != NULL && pimp.coke > 0) {
					pimp.nearestHo->downout = 0;
					pimp.coke--;
					pimp.hos++;
					RGS_ResetTimer(&pimp.nearestHo->highTimer);
					RGS_ResetTimer(&pimp.nearestHo->moneyTimer);
					pimp.nearestHo = NULL;
					doIllegal();
				} else {
				
					if(pimp.nearestCitizen != NULL && pimp.meth > 0) {
						pimp.nearestCitizen->happy = 1;
						RGS_ResetTimer(&pimp.nearestCitizen->highTimer);
						pimp.meth--;
						pimp.money += 50;
						RGS_PlaySFS(sellSound);
						pimp.nearestCitizen = NULL;
						doIllegal();
					}
				}
			}
			break;
			case RGS_DOWN:
			if(dealingScreen->visible == 1) {
				dealMenuOffset++;
				if(dealMenuOffset > 2)
					dealMenuOffset = 0;		
			}
			break;
	}	
}