下载此文档

C 设计-吃豆子.doc


文档分类:生活休闲 | 页数:约19页 举报非法文档有奖
1/19
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/19 下载此文档
文档列表 文档介绍
《面向对象程序设计》
课程设计
题目: 吃豆子游戏程序
院系: 数学与计算科学学院
专业: 信息与计算科学
姓名学号: 覃荣平 1200710128(组长)
梁隆 1200710123
柳祖发 1200710124
施华官1200710127
指导老师: 宁黎华
日期: 2014 年 12 月 30 日
心得体会:
通过这次课程设计,我从对MFC的陌生到能熟练运用基本的函数,了解其编程的具体实现方法,我对于面象对向编程有了更深刻的认识,通过四个人的团队合作,我从主持谐调各方面工作,如听取各方面意见,看成员整理好的资料,到担任代码编写,学会了团队合作的重要性,团队合作在写大的程序时比单个人完成有很大的优点。我会继续在面向对象编程上下功夫,因为学无止境。
摘要
MFC是Windows编程的面向对象化,是对Windows函数的简单封装,使用MFC编程可以在短时间内编写一个Windows程序,而不必写大量Windows代码,所以我使用MFC编写了一个吃豆子程序,该程序实现了一个能过使用方向键控制消除屏幕上存在的豆子的功能,当用户按键盘向上、下、左、右键或每格一秒钟,嘴的状态发生改变,或是从一个方向张开向另一个方向,或是由张开变成闭合状态,从而实现嘴一张一合前进,当嘴所经过位置有豆子,豆子被消除而不再出现,所有豆子被“吃”完时,程序弹出对话框“You win ,Exit?”,用户点确定后可退出程序。实现方法:嘴的张开与闭合分别用MFC的Pie和Ellipse函数实现,豆子被存储在一个标记数组中,豆子被吃时数组相应元素标记为零。在OnDraw()函数中画出每个豆子和嘴的原始位置,在响应键盘上下左右方向虚拟键VK_UP、VK_DOWN、VK_LEFT、VK_RIGTH的函数中控制豆子移动和嘴的方向,程序开始时在响应WM_CREATE消息的函数中设置一个TIMER,方向键消息和TIMER消息统一由一个判断函数处理从而实现自动前进时的沿当前方向前进。
关键字:程序设计豆子 MFC
Abstract
MFC is a Windows-based object-oriented programming, it is a simple package of Windows 'function , using the MFC programming can make us write a Windows program in a short time, without having to write a lot of Windows code, so I use MFC written a eat-beans program ,in this program we can use the arrow keys to control the mouth to move to eliminating the beans on the screen, when the user presses the keyboard up, down, left, right, or each time one second goes by, the state of the mouth changed, it change from one direction to another direction, or from an opening state to a closed state. So we can obtain a mouth moving forward with it's lips keeping closing and opening, if a bean is in the way of the mouth, it will be eliminated by setting it's element in the mark array as zero. when all beans have bean eaten, a dialog box prompts: "You win, Exit?", after the user clicks OK , the game terminates. Implementation method: We can use the MFC's Pie function to draw a open mouth, while the Ellipse function to draw the closed mouth, all beans would be stored in a 2d array, if it exist ,we mark the corresponding ele

C 设计-吃豆子 来自淘豆网m.daumloan.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数19
  • 收藏数0 收藏
  • 顶次数0
  • 上传人ipod0a
  • 文件大小196 KB
  • 时间2017-12-04