ImageVerifierCode 换一换
格式:DOCX , 页数:16 ,大小:19.62KB ,
资源ID:17495723      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/17495723.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(扫雷游戏代码Word格式文档下载.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

扫雷游戏代码Word格式文档下载.docx

1、QWidgetBlock:Block(bool mine_flag,QWidget* parent) :QLabel(parent) mine_flag_=mine_flag; mark_flag_=false; turn_over_flag_=false; number_=-1; setPixmap(QPixmap(/images/);void Block:set_number(int number) number_=number;turn_over() if(!turn_over_flag_) turn_over_flag_=true; if(mine_flag_) setPixmap(Q

2、Pixmap( else/images/mine_+QString(%1).arg(number_)+.png update(); bool Block:is_mine()const return mine_flag_;is_turn_over()const return turn_over_flag_;/*鼠标事件的实现*/mousePressEvent(QMouseEvent* event) if(event-button()=Qt:LeftButton) if(!turn_over_flag_&!mark_flag_) turn_over_flag_=true; if(mine_flag

3、_=true) setPixmap(QPixmap( update(); emit turn_over(true); else emit turn_over(false); else if(event-RightButton) if(! mark_flag_=true; mark_flag_=false; update(); QLabel:mousePressEvent(event);#ifndef BLOCK_AREA_H_#define BLOCK_AREA_H_class QEvent;class QGridLayout;class QObject;class BlockArea:pub

4、lic QWidget BlockArea(int row,int column,int mine_number,QWidget* parent=0); void set_block_area(int row,int column,int mine_number,int init_flag=false); void game_over(bool is_win); bool eventFilter(QObject* watched, QEvent* event);private slots: void slot_turn_over(bool is_mine); int calculate_min

5、es(int x,int y)const; rg(easy_record_time_),1,1); up_layout-addWidget(new QLabel(easy_record_name_),1,2);addWidget(new QLabel(tr(Middle),2,0);addWidget(new QLabel(QString().arg(middle_record_time_),2,1);addWidget(new QLabel(middle_record_name_),2,2);Hard),3,0);).arg(hard_record_time_),3,1);addWidget

6、(new QLabel(hard_record_name_),3,2); QPushButton* recount_button=new QPushButton(tr(recount QPushButton* close_button=new QPushButton(tr(close close_button-setDefault(true); connect(recount_button,SIGNAL(clicked(),&dialog,SLOT(accept(); connect(close_button,SIGNAL(clicked(),&dialog,SLOT(reject(); QH

7、BoxLayout* bottom_layout=new QHBoxLayout; bottom_layout-addStretch();addWidget(recount_button);addWidget(close_button); QVBoxLayout* main_layout=new QVBoxLayout(&dialog); main_layout-addLayout(up_layout);addLayout(bottom_layout); if()=QDialog:Accepted) easy_record_time_=middle_record_time_=hard_reco

8、rd_time_=g_no_record_time; easy_record_name_=middle_record_name_=hard_record_name_=g_no_record_name;void MainWindow:slot_show_game_toolBar(bool show) if(show) game_toolBar-show(); elsehide();slot_show_statusBar(bool show) statusBar()-/*游戏的设置容易、中等、困难及自定义*/slot_standard(QAction* standard_action) if(st

9、andard_action=easy_standard_action) current_standard_=0; row_=9; column_=9; mine_number_=10; else if(standard_action=middle_standard_action) current_standard_=1; row_=16; column_=16; mine_number_=40; else if(standard_action=hard_standard_action) current_standard_=2; column_=30; mine_number_=99; else

10、 if(standard_action=custom_standard_action) QDialog dialog; (tr(set standard QSpinBox* row_spinBox=new QSpinBox; row_spinBox-setRange(5,50);setValue(row_); QSpinBox* column_spinBox=new QSpinBox; column_spinBox-setValue(column_); QSpinBox* mine_spinBox=new QSpinBox; mine_spinBox-setValue(mine_number_

11、); QHBoxLayout* up_layout=new QHBoxLayout; up_layout-addWidget(row_spinBox);addWidget(column_spinBox);addWidget(mine_spinBox); QDialogButtonBox* dialog_buttonBox=new QDialogButtonBox; dialog_buttonBox-addButton(QDialogButtonBox:Ok);Cancel); connect(dialog_buttonBox,SIGNAL(accepted(),& connect(dialog

12、_buttonBox,SIGNAL(rejected(),& QHBoxLayout* bottom_layout=new QHBoxLayout; bottom_layout-addWidget(dialog_buttonBox); QVBoxLayout* main_layout=new QVBoxLayout(& main_layout- if()=QDialog:Accepted) if(row_spinBox-value()*column_spinBox-value()mine_spinBox-value() current_standard_=3; row_=row_spinBox

13、-value(); column_=column_spinBox- mine_number_=mine_spinBox- slot_new_game();/*实现帮助菜单中的关于游戏,及功能*/slot_about_game() QString introduction( +tr(About Mine Sweepr)+/h2 +pThis game is played by revealing squares of the grid, typically by clicking them with a mouse. If a square containing a mine is reveal

14、ed, the player loses the game. Otherwise, a digit is revealed in the square, indicating the number of adjacent squares (out of the possible eight) that contain this number is zero then the square appears blank, and the surrounding squares are automatically also revealed. By using logic, the player c

15、an in many instances use this information to deduce that certain other squares are mine-free, in which case they may be safely revealed, or mine-filled, in which they can be marked as such (which is effected by right-clicking the square and indicated by a flag graphic)./pThis program is free softwar

16、e; you can redistribute it and/or under the terms of the GNU General Public License as published by the Software Foundation; either version 3 of the License, or (at your option) any later version.Please see a href= for an overview of GPLv3 licensingbrVersion:)+g_software_version+/brAuthor: )+g_softw

17、are_author+ ); QMessageBox messageBox(QMessageBox:Information,tr(About Mine Sweeper),introduction,QMessageBox: ();/*游戏的判断,及所给出的提示做出判断*/slot_game_over(bool is_win) QString name; if(is_win) switch(current_standard_) case 0: if(time_label-text().toInt()text().toInt(); easy_record_name_=name; else QMess

18、ageBox:information(this,tr(ResultYou win break; case 1:middle_record_time_) middle_record_time_=time_label- middle_record_name_=name; case 2:hard_record_time_) hard_record_time_=time_label- hard_record_name_=name; default:QMessageBox: else QMessageBox:You lose/*定时器的设置*/slot_timer() time_label-setTex

19、t(QString().arg()/1000);/*关于菜单栏的设置是否显示游戏工具栏和状态栏*/read_settings() QSettings settings; (MainWindow); resize(size).toSize(); move(pos).toPoint(); bool show_game_toolBar=(showGameToolBar).toBool(); show_game_toolBar_action-setChecked(show_game_toolBar); slot_show_game_toolBar(show_game_toolBar); bool sh

20、ow_statusBar=(showStatusBar show_statusBar_action-setChecked(show_statusBar); slot_show_statusBar(show_statusBar);GameSetting current_standard_=(current_standard).toInt(); switch(current_standard_) case 0:easy_standard_action-setChecked(true);break; case 1:middle_standard_action- case 2:hard_standard_action- case 3:custom_standard_action- default:; row_=(row).toInt()=09:( column_=(column mine_number_=(mine_number).toInt()=010:Rank easy_record_time_=(easy_record_time).toInt()=0g_no_record_time: middle_record_time_=(middle_record_time).toInt()=0g_n

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1