예제 #1
0
파일: DrawSiceWnd.cpp 프로젝트: vsanth/kkj
//建立消息
int CDrawSiceWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (__super::OnCreate(lpCreateStruct)==-1) return -1;
	CImageHandle BackImageHandle(&m_ImageBack);
	SetWindowPos(NULL,0,0,m_ImageBack.GetWidth(),m_ImageBack.GetHeight(),SWP_NOZORDER|SWP_NOREPOSITION);
	return 0;
}
예제 #2
0
//初始化函数
BOOL CGameScoreWnd::OnInitDialog()
{
	__super::OnInitDialog();

	//移动窗口
	CImageHandle BackImageHandle(&m_ImageBack);
	SetWindowPos(NULL,0,0,m_ImageBack.GetWidth(),m_ImageBack.GetHeight(),SWP_NOZORDER|SWP_NOREPOSITION);

	//设置按钮
	m_btClose.SetButtonImage(IDB_BT_CLOSE,AfxGetInstanceHandle(),false);
	m_btClose.SetWindowPos(NULL,m_ImageBack.GetWidth()-25,10,0,0,SWP_NOSIZE|SWP_NOZORDER);

	return TRUE;
}
예제 #3
0
파일: DrawSiceWnd.cpp 프로젝트: vsanth/kkj
//重画函数
void CDrawSiceWnd::OnPaint()
{
	CPaintDC dc(this);

	//获取位置
	CRect rcClient;
	GetClientRect(&rcClient);

	//创建缓冲
	CDC BufferDC;
	CBitmap BufferImage;
	BufferDC.CreateCompatibleDC(&dc);
	BufferImage.CreateCompatibleBitmap(&dc,rcClient.Width(),rcClient.Height());
	BufferDC.SelectObject(&BufferImage);
	//绘画背景
	CImageHandle BackImageHandle(&m_ImageBack);
	m_ImageBack.BitBlt(BufferDC,0,0);

	if(m_bSicePos<9)
	{
		CImageHandle SiceImageFirstHandle(&m_ImageDrawSiceFirst);
		CImageHandle SiceImageSecondHandle(&m_ImageDrawSiceSecond);
		m_ImageDrawSiceFirst.AlphaDrawImage(&BufferDC,30,0,m_ImageDrawSiceFirst.GetWidth()/9,m_ImageDrawSiceFirst.GetHeight(),
			m_bSicePos*m_ImageDrawSiceFirst.GetWidth()/9,0,RGB(0,0,255));
		m_ImageDrawSiceSecond.AlphaDrawImage(&BufferDC,30,0,m_ImageDrawSiceSecond.GetWidth()/9,m_ImageDrawSiceSecond.GetHeight(),
			m_bSicePos*m_ImageDrawSiceSecond.GetWidth()/9,0,RGB(0,0,255));
	}
	else
	{
		CImageHandle SiceImageFirstUserHandle(&m_ImageDrawSiceUserFirst);
		CImageHandle SiceImageSecondUserHandle(&m_ImageDrawSiceUserSecond);
		m_ImageDrawSiceUserFirst.AlphaDrawImage(&BufferDC,30,0,m_ImageDrawSiceUserFirst.GetWidth()/9,m_ImageDrawSiceUserFirst.GetHeight(),
			m_bSicePos%9*m_ImageDrawSiceUserFirst.GetWidth()/9,0,RGB(0,0,255));
		m_ImageDrawSiceUserSecond.AlphaDrawImage(&BufferDC,30,0,m_ImageDrawSiceUserSecond.GetWidth()/9,m_ImageDrawSiceUserSecond.GetHeight(),
			m_bSicePos%9*m_ImageDrawSiceUserSecond.GetWidth()/9,0,RGB(0,0,255));
	}
	//绘画界面
	
	dc.BitBlt(0,0,rcClient.Width(),rcClient.Height(),&BufferDC,0,0,SRCCOPY);
	
	//清理资源
	BufferDC.DeleteDC();
	BufferImage.DeleteObject();

	return;
}
예제 #4
0
//重画函数
void CGameScoreWnd::OnPaint()
{
	CPaintDC dc(this);

	//绘画背景
	CImageHandle BackImageHandle(&m_ImageBack);
	m_ImageBack.BitBlt(dc,0,0);

	//设置 DC
	dc.SetBkMode(TRANSPARENT);
	dc.SelectObject(CSkinResourceManager::GetDefaultFont());

	//标题
	dc.SetTextColor(RGB(10,10,10));
	dc.TextOut(105,9,TEXT("游戏成绩单"),10);

	//变量定义
	CRect rcDraw;
	TCHAR szBuffer[64];
	dc.SetTextColor(RGB(200,200,200));

	//用户成绩
	for (int i=0;i<GAME_PLAYER;i++)
	{
		//用户名字
		rcDraw.left=40;
		rcDraw.top=79+i*33;
		rcDraw.bottom=rcDraw.top+12;
		rcDraw.right=m_ImageBack.GetWidth()/2-5;
		_snprintf(szBuffer,sizeof(szBuffer),TEXT("%ld"),m_GameScoreInfo.lScore[i]);
		dc.DrawText(m_GameScoreInfo.szUserName[i],lstrlen(m_GameScoreInfo.szUserName[i]),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE);

		//用户积分
		rcDraw.top=79+i*33;
		rcDraw.bottom=rcDraw.top+12;
		rcDraw.left=m_ImageBack.GetWidth()/2+5;
		rcDraw.right=m_ImageBack.GetWidth()-45;
		dc.DrawText(szBuffer,lstrlen(szBuffer),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
	}

	return;
}
예제 #5
0
//重画函数
void CGameScoreWnd::OnPaint()
{
	CPaintDC dc(this);
	
	//获取位置
	CRect rcClient;
	GetClientRect(&rcClient);

	//创建缓冲
	CDC BufferDC;
	CBitmap ImageBuffer;
	BufferDC.CreateCompatibleDC(&dc);
	ImageBuffer.CreateCompatibleBitmap(&dc,rcClient.Width(),rcClient.Height());
	BufferDC.SelectObject(&ImageBuffer);
	BufferDC.FillSolidRect(rcClient,RGB(24,60,104));
	//BufferDC.SetBkMode(TRANSPARENT);

	//绘画背景
	CImageHandle BackImageHandle(&m_ImageBack);
	m_ImageBack.AlphaDrawImage(&BufferDC,0,0,RGB(255,0,255));

	//设置 DC
	BufferDC.SetBkMode(TRANSPARENT);
	BufferDC.SetTextColor(RGB(255,255,255));
	BufferDC.SelectObject(CSkinResourceManager::GetDefaultFont());
	//绘画扑克
	if ((m_GameScoreInfo.cbChiHuCard & 0xF0) != 0x10)
	{
		g_CardResource.m_ImageTableBottom.DrawCardItem(&BufferDC,m_GameScoreInfo.cbChiHuCard,80,280);
	}
	else
	{
		g_CardResource.m_ImageTableBottom1.DrawCardItem(&BufferDC,m_GameScoreInfo.cbChiHuCard,80,280);
	}
	//贴主金
	g_CardResource.m_ImageTableBottom1.DrawCardItem(&BufferDC,m_GameScoreInfo.cbGoldCard,210,280);

	/////////////////////////////////
	//先统计分数为0的用户的个数,可依据其数值而区分胡牌的情况
	BYTE cbCount=0;
	for(BYTE i=0;i<GAME_PLAYER;i++)
	{
		if(m_GameScoreInfo.lScore[i]==0)
		{
			cbCount++;
		}
	}
	CFont newFont,*oldFont;
	newFont.CreatePointFont(125,"楷体_GB2312",&BufferDC);
	oldFont=BufferDC.SelectObject(&newFont);
	BufferDC.SetTextColor(RGB(253,228,139));
	BufferDC.SetBkMode(TRANSPARENT);

	CRect rcDraw;
	TCHAR strMessage[32];
	int xPoint[4]={15,115,190,250};
	//打印第一行中的用户名信息
	rcDraw.left=xPoint[0];  rcDraw.right=xPoint[1];
	rcDraw.top=50; 	 rcDraw.bottom=80;
	//游戏正常结束时打第一行中打印胡牌者姓名
	if(cbCount<2)
	{
		lstrcpyn(strMessage,m_GameScoreInfo.szUserName[m_GameScoreInfo.wWinner],CountArray(strMessage));
		BufferDC.DrawText(strMessage,lstrlen(strMessage),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);
	}
	//有人退出时打印退出者姓名
	else
	{
		BYTE OutID=255;//退出者号
		for(BYTE i=0;i<GAME_PLAYER;i++)
		{
			if(m_GameScoreInfo.lScore[i]!=0)
			{
				lstrcpyn(strMessage,m_GameScoreInfo.szUserName[i],CountArray(strMessage));
				BufferDC.DrawText(strMessage,lstrlen(strMessage),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);
			}
		}
	}
	//打印第一行中的结束信息:退出、自摸、放冲
	rcDraw.left=xPoint[1];  rcDraw.right=xPoint[2];
	switch(cbCount)
	{
	case 0:	
		_snprintf(strMessage,sizeof(strMessage),TEXT("自摸")); break;
	case 1:
		_snprintf(strMessage,sizeof(strMessage),TEXT("胡牌")); break;
	case 2:
		_snprintf(strMessage,sizeof(strMessage),TEXT("退出")); break;
	}
	BufferDC.DrawText(strMessage,lstrlen(strMessage),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);
	
	//打印第一行中的点数信息
	rcDraw.left=xPoint[2];  rcDraw.right=xPoint[3];
	sprintf(strMessage,"点数 %d",m_GameScoreInfo.lHuPoint);
	BufferDC.DrawText(strMessage,lstrlen(strMessage),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

	//打印三个用户的信息的信息
	int xPoint1[5]={15,115,190,250,365};
	for(BYTE i=0;i<GAME_PLAYER;i++)
	{
		//打印用户名字
		rcDraw.left=xPoint[0];
		rcDraw.right=xPoint[1];
		rcDraw.top=80+i*25;
		rcDraw.bottom=rcDraw.top+25;
		BufferDC.DrawText(m_GameScoreInfo.szUserName[i],lstrlen(m_GameScoreInfo.szUserName[i]),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

		//用户积分
		rcDraw.left=xPoint1[1];
		rcDraw.right=xPoint1[2];
		_snprintf(strMessage,sizeof(strMessage),TEXT("%ld"),m_GameScoreInfo.lScore[i]);
		BufferDC.DrawText(strMessage,lstrlen(strMessage),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE);

		//胡牌家
		if(m_GameScoreInfo.wWinner!=m_GameScoreInfo.wProvideUser && m_GameScoreInfo.wWinner==i)
		{
			rcDraw.left=xPoint1[2];
			rcDraw.right=xPoint1[3];
			_snprintf(strMessage,sizeof(strMessage),TEXT("胡牌"));
			BufferDC.DrawText(strMessage,lstrlen(strMessage),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);
		}
		//自摸
		if(m_GameScoreInfo.wWinner==m_GameScoreInfo.wProvideUser && m_GameScoreInfo.wWinner==i)
		{
			rcDraw.left=xPoint1[2];
			rcDraw.right=xPoint1[3];
			_snprintf(strMessage,sizeof(strMessage),TEXT("自摸"));
			BufferDC.DrawText(strMessage,lstrlen(strMessage),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);
		}
		//点炮
		if(m_GameScoreInfo.wProvideUser==i && m_GameScoreInfo.wWinner!=i)
		{
			rcDraw.left=xPoint1[2];
			rcDraw.right=xPoint1[3];
			_snprintf(strMessage,sizeof(strMessage),TEXT("放冲"));
			BufferDC.DrawText(strMessage,lstrlen(strMessage),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);
		}
		//庄
		if(m_GameScoreInfo.wBankerUser==i)
		{
			rcDraw.left=xPoint1[3];
			rcDraw.right=xPoint1[4];
			_snprintf(strMessage,sizeof(strMessage),TEXT("庄"));
			BufferDC.DrawText(strMessage,lstrlen(strMessage),&rcDraw,DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);
		}
	}

	if(cbCount<2)
	{
		//胡牌组合
		//定义画最佳组合的起始位置
		WORD xPosition = 50;
		WORD yPosition = 160;

		//绘画八个组合的扑克
		for( BYTE i=0; i<8; i++)
		{
			//根据扑克牌数据,绘画每组扑克里的扑克牌
			for (BYTE j=0; j<m_GameScoreInfo.HuCardWeave.cbCardCount[i]; j++)
			{
				//绘画扑克,普通牌
				if ((m_GameScoreInfo.HuCardWeave.cbCardData[i][j] & 0xF0) != 0x10)
				{
					g_CardResource.m_ImageTableBottom.DrawCardItem(&BufferDC,m_GameScoreInfo.HuCardWeave.cbCardData[i][j],xPosition,yPosition+j*12);
				}
				//画花牌
				else
				{
					g_CardResource.m_ImageTableBottom1.DrawCardItem(&BufferDC,m_GameScoreInfo.HuCardWeave.cbCardData[i][j],xPosition,yPosition+j*12);
				}
				//xPosition += 17;
			}
			xPosition += 25;

		}

		//画丫口值 
		for (BYTE i=0; i<2; i++)
		{
			//绘画扑克,普通牌
			if ((m_GameScoreInfo.HuCardWeave.cbYaKou[i] & 0xF0) != 0x10)
			{
				g_CardResource.m_ImageTableBottom.DrawCardItem(&BufferDC,m_GameScoreInfo.HuCardWeave.cbYaKou[i],xPosition,yPosition+i*12);
			}
			//画花牌
			else
			{
				g_CardResource.m_ImageTableBottom1.DrawCardItem(&BufferDC,m_GameScoreInfo.HuCardWeave.cbYaKou[i],xPosition,yPosition+i*12);
			}
		}
	}
	BufferDC.SelectObject(oldFont);
	//绘画界面
	dc.BitBlt(0,0,rcClient.Width(),rcClient.Height(),&BufferDC,0,0,SRCCOPY);

	//清理资源
	BufferDC.DeleteDC();
	ImageBuffer.DeleteObject();
	return;
}
예제 #6
0
//初始化函数
BOOL CDlgRuleOption::OnInitDialog()
{
	__super::OnInitDialog();

	//创建区域
	CRgn RgnImage;
	CImageHandle BackImageHandle(&m_ImageViewBack);
	m_ImageViewBack.CreateImageRegion(RgnImage,RGB(255,0,255));

	//设置窗口
	SetWindowRgn(RgnImage,TRUE);
	SetWindowPos(NULL,0,0,m_ImageViewBack.GetWidth(),m_ImageViewBack.GetHeight(),SWP_NOZORDER|SWP_NOMOVE);

	//设置窗口
	SetWindowText(TEXT("规则设置:"));
	m_Brush.CreateSolidBrush(COLOR_RULE_BACK);

	//设置控件
	HINSTANCE hResInstance=AfxGetInstanceHandle();
	m_btOk.SetButtonImage(IDB_OPTION_BT_OK,hResInstance,false);
	m_btCancel.SetButtonImage(IDB_OPTION_BT_CANCEL,hResInstance,false);

	//构造提示
	TCHAR szFastDescribe[128]=TEXT(""),szSlowDescribe[128]=TEXT("");
	_sntprintf(szFastDescribe,CountChar(szFastDescribe),TEXT("局时 %d 分钟  步时 %d 分钟  读秒 %d 秒"),
		MODE_FAST_DRAW_TIME/60L,MODE_FAST_STEP_TIME/60L,MODE_FAST_SECOND_TIME);
	_sntprintf(szSlowDescribe,CountChar(szSlowDescribe),TEXT("局时 %d 分钟  步时 %d 分钟  无读秒"),
		MODE_SLOW_DRAW_TIME/60L,MODE_SLOW_STEP_TIME/60L);

	//设置提示
	SetDlgItemText(IDC_FAST_DESCRIBE,szFastDescribe);
	SetDlgItemText(IDC_SLOW_DESCRIBE,szSlowDescribe);

	//变量定义
	TCHAR szBuffer[32]=TEXT("");
	LONG lDrawTime[]={600L,1800L,3600L},lStepTime[]={60L,180L,300L};
	LONG lRuleSecondTime[]={30L,60L,180L,300L},lRuleSecondCount[]={1L,3L,5L};

	//游戏局时
	CComboBox * pComboBox=(CComboBox *)GetDlgItem(IDC_DRAW_TIME);
	for (INT i=0;i<CountArray(lDrawTime);i++)
	{
		_sntprintf(szBuffer,CountChar(szBuffer),TEXT("%ld"),lDrawTime[i]/60L);
		pComboBox->SetItemData(pComboBox->InsertString(i,szBuffer),lDrawTime[i]/60L);
	}

	//游戏步时
	pComboBox=(CComboBox *)GetDlgItem(IDC_STEP_TIME);
	for (INT i=0;i<CountArray(lStepTime);i++)
	{
		_sntprintf(szBuffer,CountChar(szBuffer),TEXT("%ld"),lStepTime[i]/60L);
		pComboBox->SetItemData(pComboBox->InsertString(i,szBuffer),lStepTime[i]/60L);
	}

	//游戏读秒
	pComboBox=(CComboBox *)GetDlgItem(IDC_SECOND_TIME);
	for (INT i=0;i<CountArray(lRuleSecondTime);i++)
	{
		_sntprintf(szBuffer,CountChar(szBuffer),TEXT("%ld"),lRuleSecondTime[i]);
		pComboBox->SetItemData(pComboBox->InsertString(i,szBuffer),lRuleSecondTime[i]);
	}

	//更新控件
	UpdateControlStatus();

	return TRUE;
}
예제 #7
0
//重画函数
void CGameScoreWnd::OnPaint()
{
	CPaintDC dc(this);

	//获取位置
	CRect rcClient;
	GetClientRect(&rcClient);

	//创建缓冲
	CDC BufferDC;
	CBitmap ImageBuffer;
	BufferDC.CreateCompatibleDC(&dc);
	ImageBuffer.CreateCompatibleBitmap(&dc,rcClient.Width(),rcClient.Height());
	BufferDC.SelectObject(&ImageBuffer);

	//绘画背景
	CImageHandle BackImageHandle(&m_ImageBack);
	m_ImageBack.BitBlt(BufferDC,0,0);

	//设置 DC
	BufferDC.SetBkMode(TRANSPARENT);
	BufferDC.SetTextColor(RGB(230,230,230));
	BufferDC.SelectObject(CSkinAttribute::m_DefaultFont);

	//绘画扑克
	g_CardResource.m_ImageUserBottom.DrawCardItem(&BufferDC,m_GameScoreInfo.cbChiHuCard,275,71);

	//用户成绩
	CRect rcDraw;
	TCHAR szBuffer[128];
	BYTE bUserCount=0;
	BYTE bRowShow=0;

	//输出胡牌玩家 
	for(WORD i=0;i<GAME_PLAYER;i++)
	{
		bRowShow = 0;

		//过滤玩家 
		if (m_GameScoreInfo.wCardType[i]==0)
			BufferDC.SetTextColor(RGB(0,0,0));
		else
			BufferDC.SetTextColor(RGB(0,0,255));

		//用户名字
		rcDraw.left=90+i*120;
		rcDraw.right=90+i*120+120;
		rcDraw.top = 150+bRowShow*20;
		rcDraw.bottom = 150+bRowShow*20+20;
		BufferDC.DrawText(m_GameScoreInfo.szUserName[i],lstrlen(m_GameScoreInfo.szUserName[i]),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);
		
		bRowShow++;

		//输出庄家 
		if(m_GameScoreInfo.wBankerUser==i)
		{			
			rcDraw.top = 150+bRowShow*20;
			rcDraw.bottom = 150+bRowShow*20+20;
			_snprintf(szBuffer,sizeof(szBuffer),TEXT("庄家	X %d"),m_GameScoreInfo.bGoOnBankerTime);
			BufferDC.DrawText(szBuffer,lstrlen(szBuffer),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

			bRowShow++;

		}

		if(m_GameScoreInfo.wCardType[i]!=0)//胡牌玩家
		{
			//胡牌信息
			rcDraw.top = 150+bRowShow*20;
			rcDraw.bottom = 150+bRowShow*20+20;
			BufferDC.DrawText(m_GameScoreInfo.m_cHu,lstrlen(m_GameScoreInfo.m_cHu),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

			bRowShow++;
		}
		else if(m_GameScoreInfo.wProvideUser==i)//点炮玩家
		{
			rcDraw.top = 150+bRowShow*20;
			rcDraw.bottom = 150+bRowShow*20+20;
			_snprintf(szBuffer,sizeof(szBuffer),TEXT("点炮"));
			BufferDC.DrawText(szBuffer,lstrlen(szBuffer),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

			bRowShow++;

		}

		//金牌信息
		if(m_GameScoreInfo.bGoldCount[i]>0)
		{
			rcDraw.top = 150+bRowShow*20;
			rcDraw.bottom = 150+bRowShow*20+20;
			_snprintf(szBuffer,sizeof(szBuffer),TEXT("金牌	 %d 翻"),m_GameScoreInfo.bGoldCount[i]);
			BufferDC.DrawText(szBuffer,lstrlen(szBuffer),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

			bRowShow++;

		}

		//杠牌信息
		if(m_GameScoreInfo.bGangCount[i]>0)
		{
			rcDraw.top = 150+bRowShow*20;
			rcDraw.bottom = 150+bRowShow*20+20;
			_snprintf(szBuffer,sizeof(szBuffer),TEXT("杠牌	 %d 翻"),m_GameScoreInfo.bGangCount[i]);
			BufferDC.DrawText(szBuffer,lstrlen(szBuffer),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

			bRowShow++;

		}

		//花牌信息
		if(m_GameScoreInfo.bFlowerCount[i]>0)
		{
			rcDraw.top = 150+bRowShow*20;
			rcDraw.bottom = 150+bRowShow*20+20;
			_snprintf(szBuffer,sizeof(szBuffer),TEXT("花牌	 %d 翻"),m_GameScoreInfo.bFlowerCount[i]);
			BufferDC.DrawText(szBuffer,lstrlen(szBuffer),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

			bRowShow++;

		}

		//东西南北
		if(m_GameScoreInfo.bAllSidesCard[i]==true)
		{
			rcDraw.top = 150+bRowShow*20;
			rcDraw.bottom = 150+bRowShow*20+20;
			_snprintf(szBuffer,sizeof(szBuffer),TEXT("东西南北	 1 翻"));
			BufferDC.DrawText(szBuffer,lstrlen(szBuffer),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

			bRowShow++;

		}

		//梅兰竹菊
		if(m_GameScoreInfo.bAllPlantCard[i]==true)
		{
			rcDraw.top = 150+bRowShow*20;
			rcDraw.bottom = 150+bRowShow*20+20;
			_snprintf(szBuffer,sizeof(szBuffer),TEXT("梅兰竹菊	 1 翻"));
			BufferDC.DrawText(szBuffer,lstrlen(szBuffer),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

			bRowShow++;

		}

		//春夏秋冬
		if(m_GameScoreInfo.bAllSeasonCard[i]==true)
		{
			rcDraw.top = 150+bRowShow*20;
			rcDraw.bottom = 150+bRowShow*20+20;
			_snprintf(szBuffer,sizeof(szBuffer),TEXT("春夏秋冬	 1 翻"));
			BufferDC.DrawText(szBuffer,lstrlen(szBuffer),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

			bRowShow++;

		}


		//总盘数
		BYTE bTotalPan = m_GameScoreInfo.bGoldCount[i]+m_GameScoreInfo.bFlowerCount[i]+m_GameScoreInfo.bGangCount[i]+
			(m_GameScoreInfo.bAllPlantCard[i]?1:0)+(m_GameScoreInfo.bAllSeasonCard[i]?1:0)+(m_GameScoreInfo.bAllSidesCard[i]?1:0);
	
		rcDraw.top = 340;
		rcDraw.bottom =360;

		//合计
		if(m_GameScoreInfo.wCardType[i]!=0)//胡牌玩家
		{			

			LONG lScore = (bTotalPan+m_GameScoreInfo.lCellScore)*m_GameScoreInfo.bGoOnBankerTime;

			_snprintf(szBuffer,sizeof(szBuffer),TEXT("(%d翻+%d底)X%d =%d"),bTotalPan,m_GameScoreInfo.lCellScore,m_GameScoreInfo.bGoOnBankerTime,lScore);

			BufferDC.DrawText(szBuffer,lstrlen(szBuffer),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);
			
		}
		else//非胡牌玩家
		{
			_snprintf(szBuffer,sizeof(szBuffer),TEXT("%d翻"),bTotalPan);

			BufferDC.DrawText(szBuffer,lstrlen(szBuffer),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

		}

		//玩家分数

		rcDraw.top = 360;
		rcDraw.bottom = 380;

		_snprintf(szBuffer,sizeof(szBuffer),TEXT("%ld"),m_GameScoreInfo.lScore[i]);

		BufferDC.DrawText(szBuffer,lstrlen(szBuffer),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);	



	}
	/*for (int i=0;i<GAME_PLAYER;i++)
	{
		//用户名字
		rcDraw.left=25;
		rcDraw.right=125;
		rcDraw.top=125+i*25;
		rcDraw.bottom=rcDraw.top+12;
		BufferDC.DrawText(m_GameScoreInfo.szUserName[i],lstrlen(m_GameScoreInfo.szUserName[i]),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

		//用户积分
		rcDraw.left=130;
		rcDraw.right=170;
		rcDraw.top=125+i*25;
		rcDraw.bottom=rcDraw.top+12;
		_snprintf(szBuffer,sizeof(szBuffer),TEXT("%ld"),m_GameScoreInfo.lScore[i]);
		BufferDC.DrawText(szBuffer,lstrlen(szBuffer),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE);

		//用户状态
		if (m_GameScoreInfo.wCardType[i]!=0) BufferDC.TextOut(180,125+i*25,TEXT("胡牌"),4);
		else if (m_GameScoreInfo.wProvideUser==i) BufferDC.TextOut(180,125+i*25,TEXT("放炮"),4);

		//其他信息
		if (m_GameScoreInfo.wBankerUser==i) BufferDC.TextOut(228,125+i*25,TEXT("是"),2);

		if(m_GameScoreInfo.bFlowerCount[i]>0)
		{
			_snprintf(szBuffer,sizeof(szBuffer),TEXT("%d"),m_GameScoreInfo.bFlowerCount[i]);
			BufferDC.TextOut(270,125+i*25,szBuffer,lstrlen(szBuffer));
		}

		if(m_GameScoreInfo.bGoldCount[i]>0)
		{
			_snprintf(szBuffer,sizeof(szBuffer),TEXT("%d"),m_GameScoreInfo.bGoldCount[i]);
			BufferDC.TextOut(300,125+i*25,szBuffer,lstrlen(szBuffer));
		}
	}
	rcDraw.left=24;
	rcDraw.right=300;
	rcDraw.top=218;
	rcDraw.bottom=rcDraw.top+12;
	BufferDC.DrawText(m_GameScoreInfo.m_cHu,lstrlen(m_GameScoreInfo.m_cHu),&rcDraw,DT_VCENTER|DT_END_ELLIPSIS);*/

	//绘画界面
	dc.BitBlt(0,0,rcClient.Width(),rcClient.Height(),&BufferDC,0,0,SRCCOPY);

	//清理资源
	BufferDC.DeleteDC();
	ImageBuffer.DeleteObject();

	return;
}
예제 #8
0
//重画函数
void CGameScoreWnd::OnPaint()
{
	CPaintDC dc(this);

	//获取位置
	CRect rcClient;
	GetClientRect(&rcClient);

	//创建缓冲
	CDC BufferDC;
	CBitmap ImageBuffer;
	BufferDC.CreateCompatibleDC(&dc);
	ImageBuffer.CreateCompatibleBitmap(&dc,rcClient.Width(),rcClient.Height());
	BufferDC.SelectObject(&ImageBuffer);

	//绘画背景
	CImageHandle BackImageHandle(&m_ImageBack);
	m_ImageBack.BitBlt(BufferDC,0,0);

	//设置 DC
	BufferDC.SetBkMode(TRANSPARENT);
	BufferDC.SetTextColor(RGB(230,230,230));
	BufferDC.SelectObject(CSkinAttribute::m_DefaultFont);

	//绘画麻将
	g_CardResource.m_ImageUserBottom.DrawCardItem(&BufferDC,m_GameScoreInfo.cbChiHuCard,85,23);

	//用户成绩
	CRect rcDraw;
	TCHAR szBuffer[64];
	for (int i=0;i<GAME_PLAYER;i++)
	{
		//用户名字
		rcDraw.left=25;
		rcDraw.right=125;
		rcDraw.top=125+i*25;
		rcDraw.bottom=rcDraw.top+12;
		BufferDC.DrawText(m_GameScoreInfo.szUserName[i],lstrlen(m_GameScoreInfo.szUserName[i]),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);

		//用户积分
		rcDraw.left=130;
		rcDraw.right=170;
		rcDraw.top=125+i*25;
		rcDraw.bottom=rcDraw.top+12;
		_snprintf(szBuffer,sizeof(szBuffer),TEXT("%ld"),m_GameScoreInfo.lScore[i]);
		BufferDC.DrawText(szBuffer,lstrlen(szBuffer),&rcDraw,DT_CENTER|DT_VCENTER|DT_SINGLELINE);

		//用户状态
		if (m_GameScoreInfo.wCardType[i]!=0) BufferDC.TextOut(180,125+i*25,TEXT("胡牌"),4);
		else if (m_GameScoreInfo.wProvideUser==i) BufferDC.TextOut(180,125+i*25,TEXT("放炮"),4);

		//其他信息
		if (m_GameScoreInfo.wBankerUser==i) BufferDC.TextOut(228,125+i*25,TEXT("是"),2);
	}

	//绘画界面
	dc.BitBlt(0,0,rcClient.Width(),rcClient.Height(),&BufferDC,0,0,SRCCOPY);

	//清理资源
	BufferDC.DeleteDC();
	ImageBuffer.DeleteObject();

	return;
}