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 87
游戏通过按键控制
部分代码:
#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
下载说明:请别用迅雷下载,失败请重下,重下不扣分!
串口收发 程序 串行口通信的例子
串口收发程序 串行口通信的例子-Tt s a program of serie port sending and receiving.And it s a sample program of serie port communication.
2023-08-11 08:40:05下载
积分:1
General procedure calls for VFP
General procedure calls for VFP
2022-05-15 03:18:17下载
积分:1
此功能是有关JS方面的代码,谢谢大家的使用和建议!
此功能是有关JS方面的代码,谢谢大家的使用和建议!-This feature is related to aspects of JS code, thanks everyone for the use and suggestions!
2022-01-30 20:02:55下载
积分:1
一个很好用的多用户的ftp服务端程序,用vb编写的。功能很强
一个很好用的多用户的ftp服务端程序,用vb编写的。功能很强
-a good use of multi-user ftp server program, vb prepared. Strong functional
2023-01-30 22:35:04下载
积分:1
计算器程序的实现(vc)
计算器程序的实现(vc)-calculator program achievement (vc)
2022-04-27 03:04:50下载
积分:1
让应用程序有启动画面
让应用程序有启动画面-application procedures for the start up
2022-04-15 17:39:53下载
积分:1
powerbuilder通用窗口框架,包括插入、删除、打印、刷新、排序等...
powerbuilder通用窗口框架,包括插入、删除、打印、刷新、排序等-PowerBuilder window generic framework, including insert, delete, print, refresh, sorting, etc.
2022-01-24 12:34:50下载
积分:1
正常开 放
打开校内页面的辅助程序,可以看各项内容
先将ID复制到剪贴板
使程序处在激活状态,按任意键即可
按回车键是查看当前ID的,按其他键是看剪贴板中的-Open-assisted procedures for the school page, you can watch the first ID to copy the contents to the clipboard so that procedures are activated by pressing any key you press the Enter key is to view the current ID, and by other key is to watch clipboard
2023-09-09 19:20:03下载
积分:1
一个紧凑的代理人(编译压缩约5K),模式是一个多线程
a compact agents (compiled compressed about 5K), the mode is a multithreaded
2022-12-08 13:05:03下载
积分:1
全局变量表示了内核上一次执行函数的时间,期间一共发 生了多少次时钟中断,显然函数必须为期间所发 生的每一次时钟中断补上定时器服务。...
全局变量表示了内核上一次执行函数的时间,期间一共发生了多少次时钟中断,显然函数必须为期间所发生的每一次时钟中断补上定时器服务。-The Global variable denotes the time when the CPU running the function the latest time, the number of time interrupt between the two running. It s obvious that add timer at every time interrupt.
2022-05-13 08:14:19下载
积分:1