예제 #1
0
void Game::keyboardDown(unsigned char key, int mouseX, int mouseY)
{

//===========================================================================================
//								 KEYDOWN ITERATOR
//===========================================================================================

	std::vector<GameState*>::iterator it;
	for (it = states.begin(); it != states.end(); it++)
	{
		if (*it)
		{
			GameState* s = (*it);
			if(s->active==true)
			s->KeyDown(key);
		}
	}

//===========================================================================================
//								 TESTING KEYS (StateChanges)
//===========================================================================================

			switch(key)
			{
			case '1': {		SwitchStateTo (StateHome, 1);
							break;  }
			case '2': {		
							SwitchStateTo (StateHome, 2);
							//playEnvironment();
							StateControl(UI,true,6);
							MessageControl(Msg, 3, 7);
							break;  }
			case '3': {		
							SwitchStateTo (StateHome, 3);
							StateControl(UI,true,6);
							MessageControl(Msg, 2, 7);
							break;  }
			case '4': {		SwitchStateTo (StateHome, 4);
							StateControl(UI,true,6);
							MessageControl(Msg, 1, 7);
							break;  }
			case '5': {		SwitchStateTo (StateHome, 5);
							StateControl(UI,true,6);
							MessageControl(Msg, 0, 7);
							break;  }
			case 't': {     std::cout<<"YOLO\n"; break; }
			case 'm': {     playBeepSound(); break; }
			case 27:  {     StateToggle (MenuState, 1);
						    StateToggle (StateOne, 2);
						    StateToggle (UI,6);
							break; }
			}
	
}
예제 #2
0
void Game::keyboardDown(unsigned char key, int mouseX, int mouseY)
{

//===========================================================================================
//								 KEYDOWN ITERATOR
//===========================================================================================

	std::vector<GameState*>::iterator it;
	for (it = states.begin(); it != states.end(); it++)
	{
		if (*it)
		{
			GameState* s = (*it);
			if(s->active==true)
			s->KeyDown(key);
		}
	}

//===========================================================================================
//								 TESTING KEYS (StateChanges)
//===========================================================================================

			switch(key)
			{
			case '1': {		SwitchStateTo (StateHome, 1);
							break;  }
			case '2': {		SwitchStateTo (StateHome, 2);
							break;  }
			case '3': {		SwitchStateTo (StateHome, 3);
							break;  }
			case '4': {		SwitchStateTo (StateHome, 4);
							break;  }
			case '5': {		SwitchStateTo (StateHome, 5);
							break;  }
			case 't': {     std::cout<<"YOLO\n"; break; }
			}
	
}