Пример #1
0
bool startMenu::menuControl() {
	while (_window.pollEvent(event)) {
			if (event.type == Event::Closed) _window.close();
			if (event.type == Event::KeyReleased) {
				if (event.key.code == Keyboard::Up)
					if (_ButtFocus != start) _ButtFocus = Button_focus(_ButtFocus - 1);
				if (event.key.code == Keyboard::Down)
					if (_ButtFocus != quit) _ButtFocus = Button_focus(_ButtFocus + 1);
				if (event.key.code == Keyboard::Return) {
					switch (_ButtFocus) {
					case start:
						return true;
						break;
					case option:
						//RunOption();
						break;
					case autors:
						//RunAutors();
						break;
					case quit:
						_window.close();
						break;

					}
				}
				
			}
		}
	return false;

}
Пример #2
0
bool startMenu::menuControl() {
	//while (_window.pollEvent(_event)) {
			if (_event.type == Event::Closed) _window.close();
			if (_event.type == Event::KeyReleased) {
				if (_event.key.code == Keyboard::Up)
					if (_ButtFocus != start) _ButtFocus = Button_focus(_ButtFocus - 1);
					else _ButtFocus = quit;
				if (_event.key.code == Keyboard::Down)
					if (_ButtFocus != quit) _ButtFocus = Button_focus(_ButtFocus + 1);
					else _ButtFocus = start;
				if (_event.key.code == Keyboard::Return) {
					switch (_ButtFocus) {
					case start:

						ScreenManager::setCurrentScreen("gameplay");
						return true;
						break;
					case option:
						//RunOption();
						break;
					case autors:
						//RunAutors();
						break;
					case quit:
						_window.close();
						break;

					}
				}
				
			}
		//}
	return false;

}