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 238
游戏通过按键控制
部分代码:
#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
下载说明:请别用迅雷下载,失败请重下,重下不扣分!
cppcheck, can detect c++ code, including memory leaks and cross
cppcheck,可以检测c++代码,包括内存泄漏和越界-cppcheck, can detect c++ code, including memory leaks and cross-border
2022-11-04 15:20:03下载
积分:1
混沌映射MATLAB仿真
一些简单的混沌系统映射的仿真代码,例如lorenz,tent,等
2023-07-05 02:20:03下载
积分:1
外国高手用vb编写的游戏源代码 很精美 无论在声音图像上都是很专业的 适合对vb比较精通人学习...
外国高手用vb编写的游戏源代码 很精美 无论在声音图像上都是很专业的 适合对vb比较精通人学习-It is a foreign skill programmer s game code using VB, very fine. For both the sound and graph is professional, it is very useful for the advanced learner.
2023-05-28 17:50:03下载
积分:1
端口扫描器C语言源代码,初学者可以参考一下
端口扫描器C语言源代码,初学者可以参考一下-Port scanner C language source code for reference for beginners
2022-04-07 00:17:08下载
积分:1
A very very simple program developed in Visual Basic 6.0 for practcal you can us...
A very simple program developed in Visual Basic 6.0 for practcal you can use it.-A very very simple program developed in Visual Basic 6.0 for practcal you can use it.
2023-06-02 21:40:03下载
积分:1
flash网站素材,做网站的朋友们可以收集
flash网站素材,做网站的朋友们可以收集-flash web site material, so the site can collect friends
2023-08-06 04:10:03下载
积分:1
获取某个进程的主窗口以及创建进程的程序名
获取某个进程的主窗口以及创建进程的程序名-Get the main form of one process and create a programme name of the process.
2022-01-26 01:42:53下载
积分:1
遗传算法C++源码
遗传算法C++源码
遗传算法C++源码
遗传算法C++源码-Genetic Algorithms C++ source code C++ genetic algorithm genetic algorithm source code C++ source code
2023-07-17 10:10:05下载
积分:1
这是关于一些界面编程的一些实例为了和大家分享我可是花了很多心机哦!!希望大家能借此机会有一个共同发 展中国软件事业的理想!...
这是关于一些界面编程的一些实例为了和大家分享我可是花了很多心机哦!!希望大家能借此机会有一个共同发展中国软件事业的理想!-This is the programming interface for some of the examples and to share with you but I spent a lot of effort! ! Hope that we can take this opportunity to be a common cause of the development of China"s software ideal!
2022-02-15 22:02:19下载
积分:1
基于uilib的internet浏览器
使用uilib库制作的浏览器,使用VS2012工程,界面简洁,可输入地址,回到主页,可隐藏界面,系统托盘显示,包含资源文件uilib使用VS2012编译通过,包含头文件,Debug库和dll文件,工程已配置好,直接编译即可
2023-03-24 08:05:04下载
积分:1