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 241
游戏通过按键控制
部分代码:
#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
下载说明:请别用迅雷下载,失败请重下,重下不扣分!
本例子实现了在windows 下的h.264解码器的程序,很不错
本例子实现了在windows下的h.264解码器的程序,很不错-H.264 decode source code for Windows.
2022-02-21 09:22:55下载
积分:1
获取汉字的16进制编码,将汉字的转换为16进制码
获取汉字的16进制编码,将汉字的转换为16进制码
2022-03-23 16:47:28下载
积分:1
AppWizard has created this GraphExp application for you. This application
not...
AppWizard has created this GraphExp application for you. This application
not only demonstrates the basics of using the Microsoft Foundation classes
but is also a starting point for writing your application.
2023-09-05 07:30:03下载
积分:1
driver, compatible with NE2
驱动程序,兼容NE2-driver, compatible with NE2
2022-11-09 01:20:03下载
积分:1
mouse_movement
应用背景伟大的软件用PASCAL跟踪鼠标移动关键技术这个程序是模拟鼠标移动,它的真的有很大的方式来做它
2022-01-25 18:35:10下载
积分:1
2004042323420918natas,从事局域网开 发 ,多媒体技术工程师
2004042323420918natas,从事局域网开发,多媒体技术工程师- 2004042323420918natas,who is engaged in the development of the LAN, engineer of the multimedia technology
2022-02-10 11:43:39下载
积分:1
使 vb6.0具有开 发 控制台程序的能力,使用很简单,插入控件后调用两个方法就行了...
使 vb6.0具有开发控制台程序的能力,使用很简单,插入控件后调用两个方法就行了-Vb6.0 with a console program to develop the ability to use very simple, insert the control method is called after the two lines of the
2022-04-20 08:55:33下载
积分:1
模仿窗口用户界面程序
模仿WindowsXP用户接口的程序-imitate the Windows user interface procedures
2022-06-03 20:22:20下载
积分:1
Some commonly used string operations, well used, are the source code
字符串的一些常用操作,很好用的,都是源代码-Some commonly used string operations, well used, are the source code
2022-08-14 23:06:28下载
积分:1
进制转化函数,在二进制八进制十进制十六进制之间选择,输出到文本里...
进制转化函数,在二进制八进制十进制十六进制之间选择,输出到文本里-Binary conversion function, the binary 8 hex decimal choose between hexadecimal, output to a text-ri
2022-03-31 05:55:22下载
积分:1