setAutoFillBackground(true);//覆盖this->resize(480,270);this->setWindowIcon(QIcon("img/icon.jpg"));this->setWindowTitle("贪吃蛇");QPalettepalette;palette.setBrush(QPalette::Background,QBrush((QPixmap)"img/bjt.png"));this->setPalette(palette);//按扭区leftbtn=newQPushButton(this);leftbtn->setIcon((QIcon)"img/zuo.png");leftbtn->setIconSize(QSize(40,40));leftbtn->setGeometry(QRect(340,180,40,40));leftbtn->setFlat(true);rightbtn=newQPushButton(this);rightbtn->setIcon((QIcon)"img/you.png");rightbtn->setIconSize(QSize(40,40));rightbtn->setGeometry(QRect(430,180,40,40));rightbtn->setFlat(true-IMDN开发者社群-imdn.cn">
setAutoFillBackground(true);//覆盖this->resize(480,270);this->setWindowIcon(QIcon("img/icon.jpg"));this->setWindowTitle("贪吃蛇");QPalettepalette;palette.setBrush(QPalette::Background,QBrush((QPixmap)"img/bjt.png"));this->setPalette(palette);//按扭区leftbtn=newQPushButton(this);leftbtn->setIcon((QIcon)"img/zuo.png");leftbtn->setIconSize(QSize(40,40));leftbtn->setGeometry(QRect(340,180,40,40));leftbtn->setFlat(true);rightbtn=newQPushButton(this);rightbtn->setIcon((QIcon)"img/you.png");rightbtn->setIconSize(QSize(40,40));rightbtn->setGeometry(QRect(430,180,40,40));rightbtn->setFlat(true - IMDN开发者社群-imdn.cn">
于 2022-03-21 发布
文件大小:730.86 kB
0 181
游戏通过按键控制
部分代码:
#include "gamewidget.h"
#define ROW 13
#define COL 16
#define UP 0
#define DOWN 1
#define LEFT 2
#define RIGHT 3
GameWidget::GameWidget(QWidget *parent)
:QWidget(parent)
{
this->setAutoFillBackground(true);//覆盖
this->resize(480,270);
this->setWindowIcon(QIcon("img/icon.jpg"));
this->setWindowTitle("贪吃蛇");
QPalette palette;
palette.setBrush(QPalette::Background,QBrush((QPixmap)"img/bjt.png"));
this->setPalette(palette);
//按扭区
leftbtn=new QPushButton(this);
leftbtn->setIcon((QIcon)"img/zuo.png");
leftbtn->setIconSize(QSize(40,40));
leftbtn->setGeometry(QRect(340,180,40,40));
leftbtn->setFlat(true);
rightbtn=new QPushButton(this);
rightbtn->setIcon((QIcon)"img/you.png");
rightbtn->setIconSize(QSize(40,40));
rightbtn->setGeometry(QRect(430,180,40,40));
rightbtn->setFlat(true
下载说明:请别用迅雷下载,失败请重下,重下不扣分!
C语言编写的CRC程序,可以自由下载。
C语言编写的CRC程序,可以自由下载。-C languages CRC procedures, are free to download.
2022-02-13 04:11:34下载
积分:1
EVC高级编程及应用开 发 书上例程源代码,剩余部分内容待传。...
EVC高级编程及应用开发书上例程源代码,剩余部分内容待传。-EVC high-level programming and application development books routines source code, to be part of the contents of the remaining mass.
2022-01-24 14:10:45下载
积分:1
此程序基于VB开 发 环境,主要介绍怎样对应用程序的优化.
此程序基于VB开发环境,主要介绍怎样对应用程序的优化.-this procedure VB-based development environment, focusing on how to optimize the application.
2022-03-19 00:47:00下载
积分:1
多态性和复习的相关文件!!!好老火,要限制字数!!!防撒发 生发 生发 生发 撒...
多态性和复习的相关文件!!!好老火,要限制字数!!!防撒发生发生发生发撒-polymorphism and review of the relevant documents! ! ! Good old fire, to restrict the number of words! ! ! Anti-spreading occurred happened happened fat spreading
2022-12-06 06:35:03下载
积分:1
可以在文件夹中删除不要的文件,支持层次搜索
可以在文件夹中删除不要的文件,支持层次搜索-can delete folders of documents should not support levels Search
2022-01-26 06:18:34下载
积分:1
一个ini文件解析的C++实现,使用STL,并有文档说明。
一个ini文件解析的C++实现,使用STL,并有文档说明。-Ini files parsed a C++ Realize, the use of STL, and documentation.
2022-03-19 18:13:50下载
积分:1
一个好用简单的window进程管理程序,使用VC++MFC编写。
一个好用简单的window进程管理程序,使用VC++MFC编写。-A simple window-to-use process management procedures, the use of VC++ MFC prepared.
2022-02-02 12:40:11下载
积分:1
各种插值算法的数值分析,其中包括:牛顿…
数值分析当中的各种插值算法,包括:牛顿插值,三次样条插值,代数插值等等,在工程应用中非常有用!-Numerical analysis of the various interpolation algorithms, including: Newton interpolation, cubic spline interpolation, algebraic interpolation, etc., in engineering applications is very useful!
2022-07-26 00:00:21下载
积分:1
Contains a large number of C++ Source, from simple to complex, step by step to e...
包含大量的C++源码,从简单到复杂,一步一步,保证可以在1-2个月成为C++高手@-Contains a large number of C++ Source, from simple to complex, step by step to ensure that in 1-2 months to become C++ Master @
2022-07-27 00:57:33下载
积分:1
C#的SOCKET聊天室源程序,不错。
C#的SOCKET聊天室源程序,不错。-C# source SOCKET chat rooms, yes.
2022-03-20 21:52:39下载
积分:1