qt实现的一个俄罗斯方块的程序 主窗口c文件
//-----------------------------------------------------------------------------------------------------
//BY:yuyongbao
//QQ:673360056
//-----------------------------------------------------------------------------------------------------
#include "tetris.h"
Tetris::Tetris(QWidget *parent)
: QDialog(parent), ui(new Ui::Tetris)
{
ui->setupUi(this);
gameInit();
this->connect(ui->frame,SIGNAL(scoreChanged(int)),this,SLOT(drawScore(int)));
this->connect(ui->frame,SIGNAL(nextTetrixChanged()),this,SLOT(nextTetrixChangedProc()));
this->connect(ui->frame,SIGNAL(gameOver()),this,SLOT(gameEnd()));
}
Tetris::~Tetris()
{
delete ui;
}
void Tetris::gameInit(void)
{
m_curScore = 0;
//总分数以后由文件读入
m_totalScore = 0;
m_level = 0;
m_line = 0;
m_bStart = FALSE;
m_mute = FALSE;
m_nextTetrisPos = QRect(120,160,4*PIXPERRECT,4*PIXPERRECT);
m_scorePos = QRect(50,200,200,40);
m_levelPos = QRect(50,240,200,40);
m_linePos = QRect(50,280,200,40);
//随机种子
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
skinPath = "skins/";
}
void Tetris::gameStart(void)
{
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(timePro()));
//游戏等级与时间之间的关系
timer->start(1600 - m_level * 300);
//产生当前方块和下一个方块
ui->frame->curShape = (TetrixShape)(qrand()%7);
ui->frame->nextShape = (TetrixShape)(qrand()%7);
&n
相关文档:
最近一段时间在研究 Pro*C 遇到了很多初级问题。在 Pro*C 中连接数据库时,我们一般是使用在“tnsnames.ora”中配置好连接,写起来很简单,语法如下:
EXEC SQL CONNECT :username IDENTIFIED BY :password USING :dbname;
/* 这里的 dbname 就是在 ......
http://topic.csdn.net/u/20080924/15/3b00a84e-970f-4dea-92f2-868c5d1ad825.html?52694
前段时间刚参加了n多公司的C/C++软件工程师的面试,有国企,外企,私企(moto,飞思卡尔,港湾,中国卫星XXX(这个牛))等等等等。感受感想颇多,近日终于空闲,在此表述一下。
本人基本条件:3年开发经验,2year+ ......
1.引言
本文的写作目的并不在于提供C/C++程序员求职面试指导,而旨在从技术上分析面试题的内涵。文中的大多数面试题来自各大论坛,部分试题解答也参考了网友的意见。
许多面试题看似简单,却需要深厚的基本功才能给出完美的解答。企业要求面试者写一个最简单的strc ......
前段时间刚参加了n多公司的C/C++软件工程师的面试,有国企,外企,私企(moto,飞思卡尔,港湾,中国卫星XXX(这个牛))等等等等。感受感想颇多,近日终于空闲,在此表述一下。
本人基本条件:3年开发经验,2year+ Windows development experence,1year+ Linux experence. 熟悉C,C++,MFC/SDK/API,MiniG ......
#include "draw.h"
#include "ui_draw.h"
#include <QPixmap>
draw::draw(QWidget *parent)
: QDialog(parent), ui(new Ui::draw)
{
ui->setupUi(this);
// this->setWindowFlags( Qt::FramelessWindowHint);
ctrlPoint.s ......