//绘画扑克 VOID CCardControl::DrawCardControl(CDC * pDC) { //加载位图 CImageHandle HandleCard(&m_ImageCard); //获取位置 CPoint OriginPoint; GetOriginPoint(OriginPoint); //绘画扑克 INT nXImagePos=0,nYImagePos=0; BYTE cbCardData = 0; if( !m_bMoving || m_nXDistance > 0 ) { for (WORD i=0;i<m_wCardCount;i++) { //变量定义 cbCardData=m_CardItem[i].cbCardData; //图片位置 if ( m_CardItem[i].bDisplay && cbCardData != 0 && cbCardData != 0xFF ) { nXImagePos=((cbCardData&CARD_MASK_VALUE)-1)*m_CardSize.cx; nYImagePos=((cbCardData&CARD_MASK_COLOR)>>4)*m_CardSize.cy; } else { nXImagePos=m_CardSize.cx*2; nYImagePos=m_CardSize.cy*4; } //绘画扑克 m_ImageCard.AlphaDrawImage(pDC,OriginPoint.x+m_nXDistance*i,OriginPoint.y,m_CardSize.cx,m_CardSize.cy,nXImagePos,nYImagePos,RGB(255,0,255)); }
//鼠标消息 void CCardControl::OnLButtonDown(UINT nFlags, CPoint point) { __super::OnLButtonDown(nFlags, point); //状态判断 if ((m_bPositively==false)||(m_bShowFirst==true)) return; if ((point.x>CARD_SPACE)||(m_CardDataArray.GetCount()==0)) return; //变量定义 CClientDC ClientDC(this); BYTE bCardData=m_CardDataArray[0]; CImageHandle HandleCard(&m_ImageCard); int nDrawWidth=(m_CardDataArray.GetCount()==1)?CARD_WIDTH:CARD_SPACE; //捕获鼠标 SetCapture(); m_bCaptureMouse=true; //绘画扑克 int nXPos=GetCardXPos(bCardData); int nYPos=GetCardYPos(bCardData); m_ImageCard.AlphaDrawImage(&ClientDC,0,0,nDrawWidth,CARD_HEIGHT,nXPos,nYPos,RGB(255,0,255)); return; }
//构造函数 CCardControl::CCardControl() { //状态变量 m_bSmallMode=false; m_bHorizontal=true; m_bPositively=false; m_bDisplayItem=false; m_bShowCardControl=true; //选择变量 m_wEndIndex=INVALID_ITEM; m_wStartIndex=INVALID_ITEM; //扑克数据 m_wCardCount=0; ZeroMemory(m_CardItemArray1,sizeof(m_CardItemArray1)); ZeroMemory(m_CardItemArray1,sizeof(m_CardItemArray1)); //位置变量 m_YCollocateMode=enYTop; m_XCollocateMode=enXLeft; m_BenchmarkPos.SetPoint(0,0); //间隔变量 m_nXDistance=(m_bSmallMode==false)?DEF_X_DISTANCE:DEF_X_DISTANCE_SMALL; m_nYDistance=(m_bSmallMode==false)?DEF_Y_DISTANCE:DEF_Y_DISTANCE_SMALL; m_nShootDistance=(m_bSmallMode==false)?DEF_SHOOT_DISTANCE:DEF_SHOOT_DISTANCE_SMALL; //加载资源 HINSTANCE hResInstance=AfxGetInstanceHandle(); m_ImageCard.SetLoadInfo((m_bSmallMode==false)?IDB_GAME_CARD:IDB_GAME_CARD,hResInstance); m_ImageHand.SetLoadInfo(IDB_BMP_HAND,hResInstance); // m_ImageNiu.SetLoadInfo(IDB_BMP_NIUNIU,hResInstance); // m_cbNiuType=0; //获取大小 CImageHandle HandleCard(&m_ImageCard); m_CardSize.SetSize(m_ImageCard.GetWidth()/13,m_ImageCard.GetHeight()/5); m_nOffsetSecondCardPos=0; m_bIsTuiPaiOver=false; m_bTui=false; m_bZuoTui=false; m_bMoveFirstOver=false; m_bIsOver=false; m_pWnd=NULL; m_SecondCardRect.SetRect(0,0,0,0); m_OffsetX=0; m_OffsetY=0; return; }
//绘画扑克 VOID CCardControl::DrawCardControl(CDC * pDC) { //显示判断 if (m_bShowCardControl==false) return; //加载位图 CPngImage ImageCardMask; CImageHandle HandleCard(&m_ImageCard); //获取位置 CPoint OriginPoint; GetOriginPoint(OriginPoint); //变量定义 INT nXDrawPos=0,nYDrawPos=0; INT nXImagePos=0,nYImagePos=0; //加载资源 //CPngImage ImageCardSelect; //if ((m_wStartIndex<m_wCardCount)&&(m_wEndIndex<m_wCardCount)) //{ // ImageCardSelect.LoadImage(AfxGetInstanceHandle(),TEXT("CARD_SELECT")); //} for (WORD i=0;i<m_wCardCount;i++) { //获取扑克 BYTE cbCardData=m_CardItemArray1[i].cbCardData; //间隙过滤 //if (cbCardData==SPACE_CARD_DATA) continue; if(!cbCardData)continue; //图片位置 if (cbCardData!=0) { if ((cbCardData==0x4E)||(cbCardData==0x4F)) { nXImagePos=((cbCardData&CARD_MASK_VALUE)%14)*m_CardSize.cx; nYImagePos=((cbCardData&CARD_MASK_COLOR)>>4)*m_CardSize.cy; } else { nXImagePos=((cbCardData&CARD_MASK_VALUE)-1)*m_CardSize.cx; nYImagePos=((cbCardData&CARD_MASK_COLOR)>>4)*m_CardSize.cy; } }
//重画函数 void CConcealCardView::OnPaint() { CPaintDC dc(this); //加载资源 CImageHandle HandleBack(&m_ImageBack); CImageHandle HandleCard(&m_ImageCard); //绘画背景 m_ImageBack.BitBlt(dc,0,0); //绘画扑克 if (m_cbConcealCount>0) { //获取位置 CRect rcClient; GetClientRect(&rcClient); //计算大小 CSize ControlSize; ControlSize.cy=m_CardSize.cy; ControlSize.cx=m_CardSize.cx+(m_cbConcealCount-1)*18; //定义位置 int nXPos=(rcClient.Width()-ControlSize.cx)/2+17; int nYPos=(rcClient.Height()-ControlSize.cy)/2; //绘画扑克 for (BYTE i=0;i<m_cbConcealCount;i++) { //变量定义 int nXImagePos=0,nYImagePos=0; //图片位置 if (m_cbConcealCard[i]!=0) { if ((m_cbConcealCard[i]==0x4E)||(m_cbConcealCard[i]==0x4F)) { nYImagePos=((m_cbConcealCard[i]&CARD_MASK_COLOR)>>4)*m_CardSize.cy; nXImagePos=((m_cbConcealCard[i]&CARD_MASK_VALUE)%14)*m_CardSize.cx; } else { nXImagePos=((m_cbConcealCard[i]&CARD_MASK_VALUE)-1)*m_CardSize.cx; nYImagePos=((m_cbConcealCard[i]&CARD_MASK_COLOR)>>4)*m_CardSize.cy; } }
//重画函数 void CCardControl::OnPaint() { CPaintDC dc(this); //获取位置 CRect rcClient; GetClientRect(&rcClient); //加载位图 CImage ImageBuffer; CImageHandle HandleCard(&m_ImageCard); CImageHandle HandleFundus(&m_ImageBack); ImageBuffer.Create(rcClient.Width(),rcClient.Height(),16); if (ImageBuffer.IsNull()==true) return; //绘画扑克 CDC * pBufferDC=CDC::FromHandle(ImageBuffer.GetDC()); if(bDrawCard) //add { //add for (int i=0;i<m_CardDataArray.GetCount();i++) { BYTE bCardData=m_CardDataArray[i]; m_ImageCard.AlphaDrawImage(pBufferDC,i*CARD_SPACE,0,CARD_WIDTH,CARD_HEIGHT,GetCardXPos(bCardData),GetCardYPos(bCardData),RGB(255,0,255)); //非常好的画图函数 } } /////////////////////////////////////////////////////////////////////////////////////////begin add else { for(int i=0;i<m_CardDataArray.GetCount();i++) { m_ImageBack.AlphaDrawImage(pBufferDC,i*CARD_SPACE,0,CARD_WIDTH,CARD_HEIGHT,3*CARD_WIDTH,4*CARD_HEIGHT,RGB(255,0,255)); //画扑克背面 } } ///////////////////////////////////////////////////////////////////////////////////////////end add ImageBuffer.ReleaseDC(); ImageBuffer.BitBlt(dc,0,0); //清理资源 ImageBuffer.Destroy(); return; }
//重画函数 void CCardControl::OnPaint() { CPaintDC dc(this); //获取位置 CRect rcClient; GetClientRect(&rcClient); //加载位图 CImageHandle HandleCard(&m_ImageCard); //创建位图 CBitmap BufferImage; BufferImage.CreateCompatibleBitmap(&dc,rcClient.Width(),rcClient.Height()); //创建 DC CDC BufferDC; BufferDC.CreateCompatibleDC(&dc); BufferDC.SelectObject(&BufferImage); //绘画扑克 DWORD dwXImagePos,dwYImagePos; DWORD dwXScreenPos,dwYScreenPos; for (INT i=0;i<m_CardDataItem.GetCount();i++) { //获取扑克 tagCardItem * pCardItem=&m_CardDataItem[i]; //间隙过滤 if (pCardItem->cbCardData==255) continue; //图片位置 if ((m_bDisplay==true)&&(pCardItem->cbCardData!=0)) { if ((pCardItem->cbCardData==0x4E)||(pCardItem->cbCardData==0x4F)) { dwYImagePos=((pCardItem->cbCardData&CARD_MASK_COLOR)>>4)*m_CardSize.cy; dwXImagePos=((pCardItem->cbCardData&CARD_MASK_VALUE)%14)*m_CardSize.cx; } else { dwXImagePos=((pCardItem->cbCardData&CARD_MASK_VALUE)-1)*m_CardSize.cx; dwYImagePos=((pCardItem->cbCardData&CARD_MASK_COLOR)>>4)*m_CardSize.cy; } }
//绘画扑克 VOID CCardControl::DrawCardControl(CDC * pDC) { //加载位图 CPngImage ImageCardMask; CImageHandle HandleCard(&m_ImageCard); //获取位置 CPoint OriginPoint; GetOriginPoint(OriginPoint); //变量定义 INT nXDrawPos=0,nYDrawPos=0; INT nXImagePos=0,nYImagePos=0; //加载资源 CPngImage ImageCardSelect; if ((m_wStartIndex<m_wCardCount)&&(m_wEndIndex<m_wCardCount)) { ImageCardSelect.LoadImage(AfxGetInstanceHandle(),TEXT("CARD_SELECT")); } //绘画扑克 for (WORD i=0;i<m_wCardCount;i++) { //获取扑克 bool bShoot=m_CardItemArray[i].bShoot; BYTE cbCardData=m_CardItemArray[i].cbCardData; //间隙过滤 if (cbCardData==SPACE_CARD_DATA) continue; //图片位置 if ((m_bDisplayItem==true)&&(cbCardData!=0)) { if ((cbCardData==0x4E)||(cbCardData==0x4F)) { nXImagePos=((cbCardData&CARD_MASK_VALUE)%14)*m_CardSize.cx; nYImagePos=((cbCardData&CARD_MASK_COLOR)>>4)*m_CardSize.cy; } else { nXImagePos=((cbCardData&CARD_MASK_VALUE)-1)*m_CardSize.cx; nYImagePos=((cbCardData&CARD_MASK_COLOR)>>4)*m_CardSize.cy; } }
//重画函数 void CCardControl::OnPaint() { CPaintDC dc(this); //获取位置 CRect rcClient; GetClientRect(&rcClient); /*dc.SetBkColor(RGB(255,0,255));*/ dc.SetBkMode(TRANSPARENT); //加载位图 CImageHandle HandleCard(&m_ImageCard); //创建位图 CBitmap BufferImage; BufferImage.CreateCompatibleBitmap(&dc,rcClient.Width(),rcClient.Height()); //创建 DC CDC BufferDC; BufferDC.CreateCompatibleDC(&dc); BufferDC.SetBkMode(TRANSPARENT); BufferDC.SelectObject(&BufferImage); //绘画扑克 DWORD dwXImagePos,dwYImagePos; DWORD dwXScreenPos,dwYScreenPos; for (INT i=0;i<m_CardDataItem.GetCount();i++) { //获取扑克 tagCardItem * pCardItem=&m_CardDataItem[i]; //图片位置 if ((m_bDisplay)&&(pCardItem->bCardData!=0)) { dwXImagePos=((pCardItem->bCardData&CARD_MASK_VALUE)-1)*m_CardSize.cx; dwYImagePos=((pCardItem->bCardData&CARD_MASK_COLOR)>>4)*m_CardSize.cy; } else {
//重画函数 void CCardControl::OnPaint() { CPaintDC dc(this); //获取位置 CRect rcClient; GetClientRect(&rcClient); //加载位图 CImageHandle HandleCard(&m_ImageCard); //创建位图 CBitmap BufferImage; BufferImage.CreateCompatibleBitmap(&dc,rcClient.Width(),rcClient.Height()); //创建 DC CDC BufferDC; BufferDC.CreateCompatibleDC(&dc); BufferDC.SelectObject(&BufferImage); //绘画扑克 DWORD dwXImagePos,dwYImagePos; DWORD dwXScreenPos,dwYScreenPos; for (INT i=0;i<m_CardDataItem.GetCount();i++) { //获取扑克 BYTE cbCardItem=0x00; if (m_XCollocateMode==enXLeft) cbCardItem=m_CardDataItem[i]; else cbCardItem=m_CardDataItem[m_CardDataItem.GetCount()-i-1]; //图片位置 if (cbCardItem!=0) { dwXImagePos=((cbCardItem&CARD_MASK_VALUE)-1)*m_CardSize.cx; dwYImagePos=((cbCardItem&CARD_MASK_COLOR)>>4)*m_CardSize.cy; } else {
//设置模式 bool CCardControl::SetCardMode(bool bSmallMode) { //设置模式 if (m_bSmallMode!=bSmallMode) { //设置变量 m_bSmallMode=bSmallMode; //设置间距 m_nXDistance=(m_bSmallMode==false)?DEF_X_DISTANCE:DEF_X_DISTANCE_SMALL; m_nYDistance=(m_bSmallMode==false)?DEF_Y_DISTANCE:DEF_Y_DISTANCE_SMALL; m_nShootDistance=(m_bSmallMode==false)?DEF_SHOOT_DISTANCE:DEF_SHOOT_DISTANCE_SMALL; //加载资源 HINSTANCE hResInstance=AfxGetInstanceHandle(); m_ImageCard.SetLoadInfo((m_bSmallMode==false)?IDB_GAME_CARD:IDB_GAME_CARD,hResInstance); //获取大小 CImageHandle HandleCard(&m_ImageCard); m_CardSize.SetSize(m_ImageCard.GetWidth()/13,m_ImageCard.GetHeight()/5); } return true; }
//构造函数 CCardControl::CCardControl() { //状态变量 m_bSmallMode=false; m_bHorizontal=true; m_bPositively=false; m_bDisplayItem=false; //选择变量 m_wEndIndex=INVALID_ITEM; m_wStartIndex=INVALID_ITEM; //扑克数据 m_wCardCount=0; ZeroMemory(m_CardItemArray,sizeof(m_CardItemArray)); //位置变量 m_YCollocateMode=enYTop; m_XCollocateMode=enXLeft; m_BenchmarkPos.SetPoint(0,0); //间隔变量 m_nXDistance=(m_bSmallMode==false)?DEF_X_DISTANCE:DEF_X_DISTANCE_SMALL; m_nYDistance=(m_bSmallMode==false)?DEF_Y_DISTANCE:DEF_Y_DISTANCE_SMALL; m_nShootDistance=(m_bSmallMode==false)?DEF_SHOOT_DISTANCE:DEF_SHOOT_DISTANCE_SMALL; //加载资源 HINSTANCE hResInstance=AfxGetInstanceHandle(); m_ImageCard.SetLoadInfo((m_bSmallMode==false)?IDB_GAME_CARD:IDB_GAME_CARD_SMALL,hResInstance); //获取大小 CImageHandle HandleCard(&m_ImageCard); m_CardSize.SetSize(m_ImageCard.GetWidth()/13,m_ImageCard.GetHeight()/5); return; }
//绘画界面 void CGameClientView::DrawGameView(CDC * pDC, int nWidth, int nHeight) { //绘画背景 DrawViewImage(pDC,m_ImageViewCenter,enMode_Spread); DrawViewImage(pDC,m_ImageViewBack,enMode_Centent); //绘画用户 for (WORD i=0;i<GAME_PLAYER;i++) { //变量定义 WORD wUserTimer=GetUserTimer(i); const tagUserData * pUserData=GetUserInfo(i); #ifdef _DEBUG ////测试代码 //tagUserData Obj; //Obj.cbUserStatus = US_READY; //Obj.lScore = 999999999; //_sntprintf( Obj.szName,sizeof(Obj.szName),TEXT("用户的名字")); //wUserTimer = i+1; //pUserData = &Obj; ////庄家标志 //CImageHandle ImageHandleBanker(&m_ImageBanker); //m_ImageBanker.AlphaDrawImage(pDC,m_PointBanker[i].x,m_PointBanker[i].y,m_ImageBanker.GetWidth(),m_ImageBanker.GetHeight(),0,0,RGB(255,0,255)); #endif //绘画用户 if (pUserData!=NULL) { //用户名字 pDC->SetTextAlign((i==1)?TA_RIGHT:TA_LEFT); pDC->SetTextColor((wUserTimer>0)?RGB(250,250,250):RGB(220,220,220)); //用户金币 TCHAR szBuffer[64]=TEXT(""); LONGLONG lLeaveScore=pUserData->lScore-m_lTableScore[i]; _snprintf(szBuffer,sizeof(szBuffer),TEXT(" [%s]"/*"[¥%I64d]"*/),/*lLeaveScore*/NumToString(lLeaveScore)); int TempX=0; int TempY=0; if(i%2==1) { TempX=35; if(i==3)TempX*=-1; TempY=30; } //获取用户名长度 CSize szStr; int iLen=lstrlen(pUserData->szName); GetTextExtentPoint(pDC->GetSafeHdc(), pUserData->szName, iLen, &szStr); //用户名字 DrawTextString(pDC,pUserData->szName,RGB(255,255,255),RGB(0,0,0),m_ptName[i].x-60,m_ptName[i].y+TempY); //用户金币 DrawTextString(pDC,szBuffer,RGB(230,215,90),RGB(0,0,0),m_ptName[i].x-60+szStr.cx,m_ptName[i].y+TempY); //其他信息 if (wUserTimer!=0) { //if(m_bCallUser!=0xff)DrawUserTimer(pDC,m_ptTimer[i].x,m_ptTimer[i].y,wUserTimer); //else if (pUserData->cbUserStatus==US_PLAY) //if(pUserData->cbUserStatus<=US_SIT/*GS_FREE*/) if (wUserTimer<60) DrawUserTimer(pDC,nWidth/2,nHeight/2-25,wUserTimer); else { DrawUserTimer(pDC,nWidth/2,nHeight/2-25,0); } //else DrawUserTimer(pDC,m_ptTimer[i].x,m_ptTimer[i].y,wUserTimer); } if (pUserData->cbUserStatus==US_READY) { //DrawUserReady(pDC,m_ptReady[i].x,m_ptReady[i].y); m_pngNiuNum.DrawImage(pDC, m_ptReady[i].x,m_ptReady[i].y, m_pngNiuNum.GetWidth()/13, m_pngNiuNum.GetHeight(), (m_pngNiuNum.GetWidth()/13)*11, 0); } //DrawUserFace(pDC,pUserData,m_ptFace[i].x,m_ptFace[i].y,pUserData->cbUserStatus==US_OFFLINE,32,32); } } //等待下注 if (m_bInvest==true) { //创建资源 // CFont InfoFont; // InfoFont.CreateFont(-24,0,0,0,700,0,0,0,134,3,2,1,1,TEXT("楷体_GB2312")); // // //设置 DC // pDC->SetTextAlign(TA_CENTER|TA_TOP); // CFont * pOldFont=pDC->SelectObject(&InfoFont); // // //绘画信息 // TCHAR zsInfo[128]=TEXT(""); // _sntprintf(zsInfo,sizeof(zsInfo),TEXT("等待闲家下注")); // DrawTextString(pDC,zsInfo,RGB(250,200,40),RGB(0,0,0),nWidth/2,nHeight/2); // // //清理资源 // pDC->SelectObject(pOldFont); // InfoFont.DeleteObject(); int x = (nWidth-m_pngWaitBet.GetWidth())/2; m_pngWaitBet.DrawImage(pDC, x, nHeight/2); } //特殊牌型 if (m_bUserAction==true) { //创建资源 CFont InfoFont; InfoFont.CreateFont(-16,0,0,0,700,0,0,0,134,3,2,1,1,TEXT("楷体_GB2312")); //设置 DC pDC->SetTextColor(RGB(250,200,40)); pDC->SetTextAlign(TA_CENTER|TA_TOP); CFont * pOldFont=pDC->SelectObject(&InfoFont); //绘画信息 pDC->TextOut(nWidth/2,nHeight/2+150,"特殊牌型,系统自动为你配牌 ^-^"); //清理资源 pDC->SelectObject(pOldFont); InfoFont.DeleteObject(); } //等待摊牌 if (m_bOpenCard==true) { // //创建资源 // CFont InfoFont; // InfoFont.CreateFont(-24,0,0,0,700,0,0,0,134,3,2,1,1,TEXT("楷体_GB2312")); // // //设置 DC // pDC->SetTextColor(RGB(250,200,40)); // pDC->SetTextAlign(TA_CENTER|TA_TOP); // CFont * pOldFont=pDC->SelectObject(&InfoFont); // // //绘画信息 // TCHAR zsInfo[128]=TEXT(""); // _sntprintf(zsInfo,sizeof(zsInfo),TEXT("等待玩家摊牌")); // DrawTextString(pDC,zsInfo,RGB(250,200,40),RGB(0,0,0),nWidth/2,nHeight/2); // // //清理资源 // pDC->SelectObject(pOldFont); // InfoFont.DeleteObject(); } //等待叫庄 if(m_bCallUser!=0xff && (m_bCallUser!=2 || m_bLookOnUser)) { CImageHandle HandleOx(&m_ImageWaitCall); int y=m_SendEndingPos[m_bCallUser].y+10; int x=nWidth/2 - m_ImageWaitCall.GetWidth()/2; if(m_bCallUser==1)x=nWidth/2+273-120; else if(m_bCallUser==3)x=nWidth/2-273-30; else if(m_bCallUser==0)y+=30; // m_ImageWaitCall.AlphaDrawImage(pDC,x,y,m_ImageWaitCall.GetWidth(), // m_ImageWaitCall.GetHeight(),0,0,RGB(255,0,255)); m_pngWaitCall.DrawImage(pDC, x,y); } //庄家信息 if (m_wBankerUser!=INVALID_CHAIR) { const tagUserData * pUserData=GetUserInfo(m_wBankerUser); if (pUserData!=NULL) { //庄家标志 //CImageHandle ImageHandleBanker(&m_ImageBanker); //m_ImageBanker.AlphaDrawImage(pDC,m_PointBanker[m_wBankerUser].x,m_PointBanker[m_wBankerUser].y,m_ImageBanker.GetWidth(),m_ImageBanker.GetHeight(),0,0,RGB(255,0,255)); m_pngBanker.DrawImage(pDC, m_PointBanker[m_wBankerUser].x,m_PointBanker[m_wBankerUser].y); } } //绘画积分 for (BYTE i=0;i<GAME_PLAYER;i++) { const tagUserData * pUserData=GetUserInfo(i); if (pUserData!=NULL &&(m_lTableScore[i]!=0L || m_bShowSocre[i])) { int iPos=1; if(m_bShowSocre[i]) { if(m_lTableScore[i]>0L)iPos=0; else if(m_lTableScore[i]<=0L)iPos=2; } CImageHandle HandleScore(&m_ImageScore); m_ImageScore.AlphaDrawImage(pDC,m_ptJeton[i].x,m_ptJeton[i].y,m_ImageScore.GetWidth()/3, m_ImageScore.GetHeight(),m_ImageScore.GetWidth()/3*iPos,0,RGB(255,0,255)); //创建字体 CFont ViewFont; ViewFont.CreateFont(-16,0,0,0,700,0,0,0,134,3,2,1,1,TEXT("宋体")); //设置 DC //pDC->SetTextAlign(TA_CENTER); pDC->SetTextAlign(TA_LEFT); CFont * pOldFont=pDC->SelectObject(&ViewFont); //绘画信息 TCHAR tc[NAME_LEN]=TEXT(""); _sntprintf(tc,sizeof(tc),TEXT("%I64d"),m_lTableScore[i]); //nWidth/2,nHeight/2 //DrawTextString(pDC,tc,RGB(247,231,8),RGB(255,255,255),nWidth/2+10,m_ptJeton[i].y+15); CRect rcScore; rcScore.left = m_ptJeton[i].x-50; rcScore.top = m_ptJeton[i].y; rcScore.bottom = rcScore.top+m_ImageScore.GetHeight(); rcScore.right = rcScore.left + m_ImageScore.GetWidth()/3+100; //DrawTextString(pDC, tc, RGB(247,231,8),RGB(255,255,255), rcScore); pDC->SetTextColor(RGB(247,231,8)); pDC->DrawText(tc,lstrlen(tc),&rcScore,DT_VCENTER|DT_CENTER|DT_SINGLELINE|DT_END_ELLIPSIS); //pDC->Draw3dRect(rcScore, RGB(255,255,255),RGB(255,255,255)); //清理资源 pDC->SelectObject(pOldFont); ViewFont.DeleteObject(); } } //显示摊牌标志 for (BYTE i=0;i<GAME_PLAYER;i++) { if (m_bOpenCardUser[i]==TRUE) { //创建字体 CFont ViewFont; ViewFont.CreateFont(-20,0,0,0,700,0,0,0,134,3,2,1,1,TEXT("华文彩云")); //设置 DC pDC->SetTextAlign(TA_LEFT); CFont * pOldFont=pDC->SelectObject(&ViewFont); //绘画信息 // TCHAR tc[NAME_LEN]=TEXT(""); // _snprintf(tc,sizeof(tc),"摊"); INT x,y; if(i==0) { x = m_ptJeton[i].x+20; y = m_ptJeton[i].y+40; } else if(i==1) { x = m_ptJeton[i].x+97; y = m_ptJeton[i].y-55; } else if(i==2) { x =m_ptJeton[i].x+20; y = m_ptJeton[i].y-60; } else { x = m_ptJeton[i].x-37; y = m_ptJeton[i].y-55; } //DrawTextString(pDC,tc,RGB(250,128,56),RGB(0,0,0),x,y); m_pngNiuNum.DrawImage(pDC, x, y, m_pngNiuNum.GetWidth()/13, m_pngNiuNum.GetHeight(), (m_pngNiuNum.GetWidth()/13)*12, 0); //清理资源 pDC->SelectObject(pOldFont); ViewFont.DeleteObject(); } } //绘画扑克 if (m_SendCardItemArray.GetCount()>0) { //变量定义 CImageHandle HandleCard(&m_ImageCard); tagSendCardItem * pSendCardItem=&m_SendCardItemArray[0]; //获取大小 int nItemWidth=m_ImageCard.GetWidth()/13; int nItemHeight=m_ImageCard.GetHeight()/5; //绘画扑克 int nXPos=m_SendCardPos.x-nItemWidth/2; int nYPos=m_SendCardPos.y-nItemHeight/2+10; m_ImageCard.AlphaDrawImage(pDC,nXPos,nYPos,nItemWidth,nItemHeight,nItemWidth*2,nItemHeight*4,RGB(255,0,255)); } //显示点数 for (WORD i=0;i<GAME_PLAYER;i++) { if(m_bOxValue[i]!=0xff) //if((m_bOxValue[i]=OX_THREE_SAME) || true) { if(m_bShow || i==2) { INT nxSp = m_pngNiuNum.GetWidth()/13; if(m_bOxValue[i]!=0) { CImageHandle HandleOxValue(&m_ImageOxValue); INT nXpt = (i%2!=0)?(m_ptValue[i].x-80):(m_CardControl[i].GetCardPos().x-2-m_pngNiuNum.GetWidth()/13); INT nypt = m_ptValue[i].y; // m_ImageOxValue.AlphaDrawImage(pDC,nXpt,nypt, // m_ImageOxValue.GetWidth(),m_ImageOxValue.GetHeight(),0,0,RGB(255,0,255)); if(m_bOxValue[i]>=OX_THREE_SAME) { pDC->SetTextColor(RGB(0,0,0)); pDC->SetTextAlign(TA_LEFT); TCHAR tCh[64]= {0}; _snprintf(tCh, 64, TEXT("花牛")); if(m_bOxValue[i]==OX_THREE_SAME)_sntprintf(tCh,64,TEXT("葫芦")); else if(m_bOxValue[i]==OX_FOUR_SAME)_sntprintf(tCh,64,TEXT("炸弹")); pDC->TextOut(nXpt+33,nypt+10,tCh,lstrlen(tCh)); } else if(m_bOxValue[i]==10) { // CImageHandle HandleDoulbeOx(&m_ImageDoulbeOx); // m_ImageDoulbeOx.AlphaDrawImage(pDC,nXpt+33,nypt+6, // m_ImageDoulbeOx.GetWidth(),m_ImageDoulbeOx.GetHeight(),0,0,RGB(255,0,255)); INT nXpt = m_ptValue[i].x; INT nypt = m_ptValue[i].y; m_pngNiuNum.DrawImage(pDC, nXpt-((i!=1)?30:5), nypt+1, nxSp, m_pngNiuNum.GetHeight(), nxSp*10, 0); } else if(m_bOxValue[i]<10) { // CImageHandle HandleNumber(&m_ImageNumber); // m_ImageNumber.AlphaDrawImage(pDC,nXpt+35,nypt+7, // m_ImageNumber.GetWidth()/9,m_ImageNumber.GetHeight(), // m_ImageNumber.GetWidth()/9*((int)m_bOxValue[i]-1),0,RGB(255,0,255)); m_pngNiuNum.DrawImage(pDC, nXpt, nypt+6, nxSp, m_pngNiuNum.GetHeight(), nxSp*((int)m_bOxValue[i]), 0); } } else if(m_bOxValue[i]==0) { INT nXpt = m_ptValue[i].x; INT nypt = m_ptValue[i].y; // CImageHandle HandleOxValueZero(&m_ImageOxValueZero); // m_ImageOxValueZero.AlphaDrawImage(pDC,nXpt+((i!=1)?31:5),nypt+1, // m_ImageOxValueZero.GetWidth(),m_ImageOxValueZero.GetHeight(),0,0,RGB(255,0,255)); m_pngNiuNum.DrawImage(pDC ,nXpt-((i!=1)?30:5), nypt+1, nxSp, m_pngNiuNum.GetHeight(), 0, 0); } } } } return; }
//绘画界面 void CGameClientView::DrawGameView(CDC * pDC, int nWidth, int nHeight) { //绘画背景 DrawViewImage(pDC,m_ImageViewFill,enMode_Spread); DrawViewImage(pDC,m_ImageViewBack,enMode_Centent); //绘画用户 TCHAR szBuffer[64]=TEXT(""); for (WORD i=0;i<GAME_PLAYER;i++) { //变量定义 WORD wUserTimer=GetUserTimer(i); const tagUserData * pUserData=GetUserInfo(i); //test //WORD wUserTimer = 30; //tagUserData *pUserData = new tagUserData; //lstrcpy(pUserData->szName,TEXT("测试玩家")); //pUserData->lScore = 10000L; //pUserData->cbUserStatus = US_READY; //绘画用户 if (pUserData!=NULL) { //用户名字 pDC->SetTextAlign(((i==0)||(i==1))?TA_RIGHT:TA_LEFT); DrawTextString(pDC,pUserData->szName,RGB(255,255,255),RGB(0,0,0),m_ptName[i].x,m_ptName[i].y); //用户金币 LONG lLeaveScore=pUserData->lScore-((pUserData->cbUserStatus==US_PLAY)?m_lTableScore[i]:0); _snprintf(szBuffer,CountArray(szBuffer),TEXT("%ld"),lLeaveScore); DrawTextString(pDC,szBuffer,RGB(255,255,255),RGB(0,0,0),m_ptName[i].x,m_ptName[i].y+16); //当前下注 if( m_lTableScore[i] > 0L ) { if( i == 2 ) pDC->SetTextAlign(TA_RIGHT); _snprintf(szBuffer,CountArray(szBuffer),TEXT("已下注%ld"),m_lTableScore[i]); DrawTextString(pDC,szBuffer,RGB(255,255,255),RGB(0,0,0),m_ptTableScore[i].x,m_ptTableScore[i].y); } //其他信息 if (wUserTimer!=0) DrawUserTimer(pDC,m_ptTimer[i].x,m_ptTimer[i].y,wUserTimer); if (pUserData->cbUserStatus==US_READY) DrawUserReady(pDC,m_ptReady[i].x,m_ptReady[i].y); DrawUserFace(pDC,pUserData,m_ptFace[i].x,m_ptFace[i].y,pUserData->cbUserStatus==US_OFFLINE); } //delete pUserData; //玩家筹码 m_PlayerJeton[i].DrawJettonControl(pDC); //筹码数字 LONG lJetonScore = m_PlayerJeton[i].GetScore(); if( lJetonScore > 0L ) { CPoint pt = m_PlayerJeton[i].GetBenchmarkPos(); CRect rcDraw(pt.x-50,pt.y+15,pt.x+50,pt.y+27); _snprintf(szBuffer,CountArray(szBuffer),TEXT("%ld"),lJetonScore); pDC->SetTextAlign(TA_LEFT); DrawTextString(pDC,szBuffer,RGB(255,255,85),RGB(0,0,0),&rcDraw); } } m_PlayerJeton[GAME_PLAYER].DrawJettonControl(pDC); //绘画扑克 if (m_SendCardItemArray.GetCount()>0) { //变量定义 CImageHandle HandleCard(&m_ImageCard); tagSendCardItem * pSendCardItem=&m_SendCardItemArray[0]; //获取大小 int nItemWidth=m_ImageCard.GetWidth()/13; int nItemHeight=m_ImageCard.GetHeight()/5; //绘画扑克 m_ImageCard.AlphaDrawImage(pDC,m_SendCardCurPos.x,m_SendCardCurPos.y,nItemWidth,nItemHeight,nItemWidth*2,nItemHeight*4,RGB(255,0,255)); } //test //CImageHandle HandleCard(&m_ImageCard); //m_ImageCard.AlphaDrawImage(pDC,m_SendCardPos.x,m_SendCardPos.y,m_ImageCard.GetWidth()/13,m_ImageCard.GetHeight()/5, // m_ImageCard.GetWidth()/13*2,m_ImageCard.GetHeight()/5*4,RGB(255,0,255)); INT nNumberWidth = m_PngNumber.GetWidth()/10; INT nNumberHeight = m_PngNumber.GetHeight(); //底注信息 if( m_lCellScore > 0L ) { INT nXPos; INT nYPos = nHeight/2-325; int nCellCount = 0; BYTE byCell[10]; LONG lCellScore = m_lCellScore; while( lCellScore > 0L ) { byCell[nCellCount++] = (BYTE)(lCellScore-lCellScore/10*10); lCellScore /= 10; if( nCellCount == 10 ) break; } nXPos = nWidth/2-200-nCellCount*nNumberWidth/2; for( int j = nCellCount-1; j >= 0; j-- ) { m_PngNumber.DrawImage(pDC,nXPos,nYPos,nNumberWidth,nNumberHeight,byCell[j]*nNumberWidth,0); nXPos += nNumberWidth; } } //计算总注 LONG lTableScore=0L; //注:包括正在下注在内 for(int i = 0; i < GAME_PLAYER; i++ ) lTableScore += m_PlayerJeton[i].GetScore(); lTableScore+=m_PlayerJeton[GAME_PLAYER].GetScore(); //test //lTableScore = 1234567L; //总注信息 if (lTableScore>0L) { INT nXPos = nWidth/2+18; INT nYPos = nHeight/2-295; int nCellCount = 0; BYTE byCell[10]; while( lTableScore > 0L ) { byCell[nCellCount++] = (BYTE)(lTableScore-lTableScore/10*10); lTableScore /= 10; if( nCellCount == 10 ) break; } for( int j = nCellCount-1; j >= 0; j-- ) { m_PngNumber.DrawImage(pDC,nXPos,nYPos,nNumberWidth,nNumberHeight,byCell[j]*nNumberWidth,0); nXPos += nNumberWidth; } } return; }
//绘画界面 void CGameClientView::DrawGameView(CDC * pDC, int nWidth, int nHeight) { //地震效果 if(m_bFalsh) { CImageHandle ImageHandleBack(&m_ImageViewBack); int xValue=rand()%ROCK; int yValue=rand()%ROCK; if(xValue%2==0)xValue*=(-1); if(yValue%2==0)yValue*=(-1); m_ImageViewBack.AlphaDrawImage(pDC,(nWidth/2-512)+xValue,(nHeight/2-397)+yValue, m_ImageViewBack.GetWidth(),m_ImageViewBack.GetHeight(),0,0,RGB(255,0,255)); } else { CImageHandle ImageHandleBack(&m_ImageViewBack); m_ImageViewBack.AlphaDrawImage(pDC,(nWidth/2-512+6),(nHeight/2-383), m_ImageViewBack.GetWidth(),m_ImageViewBack.GetHeight(),0,0,RGB(255,0,255)); //绘画背景 //DrawViewImage(pDC,m_ImageViewCenter,enMode_Spread);//用于最大化窗口 //DrawViewImage(pDC,m_ImageViewBack,enMode_Centent); } if(!m_bStopDraw) { //绘画用户 for (WORD i=0;i<GAME_PLAYER;i++) { //变量定义 WORD wUserTimer=GetUserTimer(i); const tagUserData * pUserData=GetUserInfo(i); #ifdef _DEBUG ////测试代码 //tagUserData Obj; //Obj.cbGender = 1; //_sntprintf(Obj.szName,sizeof(Obj.szName),TEXT("用户的名字")); //Obj.cbUserStatus=US_READY; ////Obj.wFaceID = 2; //pUserData = &Obj; ////庄家标志 //CImageHandle ImageHandleBanker(&m_ImageBanker); //m_ImageBanker.AlphaDrawImage(pDC,m_PointBanker[i].x,m_PointBanker[i].y,m_ImageBanker.GetWidth(),m_ImageBanker.GetHeight(),0,0,RGB(255,0,255)); #endif //绘画用户 if (pUserData!=NULL) { //用户名字 pDC->SetTextAlign(TA_CENTER); pDC->SetTextColor((wUserTimer>0)?RGB(250,250,250):RGB(220,220,220)); DrawTextString(pDC,pUserData->szName,RGB(255,255,255),RGB(0,0,0),m_ptFace[i].x+15,m_ptFace[i].y+35); //用户金币 TCHAR szBuffer[64]=TEXT(""); LONG lLeaveScore=pUserData->lScore-((m_ScoreView.IsWindowVisible()==TRUE)?(0):(m_lTableScore[i]));//; if(m_lStopUpdataScore[i]>0)lLeaveScore=m_lStopUpdataScore[i]-m_lTableScore[i]; _snprintf(szBuffer,sizeof(szBuffer),TEXT("¥%ld"),lLeaveScore); DrawTextString(pDC,szBuffer,RGB(255,255,255),RGB(0,0,0),m_ptFace[i].x+10,m_ptFace[i].y+48); //其他信息 //wUserTimer =1; if (wUserTimer!=0) { if(m_CardControl[MY_SELF_CHAIRID].GetCardCount()==0) DrawUserTimer(pDC,m_ptFace[i].x+m_nXFace/2,m_ptTimer[i].y+90,wUserTimer); else DrawUserTimer(pDC,m_ptTimer[i].x,m_ptTimer[i].y,wUserTimer); } //准备标志 if (pUserData->cbUserStatus==US_READY) { DrawUserReady(pDC,m_ptReady[i].x,m_ptReady[i].y); } DrawUserFace(pDC,pUserData,m_ptFace[i].x,m_ptFace[i].y,pUserData->cbUserStatus==US_OFFLINE); } } //计算总注 LONG lTableScore=0L; for (WORD i=0;i<GAME_PLAYER;i++) lTableScore+=m_lTableScore[i]; //总注信息 if (lTableScore>0L) { CImageHandle ImageHandle3(&m_ImageNumber); int iCount=0; LONG lCell[11]; ZeroMemory(lCell,sizeof(lCell)); while(lTableScore>0L) { LONG lScore=lTableScore%10; lCell[iCount++] = lScore; lTableScore=lTableScore/10; } int iTemp=0; int iX=m_ImageNumber.GetWidth(); for (int i=iCount-1;i>=0;i--) { m_ImageNumber.AlphaDrawImage(pDC,nWidth/2+39+(iX/10)*(iTemp++),nHeight/2-296, iX/10,m_ImageNumber.GetHeight(),iX/10*lCell[i],0,RGB(255,0,255)); } } //庄家信息 if (m_wBankerUser!=INVALID_CHAIR) { //庄家标志 CImageHandle ImageHandleBanker(&m_ImageBanker); m_ImageBanker.AlphaDrawImage(pDC,m_PointBanker[m_wBankerUser].x,m_PointBanker[m_wBankerUser].y,m_ImageBanker.GetWidth(),m_ImageBanker.GetHeight(),0,0,RGB(255,0,255)); } //不存在个数 for (BYTE i=0;i<GAME_PLAYER;i++) { //绘画判断 //m_lCurrentScore[i] = 100000; if (m_lCurrentScore[i]==0L) continue; LONG lTemp=m_lCurrentScore[i]; LONG lTimes[]={10,20,50,100,200,500,1000,2000,5000,10000,20000,50000,100000,200000,500000}; for (BYTE k=CountArray(lTimes)-1;;k--) { if(lTemp>=lTimes[k]) { //绘画信息 tagGoldMes tagTemp; tagTemp.lDrawCount = (lTemp/lTimes[k]); tagTemp.lGoldType = k; m_lDrawGold[i].Add(tagTemp); while((tagTemp.lDrawCount--)>0) { //随机位置 int xTemp=rand(); int yTemp=rand(); int bRandX=nWidth/2-25+xTemp%60*((xTemp%2==0)?1:(-1)); int bRandY=nHeight/2-70+yTemp%60*((yTemp%2==0)?1:(-1)); //保存随机位置 CPoint ptTemp; ptTemp.SetPoint(bRandX,bRandY); m_ptKeepJeton[i].Add(ptTemp); } lTemp%=lTimes[k]; if(lTemp==0)break; } } m_lCurrentScore[i]=0L; } //绘画筹码 for (BYTE i=0;i<GAME_PLAYER;i++) { //m_lTableScore[i] = 100000; if (m_lTableScore[i]==0L ) continue; CImageHandle HandleJeton(&m_ImageJeton); //固定位置输出 int Count=0; for(int j=0;j<(m_lDrawGold[i].GetCount());j++) { LONG lDrawCount = m_lDrawGold[i].GetAt(j).lDrawCount; while((lDrawCount--)>0) { CPoint cpTemp=m_ptKeepJeton[i].GetAt(Count++); m_ImageJeton.AlphaDrawImage(pDC,cpTemp.x,cpTemp.y,m_ImageJeton.GetWidth()/15, m_ImageJeton.GetHeight(),m_ImageJeton.GetWidth()/15*(m_lDrawGold[i].GetAt(j).lGoldType),0,RGB(255,0,255)); if(Count==100)break; } if(Count==100)break; } //绘画数目 TCHAR szBuffer[64]; _snprintf(szBuffer,CountArray(szBuffer),TEXT("$:%ld"),m_lTableScore[i]); //计算位置 CRect rcDrawRect; rcDrawRect.top=m_CardControl[i].GetCardPos().y; rcDrawRect.left=m_CardControl[i].GetCardPos().x+((i>2)?(135):(-50)); rcDrawRect.right=rcDrawRect.left+30; rcDrawRect.bottom=rcDrawRect.top+12; //创建字体 CFont ViewFont; ViewFont.CreateFont(-14,0,0,0,700,0,0,0,134,3,2,1,2,TEXT("宋体")); //设置字体 CFont * pOldFont=pDC->SelectObject(&ViewFont); //绘画数目 pDC->SetTextAlign(TA_LEFT); pDC->SetTextColor(RGB(250,200,40)); pDC->DrawText(szBuffer,lstrlen(szBuffer),&rcDrawRect,DT_CENTER|DT_VCENTER|DT_NOCLIP|DT_SINGLELINE); //清理字体 pDC->SelectObject(pOldFont); } //绘画信息 if(m_lCellScore>0) { //创建字体 CFont ViewFont; ViewFont.CreateFont(-12,0,0,0,700,0,0,0,134,3,2,1,2,TEXT("宋体")); //设置字体 CFont * pOldFont=pDC->SelectObject(&ViewFont); pDC->SetTextAlign(TA_LEFT); pDC->SetTextColor(RGB(0,0,0)); //计算位置 CRect rcDrawRect; //绘画数目 TCHAR szBuffer[64]; _snprintf(szBuffer,CountArray(szBuffer),TEXT("封顶:%ld"),m_lMaxCellScore); rcDrawRect.top=nHeight/2-338; rcDrawRect.left=nWidth/2-233; rcDrawRect.right=rcDrawRect.left+50; rcDrawRect.bottom=rcDrawRect.top+12; pDC->DrawText(szBuffer,lstrlen(szBuffer),&rcDrawRect,DT_CENTER|DT_VCENTER|DT_NOCLIP|DT_SINGLELINE); _snprintf(szBuffer,CountArray(szBuffer),TEXT("单注:%ld"),m_lCellScore); rcDrawRect.top=nHeight/2-318; rcDrawRect.left=nWidth/2-230; rcDrawRect.right=rcDrawRect.left+50; rcDrawRect.bottom=rcDrawRect.top+12; pDC->DrawText(szBuffer,lstrlen(szBuffer),&rcDrawRect,DT_CENTER|DT_VCENTER|DT_NOCLIP|DT_SINGLELINE); //清理字体 pDC->SelectObject(pOldFont); } //选比标志 if(m_bCompareCard) { for (int i=0;i<GAME_PLAYER;i++) { if(m_bCompareUser[i]==TRUE) { CPoint cPost=m_CardControl[i].GetCardPos(); CImageHandle ImageArrowhead(&m_ImageArrowhead); m_ImageArrowhead.AlphaDrawImage(pDC,cPost.x,cPost.y-m_ImageArrowhead.GetHeight(), m_ImageArrowhead.GetWidth(),m_ImageArrowhead.GetHeight(),0,0,RGB(255,0,255)); } } } } //发牌绘画 if (m_SendCardItemArray.GetCount()>0) { //变量定义 CImageHandle HandleCard(&m_ImageCard); tagSendCardItem * pSendCardItem=&m_SendCardItemArray[0]; //获取大小 int nItemWidth=m_ImageCard.GetWidth()/13; int nItemHeight=m_ImageCard.GetHeight()/5; //绘画扑克 int nXPos=m_SendCardPos.x-nItemWidth/2; int nYPos=m_SendCardPos.y-nItemHeight/2+10; m_ImageCard.AlphaDrawImage(pDC,nXPos,nYPos,nItemWidth,nItemHeight,nItemWidth*2,nItemHeight*4,RGB(255,0,255)); } //比牌扑克 if (m_wLoserUser!=INVALID_CHAIR) { //送牌状态 if (m_wConmareIndex<m_wConmareCount) { //绘画扑克 for (BYTE i=0;i<2;i++) { //变量定义 CPoint PointCard; CPoint PointStart=m_ptUserCard[m_wCompareChairID[i]]; //计算位置 INT nQuotiety=(i==0)?-1:1; PointCard.y=PointStart.y+(m_ptUserCompare.y-PointStart.y)*m_wConmareIndex/m_wConmareCount; PointCard.x=PointStart.x+(m_ptUserCompare.x-PointStart.x+COMPARE_RADII*nQuotiety)*m_wConmareIndex/m_wConmareCount; //绘画扑克 DrawCompareCard(pDC,PointCard.x,PointCard.y,false); } } //比牌状态 if ((m_wConmareIndex>=m_wConmareCount)&&((m_wConmareIndex<m_wConmareCount+VSCARD_COUNT*VSCARD_TIME))) { //绘画扑克 for (BYTE i=0;i<2;i++) { //变量定义 CPoint PointCard; CPoint PointStart=m_ptUserCard[m_wCompareChairID[i]]; //计算位置 INT nQuotiety=(i==0)?-1:1; PointCard.y=m_ptUserCompare.y; PointCard.x=m_ptUserCompare.x+COMPARE_RADII*nQuotiety; //绘画扑克 DrawCompareCard(pDC,PointCard.x,PointCard.y,false); } //比牌标志 CSize SizeVSCard; CPngImage ImageVSCard; ImageVSCard.LoadImage(AfxGetInstanceHandle(),TEXT("VS_CARD")); SizeVSCard.SetSize(ImageVSCard.GetWidth()/VSCARD_COUNT,ImageVSCard.GetHeight()); //绘画标志 INT nImageIndex=(m_wConmareIndex-m_wConmareCount)%VSCARD_COUNT; ImageVSCard.DrawImage(pDC,m_ptUserCompare.x-SizeVSCard.cx/2,m_ptUserCompare.y-SizeVSCard.cy/2, SizeVSCard.cx,SizeVSCard.cy,nImageIndex*SizeVSCard.cx,0); //声音效果 CGameClientDlg * pGameClientDlg=CONTAINING_RECORD(this,CGameClientDlg,m_GameClientView); pGameClientDlg->PlayGameSound(AfxGetInstanceHandle(),TEXT("COMPARE_CARD")); } //回牌状态 if (m_wConmareIndex>=m_wConmareCount+VSCARD_COUNT*VSCARD_TIME) { //变量定义 WORD wConmareIndex=m_wConmareIndex-m_wConmareCount-VSCARD_COUNT*VSCARD_TIME; //绘画扑克 for (BYTE i=0;i<2;i++) { //变量定义 CPoint PointCard; CPoint PointStart=m_ptUserCard[m_wCompareChairID[i]]; //计算位置 INT nQuotiety=(i==0)?-1:1; PointCard.y=m_ptUserCompare.y+(PointStart.y-m_ptUserCompare.y)*wConmareIndex/m_wConmareCount; PointCard.x=m_ptUserCompare.x+COMPARE_RADII*nQuotiety+(PointStart.x-m_ptUserCompare.x-COMPARE_RADII*nQuotiety)*wConmareIndex/m_wConmareCount; //绘画扑克 DrawCompareCard(pDC,PointCard.x,PointCard.y,(m_wLoserUser==m_wCompareChairID[i])?true:false); } //声音效果 if(m_wConmareIndex==m_wConmareCount+VSCARD_COUNT*VSCARD_TIME) { CGameClientDlg * pGameClientDlg=CONTAINING_RECORD(this,CGameClientDlg,m_GameClientView); pGameClientDlg->PlayGameSound(AfxGetInstanceHandle(),TEXT("CENTER_SEND_CARD")); } } } //等待选择 if(m_wWaitUserChoice!=INVALID_CHAIR) { TCHAR szBuffer[64]=TEXT(""); //创建字体 CFont ViewFont; ViewFont.CreateFont(-15,0,0,0,700,0,0,0,134,3,2,1,2,TEXT("宋体")); //设置字体 CFont * pOldFont=pDC->SelectObject(&ViewFont); pDC->SetTextAlign(TA_CENTER); //输出信息 if(m_wWaitUserChoice==TRUE)_sntprintf(szBuffer,sizeof(szBuffer),TEXT("等待玩家选择比牌")); else _sntprintf(szBuffer,sizeof(szBuffer),TEXT("请选择玩家进行比牌")); DrawTextString(pDC,szBuffer,RGB(50,50,50),RGB(0,170,0),nWidth/2+10,nHeight/2+45); //清理字体 pDC->SelectObject(pOldFont); } return; }