Exemplo n.º 1
0
void CMenu::HandleInput()
{
    // Since there will be some loops when inside the menu code, we need to
    // allow windows messages to get processed.  If we get a quit message, return 1.
    if(g_Input.HandleWindowsMessages() == -1)
    {
        m_bEscapePressed = true;
        return;
    }

    // Set the escape key pressed flag as true if we hit escape
    if(g_Input.IsKeyDown(VK_ESCAPE))
        m_bEscapePressed = true;

    // If the left mouse button is pressed, let's check if we clicked on a button
    if(g_Input.IsLeftMousePressed())
        CheckForButton(g_cursorPos.x, g_cursorPos.y);
}
Exemplo n.º 2
0
void CMenu::HandleInput()
{
	// If there is no input events, return
	if(!g_Input.CheckInput())
		return;

	// If there is a keyboard event and the key is being pressed down...
	if(g_Input.IsKeyboardEvent() && g_Input.IsKeyDown())
	{
		// Set the escape key pressed flag as true if we hit escape
		if(g_Input.GetKeyCode() == VK_ESCAPE)
			m_bEscapePressed = true;
	}

	// If the left mouse button is pressed, let's check if we click on a button
	if(g_Input.IsLeftMousePressed())
	{
		g_Input.ResetLeftMouse();
		CheckForButton(g_cursorPos.X, g_cursorPos.Y);
	}
}