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 278
游戏通过按键控制
部分代码:
#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
下载说明:请别用迅雷下载,失败请重下,重下不扣分!
Introduction to JQuery started JQuery entry JQuery
JQuery入门 JQuery入门-Introduction to JQuery started JQuery entry JQuery
2022-06-29 06:55:37下载
积分:1
researched agreement Application
SMPT 协议应用 实例-researched agreement Application
2023-05-30 18:15:03下载
积分:1
Regular expression is cumbersome, but powerful, after the application of the Ins...
正则表达式是繁琐的,但是强大的,学会之后的应用会让你除了提高效率外,会给你带来绝对的成就感。只要认真去阅读这些资料,加上应用的时候一定的参考,掌握正则表达式不是问题-Regular expression is cumbersome, but powerful, after the application of the Institute will let you Apart from improving efficiency, will bring you the absolute sense of achievement. As long as a serious effort to read these data, together with the application of some reference time, to master regular expressions is not a problem
2022-08-10 18:11:17下载
积分:1
"一笔画回路问题"刚刚学习C++,学习怎么样用友元的基本用法!!1...
"一笔画回路问题"刚刚学习C++,学习怎么样用友元的基本用法!!1-err
2022-09-26 14:30:03下载
积分:1
Updated version of Windows, VC programs applet!
Windows下VC程序版本更新小程序!-Updated version of Windows, VC programs applet!
2022-04-10 09:45:00下载
积分:1
启动、管理、切换进程 .
启动、管理、切换进程 .-start, management, switching process.
2022-01-25 22:21:04下载
积分:1
emv 软件威虎
软件应用的 EMV 软件,创建 ARQC 动态或静态,美味 FUNCIONALITY!!!
2022-09-05 18:05:02下载
积分:1
mouse control, mouse hook
鼠标监控,鼠标钩子-mouse control, mouse hook
2022-02-05 23:38:47下载
积分:1
退出程序后,如何保存信息。
退出程序后,如何保存信息。-withdraw from the process, how to preserve information.
2022-03-11 10:25:03下载
积分:1
从键盘输入一个四位年份数值,判断输入的年份是否是闰年。...
从键盘输入一个四位年份数值,判断输入的年份是否是闰年。-Keyboard input from a four-year value, enter the year to determine whether it is a leap year.
2022-05-22 10:11:29下载
积分:1