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


C++ MainMenu::getInput方法代码示例

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


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

示例1: createFrame

void createFrame() {
	if (stage == "INIT") { //loading stage
		if (loader.loadResources() != 0) {
			MessageBox(NULL, L"Forget-Me-Not was not installed correctly, as files are missing.", L"Error.", NULL);
			exit(0);
		}
		else {
			mainMenu.init(&window, loader);
			stage = "MENU";
		}
	}
	else if (stage == "MENU") { //menu stage
		mainMenu.getInput(mouseX, mouseY, mouseDown, framesDisplayed, processingStrokes);

		if (framesDisplayed == 30) { //triggers starting music
			loader.starting_music.play();
		}

		if (framesDisplayed < 340) { //flower start animation
			//framesDisplayed = 340; //REMOVE THIS LINE LATER (just to skip flower)
			mainMenu.displayFlower();
		}
		else{ //actual menu
			int isDisplay = mainMenu.display();
			if (isDisplay == 1) {
				currPatient = mainMenu.getPatient();
				stage = "OPTIONS";
			}
		}
	}
	else if (stage == "OPTIONS") {
		sf::Text menutitle;
		menutitle.setFont(loader.bold_font);
		menutitle.setCharacterSize(75);
		menutitle.setString("Forget-Me-Not");
		menutitle.setPosition(sf::Vector2f(280, 10));
		menutitle.setColor(sf::Color(0, 0, 0, 255));
		window.draw(menutitle);

		sf::Text menusubtitle;
		menusubtitle.setFont(loader.regular_font);
		menusubtitle.setCharacterSize(24);
		menusubtitle.setString("Loaded patient " + currPatient.firstName + " " + currPatient.lastName);
		menusubtitle.setPosition(sf::Vector2f(300, 100));
		menusubtitle.setColor(sf::Color(0, 0, 0, 255));
		window.draw(menusubtitle);

		int choice = 0;

		sf::RectangleShape rect;
		rect.setSize(sf::Vector2f(450, 620));
		if (mouseX > 30 && mouseX < 480 && mouseY > 160 && mouseY < 780) {
			rect.setFillColor(sf::Color(255, 150, 150, 255));
			if (mouseDown) {
				rect.setFillColor(sf::Color(120, 60, 60, 255));
				choice = 1;
			}
		}
		else {
			rect.setFillColor(sf::Color(255, 120, 120, 255));
		}
		rect.setPosition(sf::Vector2f(30, 160));
		window.draw(rect);

		sf::Text text;
		text.setString("START NEW TEST");
		text.setPosition(sf::Vector2f(50, 420));
		text.setCharacterSize(44);
		text.setColor(sf::Color(255, 255, 255, 255));
		text.setFont(loader.bold_font);
		window.draw(text);

		sf::RectangleShape rect2;
		rect2.setSize(sf::Vector2f(450, 620));
		if (mouseX > 515 && mouseX < 965 && mouseY > 160 && mouseY < 780) {
			rect2.setFillColor(sf::Color(130, 200, 130, 255));
			if (mouseDown) {
				rect2.setFillColor(sf::Color(60, 100, 60, 255));
				choice = 2;
			}
		}
		else {
			rect2.setFillColor(sf::Color(100, 200, 100, 255));
		}
		rect2.setPosition(sf::Vector2f(515, 160));
		window.draw(rect2);

		sf::Text text2;
		text2.setString("VIEW PATIENT RESULTS");
		text2.setPosition(sf::Vector2f(550, 420));
		text2.setCharacterSize(44);
		text2.setColor(sf::Color(255, 255, 255, 255));
		text2.setFont(loader.bold_font);
		window.draw(text2);

		if (choice == 1) {
			stage = "GAME";
		}
	}
	else if (stage == "GAME") {
//.........这里部分代码省略.........
开发者ID:jonomendelson,项目名称:Forget-Me-Not,代码行数:101,代码来源:main.cpp


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