if ( iCurrentLevel==IDM_APP_MIDDLE )
{//难度为中
iTime=90;
iPrompt=3;
iShuffle=2;
linker=Linker_Matrix(4);
}
if ( iCurrentLevel==IDM_APP_HIGH )
{//难度为高
iTime=60;
iPrompt=3;
iShuffle=1;
linker=Linker_Matrix(4);
}
SetTimer (hwnd, TimerID, 1000, NULL) ;
InvalidateRect (hwnd, NULL, TRUE) ;
first_started=false;
iCount=0;
}
else
SendMessage(hwnd,WM_CLOSE,0,0);
break;
case IDM_APP_EXIT ://单击退出游戏菜单
SendMessage(hwnd,WM_CLOSE,0,0);
break;
case IDM_APP_ABOUT ://单击关于菜单
DialogBox (hInstance, TEXT ("AboutBox"), hwnd, AboutDlgProc) ;
break ;
case IDM_APP_LOW:
case IDM_APP_MIDDLE:
case IDM_APP_HIGH:
//单击难度菜单
CheckMenuItem (hMenu, iCurrentLevel, MF_UNCHECKED) ;
iCurrentLevel = LOWORD (wParam) ;
CheckMenuItem (hMenu, iCurrentLevel, MF_CHECKED) ;
break;
case IDM_APP_RESHUFFLE://单击重新洗牌按钮
if(iShuffle>0 )
{
iShuffle--;
linker.reShuffle();
}
//if(iShuffle==0)
//EnableMenuItem ((HMENU) wParam, IDM_APP_RESHUFFLE, MF_GRAYED) ;
//使文字所在区域无效化,重绘
/*rect.left = 0;
rect.right = xsize;
rect.top = 0;
rect.bottom = 20;*/
InvalidateRect (hwnd, NULL , true) ;
rect.left = 0;
rect.right = 0;
rect.top = 0;
rect.bottom = 0;
break;
case IDM_APP_PROMPT:
if(iPrompt>0 && linker.auto_search() )//提示次数>0,且找到匹配
{
//pSelected[0].x=pSelected[0].y=0;
linker.get_point(pSelected[0],pSelected[1]);
iPrompt--;
//使文字所在区域无效化,重绘
rect.left = 0;
rect.right = xsize;
rect.top = 0;
rect.bottom = 20;
InvalidateRect (hwnd, &rect, true) ;
rect.left = 0;
rect.right = 0;
rect.top = 0;
rect.bottom = 0;
//sprintf(szBuffer," %d %d %d %d",pSelected[0].x,pSelected[0].y,pSelected[1].x,pSelected[1].y);
//MessageBox (hwnd, szBuffer,szAppName, MB_OK | MB_ICONQUESTION) ;
rect.left = pSelected[0].x*(cxBack-3);
rect.right = rect.left+(cxBack-3)+3;
rect.top = pSelected[0].y *(cyBack-4)-30;
rect.bottom = rect.top + (cyBack-4)+4;
//Ellipse(hdc,rect.left ,rect.top ,rect.right ,rect.bottom );
InvalidateRect (hwnd, &rect, true) ;
rect2.left = pSelected[1].x *(cxBack-3);
rect2.right = rect2.left+(cxBack-3)+3;
rect2.top = pSelected[1].y *(cyBack-4)-30;
rect2.bottom = rect2.top + (cyBack-4)+4;
//Ellipse(hdc,rect.left ,rect.top ,rect.right ,rect.bottom );
InvalidateRect (hwnd, &rect2, true) ;
pSelected[0].x=0;
pSelected[0].y=0;
pSelected[1].x=0;
pSelected[1].y=0;
}