资源简介
斗地主是一个很流行的游戏,如何编程实现它,这里提供一个难得的有趣的学习C++的实例!
代码片段和文件信息
// Client_Game.cpp: implementation of the CClientGame class.
//
//////////////////////////////////////////////////////////////////////
#include “stdafx.h“
#include “斗地主.h“
#include “Game.h“
#include “link.h“
#include “My_DirectInput.h“
#include “my_directdraw.h“
#include “Playing_Cards.h“
#include “Draw_Item_Engine.h“
#include “Draw_Cards_Engine.h“
#include “Client_Game.h“
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CClientGame::CClientGame()
{
}
CClientGame::~CClientGame()
{
}
//左边玩家(电脑)思考,并决定要出的牌;
int CClientGame::LeftDoing()
{
if( m_nLordLock == 0 )
{
if( m_nRoundCounter == 3 ) //说明已经出了牌;
{
//把已经出的牌回退;
if(pLeftCards->m_nDiscardingCounter != 0)
pDrawCards->LeftBacking();
if(pCenterCards->m_nDiscardingCounter != 0)
pDrawCards->CenterBacking();
if(pRightCards->m_nDiscardingCounter != 0)
pDrawCards->RightBacking();
m_nRoundCounter = 0; //新的一圈;
}
m_nRoundCounter++;
return -1;
}
if( pRightCards->m_cDiscardingType.m_nTypeNum == 0 &&
pCenterCards->m_cDiscardingType.m_nTypeNum == 0 )
{
m_nLordLock = -1;
}
//补丁调整出牌显示;
int Temp_Discarding_Counter = 0; //刚出的牌的数量;
CCard Temp_Discarding[20]; //刚出的牌;
pClientlink->Recv(Temp_Discardingsizeof(CCard)*20);
pClientlink->Recv(&Temp_Discarding_Countersizeof(int));
pClientlink->Recv(&pLeftCards->m_cDiscardingTypesizeof(CCardsType));
if( m_nRoundCounter == 3 ) //说明已经出了牌;
{
//把已经出的牌回退;
if(pLeftCards->m_nDiscardingCounter != 0)
pDrawCards->LeftBacking();
if(pCenterCards->m_nDiscardingCounter != 0)
pDrawCards->CenterBacking();
if(pRightCards->m_nDiscardingCounter != 0)
pDrawCards->RightBacking();
m_nRoundCounter = 0; //新的一圈;
}
m_nRoundCounter++;
for(int i=0;i<20;i++)
{
pLeftCards->m_cDiscarding[i] = Temp_Discarding[i];
}
pLeftCards->m_nDiscardingCounter = Temp_Discarding_Counter;
//如果出牌数大于0;
if( pLeftCards->m_cDiscardingType.m_nTypeNum == 4 )
{
m_nBombCounter++;//加分;
}
if( pLeftCards->m_cDiscardingType.m_nTypeNum != 0 )
{
pDrawCards->LeftDiscarding();
::RedrawGame();
if( pLeftCards->m_nCardsCounter == 0 )
{
//打印结束信息;
AccountScore(0);
::SetTimer(hWnd00NULL); //开始游戏;
return 0;
}
}
else
{
//打印左边玩家不要信息;
pDraw->TextGDI(“过牌!-“250200RGB(25500)400“华文新魏“lpddsprimary);
if( m_nCurrentLord == 0 )
{
m_nLordLock = 0;
}
Sleep(300);
}
return 1;
}
//中间(本机)玩家出牌;
int CClientGame::CenterDoing()
{
if( m_nLordLock == 1 )
{
if( m_nRoundCounter == 3 ) //说明已经出了牌;
{
//把已经出的牌回退;
if(pCenterCards->m_nDiscardingCounter != 0)
pDrawCards->CenterBacking();
if(pRightCards->m_nDiscardin 属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2004-06-02 15:47 斗地主\
目录 0 2004-06-10 23:41 斗地主\bmp\
目录 0 2004-06-10 23:41 斗地主\bmp\cards\
文件 112232 2004-04-17 23:04 斗地主\bmp\cards\10.bmp
文件 112232 2004-04-17 23:02 斗地主\bmp\cards\2.bmp
文件 112232 2004-04-17 23:05 斗地主\bmp\cards\3.bmp
文件 112232 2004-04-17 23:21 斗地主\bmp\cards\4.bmp
文件 112232 2004-04-17 23:24 斗地主\bmp\cards\5.bmp
文件 112232 2004-04-17 23:19 斗地主\bmp\cards\6.bmp
文件 112232 2004-04-17 23:34 斗地主\bmp\cards\7.bmp
文件 112232 2004-04-17 23:28 斗地主\bmp\cards\8.bmp
文件 112232 2004-04-17 23:31 斗地主\bmp\cards\9.bmp
文件 112232 2004-04-17 23:03 斗地主\bmp\cards\A.bmp
文件 28328 2004-06-10 15:06 斗地主\bmp\cards\card_back1.bmp
文件 112232 2004-04-21 18:02 斗地主\bmp\cards\J.bmp
文件 56144 2004-04-22 11:35 斗地主\bmp\cards\Jokers.bmp
文件 112232 2004-04-21 17:54 斗地主\bmp\cards\K.bmp
文件 112232 2004-04-17 23:08 斗地主\bmp\cards\Q.bmp
文件 111104 2004-06-10 20:31 斗地主\bmp\cards\Thumbs.db
目录 0 2004-06-10 23:41 斗地主\bmp\faces\
文件 14896 2004-05-08 19:24 斗地主\bmp\faces\face0.bmp
文件 14896 2004-05-08 20:18 斗地主\bmp\faces\face1.bmp
文件 14896 2004-05-08 20:18 斗地主\bmp\faces\face2.bmp
文件 14896 2004-05-08 20:18 斗地主\bmp\faces\face3.bmp
文件 24576 2004-05-09 01:27 斗地主\bmp\faces\Thumbs.db
文件 3145784 2004-06-10 23:37 斗地主\bmp\Game_Back.bmp
目录 0 2004-06-10 23:41 斗地主\bmp\item\
文件 135056 2004-05-14 19:42 斗地主\bmp\item\bring_lord.bmp
文件 48056 2004-05-16 17:11 斗地主\bmp\item\choose_lord.bmp
文件 17384 2004-05-14 19:47 斗地主\bmp\item\lord_fr
文件 7256 2004-05-15 02:16 斗地主\bmp\item\Ok_Button.bmp
............此处省略75个文件信息
相关资源
- 国际象棋的qt源代码
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- VC++MFC小游戏实例教程(实例)+MFC类库
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 颜色识别形状识别STM103嵌入式代码
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
- mfc 调用redis
- FTP客户端源码(c++)
- c++ 画图(14Qt-XPS)
- c++多边形交并差运算
川公网安备 51152502000135号
评论
共有 条评论