易截截图软件、单文件、免安装、纯绿色、仅160KB

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


相关文档:

ARM的 N、Z、C、V 标志位的解释

N  当用两个补码表示的带符号数进行运算时,N=1表示运算的结果为负数;N=0表示运算的结果为正数或零.
Z  Z=1表示运算的结果为零,Z=0表示运算的结果非零。
C  可以有4种方法设置C的值:
   加法运算(包括CMN):当运算结果产生了进位时(无符号数溢出),C=1,否则C=0。
   减法运 ......

#ifdef __cplusplus extern "C"

面试时被问到过,不甚明了,网上百度一下,整合了两个仁兄的文章,如下。:-)
时常在cpp的代码之中看到这样的代码:
#ifdef __cplusplus //c++编译环境中才会定义__cplusplus (plus就是"+"的意思)
extern "C" { //告诉编译器下面的函数是c语言函数(因为c++和c语言对函数的编译转换不一样,主要是c++中存在重载)
#en ......

C/C++ assert() 函数用法

assert
函数名: assert
功  能: 测试一个条件并可能使程序终止
用  法: void assert(int test);
程序例:
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
struct ITEM {
   int&n ......

S3C44B0 IO口程序库 c文件

 /* =========================================================================== */
/* Project:        s3c44b0_lib                         & ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号