当前位置:文档之家› 基于Qt的扫雷游戏设计毕业设计论文

基于Qt的扫雷游戏设计毕业设计论文

毕业设计(论文)题目基于Qt的扫雷游戏设计系别专业班级姓名学号指导教师日期摘要扫雷游戏是一款经典的小游戏,这款游戏不仅可以让人们充分享受娱乐的目的,而且可以通过这款小游戏开发人的逻辑推理能力和判断能力。

本次毕业设计我们以Qt4.6为开发环境,设计并开发了基于Qt的扫雷游戏。

扫雷游戏主要研究以下两个方面:第一是初始化问题,包括随机产生本局游戏中的雷数,雷的分布对于每个小区域如何获得周围地区分布的雷数等等。

第二就是对鼠标事件的处理,即在游戏过程中对鼠标事件应如何做出反应。

本论文以Qt作为开发软件,首先使用信号与槽的方法实现菜单、工具栏的功能,其次又以MousePressEvent鼠标事件发出信息来了解使用者的意图,进而做出相对应的动作,再次介绍了清除地雷区方块的方法,通过递归程序的编写,在程序代码上会变得相当简洁。

最后利用布局管理组(Layouts)进行整体布局。

使用C++语言设计完成了扫雷游戏的初始化界面,实现了扫雷游戏的计时、重新开始、难度设置、排行榜、帮助等功能。

还增加了游戏在成败时弹出对话框等功能。

总的来说本次设计在功能上已经基本达到预期的要求。

但还有一些不足,比如扫雷游戏设计还可以添加一些背景音乐、背景图片、视频等功能,更能增加人们的娱乐性。

关键词:扫雷游戏;Qt;C++ABSTRACTMinesweeper game is a classic game, the game can not only allow people to fully enjoy the entertainment purposes, and by this small game development logical reasoning ability and judgment. The graduation project to Qt4.6 development environment, design and development of Qt-based game of Minesweeper.The minesweeper game the following two aspects:The first is the initialization problems, including randomly generated number of Council Game Ray Ray distribution for each small area how to get around the geographical distribution of Ray.The second is the processing of mouse events, mouse events in the course of the game how to react.In this thesis, QT signals and slots as the development of software, the first to use the method to achieve the functionality of the menus, toolbars, followed Youyi mousePressEvent mouse events issued information to understand the user's intent, and then make a corresponding action, again introduced a clear Minefields box by recursive program code will become quite simple. Finally, the the layout management group (Layouts) overall layout.Completed minesweeping games initialization interface design, to achieve a mine-sweeping game of timing, start again, difficulty settings, rankings, help functions using the C language. Game in the success or failure of the pop-up dialog box. Overall, the design function has basically reached the expected requirements. But there are some disadvantages, such as minesweeping game design can also add some background music, background image, video, and can help increase people's entertainment.Keywords: Minesweeper game; Qt; C++目录摘要 (I)ABSTRACT .......................................................................................................................... I I 第1章绪论 ..................................................................................................................... - 1 -1.1 研究背景 ........................................................................................................... - 1 -1.2 研究原因 ........................................................................................................... - 1 -1.3 研究意义 ........................................................................................................... - 1 -第2章Qt简介 ................................................................................................................ - 2 -2.1 Qt特征 ............................................................................................................... - 2 -2.2 Qt核心编程技术 ............................................................................................... - 2 -2.2.1 元对象系统............................................................................................ - 2 -2.2.2 信号和槽机制........................................................................................ - 3 -2.2.3 QObject类 .............................................................................................. - 3 -2.2.4 对象树.................................................................................................... - 3 -2.2.5 事件........................................................................................................ - 3 -2.2.6 QApplication类...................................................................................... - 3 -2.2.7 QWidget类............................................................................................. - 4 -2.2.8 基本布局(QLayout) ............................................................................... - 4 -2.3 C++面向对象程序设计..................................................................................... - 4 -2.4 Qt程序用到的类 ............................................................................................... - 5 -2.5 Qt应用程序实现 ............................................................................................... - 5 -2.6 本章小结 ........................................................................................................... - 6 -第3章扫雷游戏设计 ..................................................................................................... - 8 -3.1 扫雷游戏功能需求分析 ................................................................................... - 8 -3.2 扫雷游戏整体框架介绍 ................................................................................... - 8 -3.3 扫雷游戏主要功能的实现 ............................................................................... - 9 -3.3.1 菜单栏的实现........................................................................................ - 9 -3.3.2 菜单栏的功能...................................................................................... - 11 -3.3.3 鼠标事件的实现.................................................................................. - 11 -3.3.4 完成扫雷游戏逻辑的设计.................................................................. - 12 -3.3.5 扫雷游戏状态分类.............................................................................. - 12 -3.3.6 初始化界面功能实现.......................................................................... - 13 -3.3.7 雷区的随机布置.................................................................................. - 13 -3.4 清除未靠近地雷的方块 ................................................................................. - 14 -3.5 游戏的判断 ..................................................................................................... - 15 -3.5.1 游戏成功.............................................................................................. - 15 -3.5.2 游戏失败.............................................................................................. - 15 -3.6 游戏测试结果 ................................................................................................. - 16 -结论 ............................................................................................................................. - 17 -致谢 ............................................................................................................................. - 18 -参考文献 . (1)第1章绪论1.1 研究背景随着计算机与网络的普及,人们生活水平的提高,电脑游戏越来越成为人们生活中不可或缺的一部分,在人们繁忙的工作之余,给人带去欢乐。

相关主题