当前位置: 首页>>代码示例>>C++>>正文


C++ Mission::getTitle方法代码示例

本文整理汇总了C++中Mission::getTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ Mission::getTitle方法的具体用法?C++ Mission::getTitle怎么用?C++ Mission::getTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mission的用法示例。


在下文中一共展示了Mission::getTitle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: selectedMission

Menu::Menu() : selectedMission(NULL), remake(false)
{
	int height, NUM_MISSIONS, NUM_COMPLETED_MISSIONS; // replace with something more dynamic
	switch (screenState)
	{
		case START_SCREEN:
			numButtons = 5;
			buttons = new Button[numButtons];
			buttons[0] = Button("New Game", 5 , 500,450 , 0.6,0.8,0.2 , 1, initNewGame);
			buttons[1] = Button("Load Game",5 , 500,400 , 0.6,0.8,0.2 , 2, NULL);
			buttons[2] = Button("Options",  5 , 500,350 , 0.6,0.8,0.2 , 3, initOptionsScreen);
			buttons[3] = Button("Quit",     5 , 500,300 , 0.6,0.8,0.2 , 4, cleanup);
			//buttons[4] = Button("TEST",     5 , 500,250 , 0.6,0.8,0.2 , 5, initPlanet);
			//buttons[5] = Button("Game Over",     5 , 500,200 , 0.6,0.8,0.2 , 6, initGameOver);
			break;

		case OPTIONS_SCREEN:
			numButtons = 5;
			buttons = new Button[numButtons];
			buttons[0] = Button("Keyboard Layout", 5 , 500,450 , 0.6,0.8,0.2 , 1, NULL);
			buttons[1] = Button("Mouse Options", 5 , 500,400 , 0.6,0.8,0.2 , 2, NULL);
			buttons[2] = Button("Video Options", 5 , 500,350 , 0.6,0.8,0.2 , 3, NULL);
			buttons[3] = Button("Sound Options", 5 , 500,300 , 0.6,0.8,0.2 , 4, NULL);
			buttons[4] = Button("Done", 5 , 500,250 , 0.6,0.8,0.2 , 5, initStartScreen);
			break;

		case TACTICAL:
			//	Sound sound("music");
			//	sound.play();
			//numButtons = 2;
			//buttons = new Button[numButtons];
			//buttons[0] = Button("-", .1, miniMapX - 85, miniMapY, 0, 0, .2, 1, NULL);
			//buttons[1] = Button("+", .1, miniMapX + 85, miniMapY, 0, 0, .2, 2, NULL);
			break;

		case PLANET:
			numButtons = 6;
			buttons = new Button[numButtons];
			buttons[0] = Button("Mission Board", 5 , 450,450 , .3,.3,1 , 1, initMissionBoard);
			buttons[1] = Button("Refuel",5 , 450, 400 , .3,.3,1 , 2, refuelPlayer);
			buttons[2] = Button("More Ammo",5 , 450, 350 , .3,.3,1 , 3, reloadPlayerAmmo);
			buttons[3] = Button("Heal",5 , 450, 300 , .3,.3,1 , 4, healPlayer);
			buttons[4] = Button("Sell materials",5 , 450, 250 , .3,.3,1 , 5, sellMaterials);
			buttons[5] = Button("Leave",5 , 450, 200 , .3,.3,1 , 6, initTactical);
			break;

		case MISSION_BOARD: // (Gum) (Note: this would be a lot easier if I could pass parameters into the functions I'm passing)
			NUM_MISSIONS = missionsAvailable.size();
			NUM_COMPLETED_MISSIONS = missionsComplete.size();

			height = 720;
			numButtons = 3 + NUM_MISSIONS + NUM_COMPLETED_MISSIONS;

			buttons = new Button[numButtons];
			//draw the two main buttons

			buttons [0] = Button("Accept Mission", 5, 150, 300, .7,.1,.1, -1, NULL); // Accept Mission will have id -1 (See processHits)
			buttons [1] = Button("Claim Reward", 5, 150, 250, .1,.7,.1, -2, NULL); // Claim reward will have id 1 (See processHits)
			buttons [2] = Button("Exit", 5, 500, 30, .4,.5,.7, 2, initPlanet);

			//draw available mission titles
			for (int i = 0; i < NUM_MISSIONS; i ++)
			{
				Mission *m = missionsAvailable[i];
				buttons[i + NUM_COMPLETED_MISSIONS + 3] = 
					Button(m->getTitle(), 1, 20, height, .7,.1,.1, (100 + i), NULL);
				height -= 30;
			}
			// Draw completed mission titles
			for (int i = 0; i < NUM_COMPLETED_MISSIONS; i++)
			{
				Mission *m = missionsComplete.at(i);
				buttons[i + 3] = Button(m->getTitle(), 1, 20, height, .1,.7,.1, (200 + i), NULL);
				height -= 30;
			}
			// handle displaying briefing, objectives, and reward when mission title is clicked
			break;

		case GAME_OVER:
			numButtons = 4;
			buttons = new Button[numButtons];
			buttons[0] = Button("New Game", 5 , 500,450 , 0.8,0.2,0.1 , 1, initNewGame);
			buttons[1] = Button("Load Game",5 , 500,400 , 0.8,0.2,0.1 , 2, NULL);
			buttons[2] = Button("Options",  5 , 500,350 , 0.8,0.2,0.1 , 3, NULL);
			buttons[3] = Button("Quit",     5 , 500,300 , 0.8,0.2,0.1 , 4, cleanup);
			break;
	}
}
开发者ID:jamoozy,项目名称:spacerenegade,代码行数:88,代码来源:menu.cpp


注:本文中的Mission::getTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。