Exemple #1
0
	bool Input::IsKeyMaskReleased(const std::string& mask)
	{
		for (std::list<KeyCode>::iterator i = instance->keyMasks[mask].begin(); i != instance->keyMasks[mask].end(); ++i)
		{
			if (IsKeyReleased(*i))
				return true;
		}
		return false;
	}
Exemple #2
0
	bool Input::IsMiddleMouseReleased() const
	{
		return IsKeyReleased((KeyboardKey)-2);
	}
Exemple #3
0
	bool Input::IsRightMouseReleased() const
	{
		return IsKeyReleased((KeyboardKey)-1);
	}
Exemple #4
0
bool Application::GetKeyboardUpdate()
{
	//A key
	if(IsKeyPressed('A'))
	{
		scene->UpdateKeyDown('a');
	}
	else if(IsKeyReleased('A'))
	{
		scene->UpdateKeyUp('a');
	}
	//D key
	if(IsKeyPressed('D'))
	{
		scene->UpdateKeyDown('d');
	}
	else if(IsKeyReleased('D'))
	{
		scene->UpdateKeyUp('d');
	}
	//W key
	if(IsKeyPressed('W'))
	{
		scene->UpdateKeyDown('w');
	}
	else if(IsKeyReleased('W'))
	{
		scene->UpdateKeyUp('w');
	}
	//S key
	if(IsKeyPressed('S'))
	{
		scene->UpdateKeyDown('s');
	}
	else if(IsKeyReleased('S'))
	{
		scene->UpdateKeyUp('s');
	}
	//P key
	if(IsKeyPressed('P'))
	{
		scene->UpdateKeyDown('p');
	}
	else if(IsKeyReleased('P'))
	{
		scene->UpdateKeyUp('p');
	}

	//G key
	static bool g_VKey = false;
	scene->UpdateKeyUp('g');
	if(IsKeyPressed('G') && !g_VKey)
	{
		scene->UpdateKeyDown('g');
		g_VKey = true;
	}
	else if(!IsKeyPressed('G') && g_VKey)
	{
		g_VKey = false;
	}
	//E key
	if(IsKeyPressed('E'))
	{
		scene->UpdateKeyDown('e');
	}
	else if(IsKeyReleased('E'))
	{
		scene->UpdateKeyUp('e');
	}

	//V key
	if(IsKeyPressed('V'))
	{
		scene->UpdateKeyDown('v');
	}
	else if(IsKeyReleased('V'))
	{
		scene->UpdateKeyUp('v');
	}
	//B key
	static bool b_VKey = false;
	scene->UpdateKeyUp('b');
	if(IsKeyPressed('B') && !b_VKey)
	{
		b_VKey = true;
	}
	else if(!IsKeyPressed('B') && b_VKey)
	{
		scene->UpdateKeyDown('b');
		b_VKey = false;
	}

	//F1 key
	if(IsKeyPressed(VK_F2))
	{
		scene->UpdateKeyDown(VK_F2);
	}
	else if(IsKeyReleased(VK_F2))
	{
		scene->UpdateKeyUp(VK_F2);
	}

	static bool delay1 = false;
	static bool delay2 = false;
	static bool delay3 = false;
	static bool delay4 = false;
	static bool delay5 = false;
	static bool delay6 = false;
	static bool delay7 = false;
	static bool delay8 = false;
	static bool delay9 = false;
	scene->UpdateKeyUp('1');
	scene->UpdateKeyUp('2');
	scene->UpdateKeyUp('3');
	scene->UpdateKeyUp('4');
	scene->UpdateKeyUp('5');
	scene->UpdateKeyUp('6');
	scene->UpdateKeyUp('7');
	scene->UpdateKeyUp('8');
	scene->UpdateKeyUp('9');
	
	//1 key
	if(IsKeyPressed('1') && !delay1)
	{
		delay1 = true;
	}
	else if(IsKeyReleased('1') && delay1)
	{
		scene->UpdateKeyDown('1');
		delay1 = false;
	}

	//2 key
	if(IsKeyPressed('2') && !delay2)
	{
		delay2 = true;
	}
	else if(IsKeyReleased('2') && delay2)
	{
		scene->UpdateKeyDown('2');
		delay2 = false;
	}

	//3 key
	if(IsKeyPressed('3') && !delay3)
	{
		delay3 = true;
	}
	else if(IsKeyReleased('3') && delay3)
	{
		scene->UpdateKeyDown('3');
		delay3 = false;
	}

	//4 key
	if(IsKeyPressed('4') && !delay4)
	{
		delay4 = true;
	}
	else if(IsKeyReleased('4') && delay4)
	{
		scene->UpdateKeyDown('4');
		delay4 = false;
	}

	//5 key
	if(IsKeyPressed('5') && !delay5)
	{
		delay5 = true;
	}
	else if(IsKeyReleased('5') && delay5)
	{
		scene->UpdateKeyDown('5');
		delay5 = false;
	}

	//6 key
	if(IsKeyPressed('6') && !delay6)
	{
		delay6 = true;
	}
	else if(IsKeyReleased('6') && delay6)
	{
		scene->UpdateKeyDown('6');
		delay6 = false;
	}

	//7 key
	if(IsKeyPressed('7') && !delay7)
	{
		delay7 = true;
	}
	else if(IsKeyReleased('7') && delay7)
	{
		scene->UpdateKeyDown('7');
		delay7 = false;
	}

	//delay8 key
	if(IsKeyPressed('8') && !delay8)
	{
		delay8 = true;
	}
	else if(IsKeyReleased('8') && delay8)
	{
		scene->UpdateKeyDown('8');
		delay8 = false;
	}

	//9 key
	if(IsKeyPressed('9') && !delay9)
	{
		delay9 = true;
	}
	else if(IsKeyReleased('9') && delay9)
	{
		scene->UpdateKeyDown('9');
		delay9 = false;
	}

	//Up arrow key
	static bool b_UpKey = false;
	scene->UpdateKeyUp(VK_UP);
	if(IsKeyPressed(VK_UP) && !b_UpKey)
	{
		b_UpKey = true;
	}
	else if(!IsKeyPressed(VK_UP) && b_UpKey)
	{
		scene->UpdateKeyDown(VK_UP);
		b_UpKey = false;
	}
	
	//Down arrow key
	static bool b_DownKey = false;
	scene->UpdateKeyUp(VK_DOWN);
	if(IsKeyPressed(VK_DOWN) && !b_DownKey)
	{
		b_DownKey = true;
	}
	else if(!IsKeyPressed(VK_DOWN) && b_DownKey)
	{
		scene->UpdateKeyDown(VK_DOWN);
		b_DownKey = false;
	}

	//Left arrow key
	static bool b_LeftKey = false;
	scene->UpdateKeyUp(VK_LEFT);
	if(IsKeyPressed(VK_LEFT) && !b_LeftKey)
	{
		b_LeftKey = true;
	}
	else if(!IsKeyPressed(VK_LEFT) && b_LeftKey)
	{
		scene->UpdateKeyDown(VK_LEFT);
		b_LeftKey = false;
	}

	//Right arrow key
	static bool b_RightKey = false;
	scene->UpdateKeyUp(VK_RIGHT);
	if(IsKeyPressed(VK_RIGHT) && !b_RightKey)
	{
		b_RightKey = true;
	}
	else if(!IsKeyPressed(VK_RIGHT) && b_RightKey)
	{
		scene->UpdateKeyDown(VK_RIGHT);
		b_RightKey = false;
	}

	//Enter key
	static bool b_EntKey = false;
	scene->UpdateKeyUp(VK_RETURN);
	if(IsKeyPressed(VK_RETURN) && !b_EntKey)
	{
		b_EntKey = true;
		
	}
	if(!IsKeyPressed(VK_RETURN) && b_EntKey)
	{
		scene->UpdateKeyDown(VK_RETURN);
		b_EntKey = false;
	}

	//Spacebar key
	if(IsKeyPressed(VK_SPACE))
	{
		scene->UpdateKeyDown(VK_SPACE);
	}
	if(IsKeyReleased(VK_SPACE))
	{
		scene->UpdateKeyUp(VK_SPACE);
	}
	//Backspace
	if(IsKeyPressed(VK_BACK))
	{
		scene->UpdateKeyDown(VK_BACK);
	}
	if(IsKeyReleased(VK_BACK))
	{
		scene->UpdateKeyUp(VK_BACK);
	}


	return false;
}