Ejemplo n.º 1
0
void Board::OnKeyDown (wxKeyEvent &event)
{
    if (!isStarted || curPiece.GetShape() == NoShape)
    {
        event.Skip();
        return;
    }

    int keycode = event.GetKeyCode();

    if (keycode == 'p' || keycode == 'P')
    {
        Pause();
        return;
    }

    if (isPaused)
    {
        return;
    }

    switch (keycode)
    {
        case WXK_LEFT:
            TryMove (curPiece, curX - 1, curY);
            break;

        case WXK_RIGHT:
            TryMove (curPiece, curX + 1, curY);
            break;

        case WXK_DOWN:
            TryMove (curPiece.RotateRight(), curX, curY);
            break;

        case WXK_UP:
            TryMove (curPiece.RotateLeft(), curX, curY);
            break;

        case WXK_SPACE:
            DropDown();
            break;

        case 'd':
            OneLineDown();
            break;

        case 'D':
            OneLineDown();
            break;

        default:
            event.Skip();
    }
}
Ejemplo n.º 2
0
    void SComboBase::OnLButtonDown( UINT nFlags,CPoint pt )
    {
		if (m_bFocusable)
			SetFocus();
        DropDown();
    }