当前位置: 首页>>代码示例>>C++>>正文


C++ Pipe::back方法代码示例

本文整理汇总了C++中Pipe::back方法的典型用法代码示例。如果您正苦于以下问题:C++ Pipe::back方法的具体用法?C++ Pipe::back怎么用?C++ Pipe::back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pipe的用法示例。


在下文中一共展示了Pipe::back方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CoordinateReleased

void GameController::CoordinateReleased()
{
    for(int i=0;i<getLevel();++i)
        for(int j=0;j<getLevel();++j)
            setBlockColor(QPoint(i,j),GameData::BgColor);
    for(int i=0;i<getColorNumber()*2;++i)
        setBlockColor(gameSetting->Points[i],GameData::ColorSet[i/2]);
    for(int i=0;i<pipeManager->size();++i)
    {
        Pipe* pipe = pipeManager->at(i);
        if(pipeManager->currentPipe!=pipe)
        {
            while(!pipe->empty())
            {
                QPoint _coordinate(pipe->back());
                STATE _state = getBlockState(_coordinate);
                if((_state&WAY)==0||(_state&BREAK)!=0||(_state&CURRENT)!=0)
                    pipe->pop_back();
                else
                    break;
            }
        }
        for(int j=0;j<pipe->size();++j)
            setBlockColor(pipe->at(j),pipe->Color);
    }
    for(int i=0;i<this->getLevel();++i)
        for(int j=0;j<this->getLevel();++j)
            setBlockState(QPoint(i,j),~(CURRENT|BREAK));
    ++gameSetting->moves;
    emit UpdatePipeDisplay();
    emit UpdateBlockDisplay();
    if(CheckWin())
        emit CompleteGame();
}
开发者ID:Somefive,项目名称:FlowFree,代码行数:34,代码来源:GameController.cpp

示例2: CoordinateSelected

void GameController::CoordinateSelected(const QPoint &_coordinate)
{
    this->pipeManager->currentPipe = this->pipeManager->getPipe(this->getBlockColor(_coordinate));
    Pipe* pipe = pipeManager->currentPipe;
    while(!pipe->empty() && (pipe->back()!=_coordinate||(getBlockState(_coordinate)&ORIGIN)!=0))
    {
        setBlockState(pipe->back(),~(WAY|CURRENT));
        pipe->pop_back();
    }
    if(pipe->empty())
    {
        setBlockState(_coordinate,WAY|CURRENT);
        pipe->push_back(_coordinate);
    }
    for(int i=0;i<pipe->size();++i)
        setBlockState(pipe->at(i),CURRENT);
    emit UpdatePipeDisplay();
}
开发者ID:Somefive,项目名称:FlowFree,代码行数:18,代码来源:GameController.cpp

示例3: CheckWin

bool GameController::CheckWin()
{
    for(int i=0;i<pipeManager->size();++i)
    {
        Pipe* pipe = pipeManager->at(i);
        if(pipe->size()<2)
            return false;
        if((getBlockState(pipe->back())&ORIGIN)==0)
            return false;
    }
    for(int i=0;i<getLevel();++i)
        for(int j=0;j<getLevel();++j)
            if((getBlockState(QPoint(i,j))&WAY)==0)
                return false;
    if(gameSetting->best<=0 || gameSetting->moves<gameSetting->best)
        gameSetting->setBest(gameSetting->moves);
    return true;
}
开发者ID:Somefive,项目名称:FlowFree,代码行数:18,代码来源:GameController.cpp

示例4: GameStateRecalculate

void GameController::GameStateRecalculate()
{
    int pipeCompleteCount = 0;
    for(int i=0;i<getLevel();++i)
        for(int j=0;j<getLevel();++j)
            if((blockstate[i][j]&WAY)!=0)
                ++pipeCompleteCount;
    gameSetting->pipeFilled = floor(pipeCompleteCount*100/getLevel()/getLevel());

    int pipeLinkCount = 0;
    for(int i=0;i<pipeManager->size();++i)
    {
        Pipe* pipe = pipeManager->at(i);
        if(pipe->size()<2)
            continue;
        if((getBlockState(pipe->back())&ORIGIN)==0)
            continue;
        ++pipeLinkCount;
    }
    gameSetting->currentflows = pipeLinkCount;
}
开发者ID:Somefive,项目名称:FlowFree,代码行数:21,代码来源:GameController.cpp


注:本文中的Pipe::back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。