⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qgamewidget.h

📁 linux 下的 仿联众版俄罗斯方块游戏。qt3 实现。 具有 人机交互功能。 具有 对战模式。 喜欢玩俄罗斯方块的朋友们
💻 H
字号:
#ifndef __GAME_WIDGET_H__#define __GAME_WIDGET_H__#include <qwidget.h>#include "blockgame.h"class QPainter;class QPixmap;class QGameWidget : public QWidget{Q_OBJECTpublic:	enum{ePalyVS=1,ePlaySinle}; // 暂时定两种	QGameWidget( QWidget *parent=0, const char *name=0 );//	virtual ~QGameWidget(); qt 会自己释放掉new的qt对象	int getBlockSize(void){ return blockSize;};	int gameStatus();	void setGamePause(bool p=true);	void setComputerRun(bool r=true);	void startGame(void);	void setPlayMode(int mode);private slots:	void drawGame(int rBack=0); // rBack更新背景与否public slots:	void handleKeyEvent( int key);	void gameAddLine(_bS8 n); // _bS8 和blockgame.h定义一致	void iWinTheGame(void);signals:	void NoticeOtherWinGame(void);	void SelPainSignal( int rBack=0);	void PaintNextSignal(QPixmap *pix);	void AddOtherLine(_bS8 n);protected:    void paintEvent( QPaintEvent * );private:	BLOCK_GAME game;	int blockSize;	QRect LastBlockRect[4];	bool bRefresh; // 是否更新背景 和rBack有区别	// bRefresh表征:固定方块、消行。rBack 是无条件的	QColor brcolor[7]; // 7 种画刷颜色	QColor egcolor; // 边框颜色	QPixmap *gamePix;	QPixmap *nextPix;	bool bComputerRun;	int bPlayMode;private:	void drawBackGrid( QPainter *p );	void drawCurBlock( QPainter *p );	void drawNextBlock( void );	void drawClrLastBlock( QPainter *p ); //	void drawOverShow( QPainter *p ,int type );	void clrLastBlockRect( void );	bool driveBlockRun(int status, int col);	bool judgeBetterAttr(const GRID_ATTR& CurAttr,		const GRID_ATTR& BestAttr);	void overDriveDownBlock( void );	void palyAufile(const char * filename);protected:	void resizeEvent ( QResizeEvent * e);	bool ComputerRun(void); // 让线程可访问friend class QGameThread;};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -