首页 VC游戏实验指导书--连连看游戏

VC游戏实验指导书--连连看游戏

举报
开通vip

VC游戏实验指导书--连连看游戏VC游戏实验指导书--连连看游戏 VisualC++上机实验要求(三) 一、 上机要求与内容: a) 设计游戏的背景和图标。 b) 如何通过类(Class)设计的方法编制游戏。 c) 如何产生一个新类。 d) 如何调用类。 e) 如何设计时钟。 f) 如何取消最大化、最小化和固定游戏区域,设置区域尺寸。 g) 如何取消工具栏和状态栏。 h) 通过资源编辑器导入图片资源。 i) 实现画图片方法。DrawBmp() j) 实现鼠标消息处理方法。(OnLButtonDown()) k) 如何初始化数...

VC游戏实验指导书--连连看游戏
VC游戏实验指导书--连连看游戏 VisualC++上机实验要求(三) 一、 上机要求与内容: a) 设计 领导形象设计圆作业设计ao工艺污水处理厂设计附属工程施工组织设计清扫机器人结构设计 游戏的背景和图标。 b) 如何通过类(Class)设计的 方法 快递客服问题件处理详细方法山木方法pdf计算方法pdf华与华方法下载八字理论方法下载 编制游戏。 c) 如何产生一个新类。 d) 如何调用类。 e) 如何设计时钟。 f) 如何取消最大化、最小化和固定游戏区域,设置区域尺寸。 g) 如何取消工具栏和状态栏。 h) 通过资源编辑器导入图片资源。 i) 实现画图片方法。DrawBmp() j) 实现鼠标消息处理方法。(OnLButtonDown()) k) 如何初始化数据。(initData()) l) 如何在任何程序进行绘图。(CClientDC dc(this);) m) 如何在窗口变动时,重绘游戏界面。(OnDraw(CDC *pDC)) n) 构建简单游戏 流程 快递问题件怎么处理流程河南自建厂房流程下载关于规范招聘需求审批流程制作流程表下载邮件下载流程设计 。 二、上机指导: A( 建立单文档 工程 路基工程安全技术交底工程项目施工成本控制工程量增项单年度零星工程技术标正投影法基本原理 MyDemo B( 在MyDemoeView.h中添加公用处理变量 public: int m_no; //局数 bool m_flag ; //第一次选择图标-false, 第二次选择图标-true C( 在构造函数中对变量初始化和数据初始化: m_no = 0 ; //局数 m_flag = false ; D( 如何产生一个新类。 选择Insert/Class弹出下列对话框: 选择Generic Class/输入类名CGame(类的名字一般以C开头)/确定。 在FileView中可见到新插入的类,见下下图。 choose water fountains, water-saving products should be purchased. As compared to open v-Groove type water supply system, sealed nipple water system can save water 81.35% saving bedding consumption 56.3%; sanitation and drinking water, and a variety of harmful gases concentrations decline, increased laying rate 13.79%, economic efficiency improved. Chicken Coop construction should pay attention to several problems, chicken distribution notes: a rational structure of the hen-house layout, can provide a good environment for chicken, making its full productive potential, so other than in understanding the physiological characteristics of the chicken itself, and must be properly planned and constructed sheds. 1. sites to choose away from populated areas, traffic convenient, away from the road 2. Gaozao terrain, a lot of sunshine. Winter sun as possible, summer wind, and not after the rain water. Larger, leaving room for development 3. Abundant water resources pollution-free, easy to access, sufficient power is guaranteed 4. Building structure, the economy, saving money, and saving energy, it is facing in accordance with local environmental and physiological condition, lighting is good, easy to ventilation, easy to operate, so conducive to cooling in the summer, to insulation in winter cold 5. Layout of premises should be reasonable, do distinguish between production and non-production areas and non-production areas and water sources are on a chicken farm in the wind, net road and dirt road separating uncrossed, dung farm is located in the choose water fountains, water-saving products should be purchased. As compared to open v-Groove type water supply system, sealed nipple water system can save water 81.35% saving bedding consumption 56.3%; sanitation and drinking water, and a variety of harmful gases concentrations decline, increased laying rate 13.79%, economic efficiency improved. Chicken Coop construction should pay attention to several problems, chicken distribution notes: a rational structure of the hen-house layout, can provide a good environment for chicken, making its full productive potential, so other than in understanding the physiological characteristics of the chicken itself, and must be properly planned and constructed sheds. 1. sites to choose away from populated areas, traffic convenient, away from the road 2. Gaozao terrain, a lot of sunshine. Winter sun as possible, summer wind, and not after the rain water. Larger, leaving room for development 3. Abundant water resources pollution-free, easy to access, sufficient power is guaranteed 4. Building structure, the economy, saving money, and saving energy, it is facing in accordance with local environmental and physiological condition, lighting is good, easy to ventilation, easy to operate, so conducive to cooling in the summer, to insulation in winter cold 5. Layout of premises should be reasonable, do distinguish between production and non-production areas and non-production areas and water sources are on a chicken farm in the wind, net road and dirt road separating uncrossed, dung farm is located in the E( 如何调用类。(以在View类中调用Game类为例) 1. 在MyDemoeView.h中添加: #include "Game.h" class CMyDemoView : public CView { private : CGame *Game; //定义Game类指针 …… 2. 利用类向导添加WM_CREATE(若没添)和类初始化处理 int CMyDemoView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CView::OnCreate(lpCreateStruct) == -1) return -1; choose water fountains, water-saving products should be purchased. As compared to open v-Groove type water supply system, sealed nipple water system can save water 81.35% saving bedding consumption 56.3%; sanitation and drinking water, and a variety of harmful gases concentrations decline, increased laying rate 13.79%, economic efficiency improved. Chicken Coop construction should pay attention to several problems, chicken distribution notes: a rational structure of the hen-house layout, can provide a good environment for chicken, making its full productive potential, so other than in understanding the physiological characteristics of the chicken itself, and must be properly planned and constructed sheds. 1. sites to choose away from populated areas, traffic convenient, away from the road 2. Gaozao terrain, a lot of sunshine. Winter sun as possible, summer wind, and not after the rain water. Larger, leaving room for development 3. Abundant water resources pollution-free, easy to access, sufficient power is guaranteed 4. Building structure, the economy, saving money, and saving energy, it is facing in accordance with local environmental and physiological condition, lighting is good, easy to ventilation, easy to operate, so conducive to cooling in the summer, to insulation in winter cold 5. Layout of premises should be reasonable, do distinguish between production and non-production areas and non-production areas and water sources are on a chicken farm in the wind, net road and dirt road separating uncrossed, dung farm is located in the //初始化各个类 CDC *pDC ; pDC = new CClientDC(this) ; //申请绘图句柄 Game = new CGame(pDC) ; //申请Game类(游戏类) Game->InitData(m_no) ; //初始化第m_no局游戏 Game->SetXY(50,120) ; //设置游戏区域的左上角 …… F( 如何设计时钟 1( 利用类向导添加WM_CREATE(若没添)和初始化时钟(时钟编号0-3, 最多4个) int CMyDemoView::OnCreate(LPCREATESTRUCT lpCreateStruct) { …… SetTimer(0, 300, NULL) ; //设置时钟0 SetTimer(1, 1000, NULL) ; //设置时钟1 } 2( 利用类向导添加WM_DESTROY和删除时钟 void CMyDemoView::OnDestroy() { CView::OnDestroy(); KillTimer(0); //删除时钟0 KillTimer(1); //删除时钟1 } 3( 利用类向导添加WM_TIMER和处理时钟响应 void CMyDemoView::OnTimer(UINT nIDEvent) { switch( nIDEvent ) { case 0 : //删除时钟0 choose water fountains, water-saving products should be purchased. As compared to open v-Groove type water supply system, sealed nipple water system can save water 81.35% saving bedding consumption 56.3%; sanitation and drinking water, and a variety of harmful gases concentrations decline, increased laying rate 13.79%, economic efficiency improved. Chicken Coop construction should pay attention to several problems, chicken distribution notes: a rational structure of the hen-house layout, can provide a good environment for chicken, making its full productive potential, so other than in understanding the physiological characteristics of the chicken itself, and must be properly planned and constructed sheds. 1. sites to choose away from populated areas, traffic convenient, away from the road 2. Gaozao terrain, a lot of sunshine. Winter sun as possible, summer wind, and not after the rain water. Larger, leaving room for development 3. Abundant water resources pollution-free, easy to access, sufficient power is guaranteed 4. Building structure, the economy, saving money, and saving energy, it is facing in accordance with local environmental and physiological condition, lighting is good, easy to ventilation, easy to operate, so conducive to cooling in the summer, to insulation in winter cold 5. Layout of premises should be reasonable, do distinguish between production and non-production areas and non-production areas and water sources are on a chicken farm in the wind, net road and dirt road separating uncrossed, dung farm is located in the Progress->clear() ; //清除旧进度条 Progress->Add(-1) ; //进度条计数-1 Progress->Draw() ; //重画进度条 if (Progress->IsZero()) //若进度条为0 exit(0) ; //退出游戏 break ; case 1 : //删除时钟1 Score->clear() ; //清除旧计分 Score->Add(-10) ; //计分-10 Score->Draw() ; //重画计分 if (Progress->IsZero()) //若计分为0 exit(0) ; //退出游戏 break ; } CView::OnTimer(nIDEvent); } G( 加WM_LBUTTONDOWN和处理函数(游戏流程) void CMyDemoView::OnLButtonDown(UINT nFlags, CPoint point) { // 是否在游戏框内 if ( !Game->GetPiont(point, m_flag) ) return ; //是否已消去 if ( Game->GetNo()==0 ) return ; if ( !m_flag ) //第一次选 { Game->DrawBackBmp(0) ; //画选中框 m_flag = true ; //置第二次 } else//第二次选 { if ( Game->Equal() ) //若相同 { if ( Game->TestLine() )//有连线 { choose water fountains, water-saving products should be purchased. As compared to open v-Groove type water supply system, sealed nipple water system can save water 81.35% saving bedding consumption 56.3%; sanitation and drinking water, and a variety of harmful gases concentrations decline, increased laying rate 13.79%, economic efficiency improved. Chicken Coop construction should pay attention to several problems, chicken distribution notes: a rational structure of the hen-house layout, can provide a good environment for chicken, making its full productive potential, so other than in understanding the physiological characteristics of the chicken itself, and must be properly planned and constructed sheds. 1. sites to choose away from populated areas, traffic convenient, away from the road 2. Gaozao terrain, a lot of sunshine. Winter sun as possible, summer wind, and not after the rain water. Larger, leaving room for development 3. Abundant water resources pollution-free, easy to access, sufficient power is guaranteed 4. Building structure, the economy, saving money, and saving energy, it is facing in accordance with local environmental and physiological condition, lighting is good, easy to ventilation, easy to operate, so conducive to cooling in the summer, to insulation in winter cold 5. Layout of premises should be reasonable, do distinguish between production and non-production areas and non-production areas and water sources are on a chicken farm in the wind, net road and dirt road separating uncrossed, dung farm is located in the Game->Clear(0); //消除已画框0 Game->Clear(1); //消除已画框0 //。。。。。。 m_flag = false ;//置第一次 } else//无连线 { Game->ChangeWxy() ;//将现选择框代替原选框 } } else //不相同 { Game->ChangeWxy() ; //将现选择框代替原选框 } } CView::OnLButtonDown(nFlags, point); } H( 在OnDraw()函数中增加下列语句: (本函数在初始化、改变窗口大小、窗口最大化最小化或Invalidate() 时执行) void CMyDemoView::OnDraw(CDC* pDC) { CMyDemoDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); Background->Draw(); //绘制背景 Game->DrawAllBmp(); //绘制所有图片 Progress->Draw(); //绘制进度条 Score->Draw(); //绘制得分 } I( 取消工具栏和状态栏 J(取消最大化、最小化和固定游戏区域,设置区域尺寸。 K( 通过资源编辑器导入图片资源 L( 添加四个类:Game类(游戏类)、Score类(得分类)、Progress (进度条类)、 choose water fountains, water-saving products should be purchased. As compared to open v-Groove type water supply system, sealed nipple water system can save water 81.35% saving bedding consumption 56.3%; sanitation and drinking water, and a variety of harmful gases concentrations decline, increased laying rate 13.79%, economic efficiency improved. Chicken Coop construction should pay attention to several problems, chicken distribution notes: a rational structure of the hen-house layout, can provide a good environment for chicken, making its full productive potential, so other than in understanding the physiological characteristics of the chicken itself, and must be properly planned and constructed sheds. 1. sites to choose away from populated areas, traffic convenient, away from the road 2. Gaozao terrain, a lot of sunshine. Winter sun as possible, summer wind, and not after the rain water. Larger, leaving room for development 3. Abundant water resources pollution-free, easy to access, sufficient power is guaranteed 4. Building structure, the economy, saving money, and saving energy, it is facing in accordance with local environmental and physiological condition, lighting is good, easy to ventilation, easy to operate, so conducive to cooling in the summer, to insulation in winter cold 5. Layout of premises should be reasonable, do distinguish between production and non-production areas and non-production areas and water sources are on a chicken farm in the wind, net road and dirt road separating uncrossed, dung farm is located in the Game类:(game.h) enum {START, MIDDLE, END} ; class CGame { private : int m_xc, m_yc ; //游戏区域角点 int m_dx, m_dy ; //小图片尺寸 int m_xCount, m_yCount ; //游戏区域尺寸 int m_wx[2], m_wy[2], m_no ; //选取的二个点的(wx,wy),当前点 int m_data[16][9] ; //游戏区域的数据 int m_num ; //小图个数 CDC mem; //小图片的mem CDC *m_pDC ; //绘图句柄 public: void Swap( int *a, int *b ); //交换数据 bool Equal(){return m_data[m_wx[0]][m_wy[0]]==m_data[m_wx[1]][m_wy[1]] ; } //判断是否一样 void ChangeWxy(); //改变当前图标 bool TestLine(); //测试连线 bool TestYLine(int wx, int wy0, int wy1, int flag); //测试Y向连线 bool TestXLine(int wx0, int wx1, int wy, int flag); //测试X向连线 int Get(int row, int col, int val){ return m_data[row][col] ; } //读取当前图标 int GetNo(){return m_data[m_wx[m_no]][m_wy[m_no]]; } //读取m_no当前图标 bool GetPiont(CPoint p, int no);//坐标转换(x,y)->(wx,wy),返回是否 choose water fountains, water-saving products should be purchased. As compared to open v-Groove type water supply system, sealed nipple water system can save water 81.35% saving bedding consumption 56.3%; sanitation and drinking water, and a variety of harmful gases concentrations decline, increased laying rate 13.79%, economic efficiency improved. Chicken Coop construction should pay attention to several problems, chicken distribution notes: a rational structure of the hen-house layout, can provide a good environment for chicken, making its full productive potential, so other than in understanding the physiological characteristics of the chicken itself, and must be properly planned and constructed sheds. 1. sites to choose away from populated areas, traffic convenient, away from the road 2. Gaozao terrain, a lot of sunshine. Winter sun as possible, summer wind, and not after the rain water. Larger, leaving room for development 3. Abundant water resources pollution-free, easy to access, sufficient power is guaranteed 4. Building structure, the economy, saving money, and saving energy, it is facing in accordance with local environmental and physiological condition, lighting is good, easy to ventilation, easy to operate, so conducive to cooling in the summer, to insulation in winter cold 5. Layout of premises should be reasonable, do distinguish between production and non-production areas and non-production areas and water sources are on a chicken farm in the wind, net road and dirt road separating uncrossed, dung farm is located in the 在游戏区域内 void Init(); //图标初始化 void InitData(int no); //地图初始化 void Set(int row, int col, int val){ m_data[row][col] = val ; } //设置地图当前值 void SetXY(int x, int y){ m_xc = x ; m_yc = y ;} //设置角点 void Clear(int no); //消除第no个图标 void Mark(int row, int col); //设置选择标记 void DrawBmp(int wx, int wy, int no);//绘制图标 void DrawBackBmp(int no); //反向绘制图标 void DrawAllBmp(); //绘制所有地图 CGame(CDC *pDC); virtual ~CGame(); }; 二O一O年十一月二十八 杭州 choose water fountains, water-saving products should be purchased. As compared to open v-Groove type water supply system, sealed nipple water system can save water 81.35% saving bedding consumption 56.3%; sanitation and drinking water, and a variety of harmful gases concentrations decline, increased laying rate 13.79%, economic efficiency improved. Chicken Coop construction should pay attention to several problems, chicken distribution notes: a rational structure of the hen-house layout, can provide a good environment for chicken, making its full productive potential, so other than in understanding the physiological characteristics of the chicken itself, and must be properly planned and constructed sheds. 1. sites to choose away from populated areas, traffic convenient, away from the road 2. Gaozao terrain, a lot of sunshine. Winter sun as possible, summer wind, and not after the rain water. Larger, leaving room for development 3. Abundant water resources pollution-free, easy to access, sufficient power is guaranteed 4. Building structure, the economy, saving money, and saving energy, it is facing in accordance with local environmental and physiological condition, lighting is good, easy to ventilation, easy to operate, so conducive to cooling in the summer, to insulation in winter cold 5. Layout of premises should be reasonable, do distinguish between production and non-production areas and non-production areas and water sources are on a chicken farm in the wind, net road and dirt road separating uncrossed, dung farm is located in the
本文档为【VC游戏实验指导书--连连看游戏】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_833902
暂无简介~
格式:doc
大小:98KB
软件:Word
页数:0
分类:生活休闲
上传时间:2017-10-29
浏览量:12