• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setScore函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setScore函数的典型用法代码示例。如果您正苦于以下问题:C++ setScore函数的具体用法?C++ setScore怎么用?C++ setScore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: switch

void NewScene::selectedEvent(Ref *pSender, ui::CheckBox::EventType type)
{
	Point origin = Director::getInstance()->getVisibleOrigin();
	Size visibleSize = Director::getInstance()->getVisibleSize();

	switch (type)
	{
	case cocos2d::ui::CheckBox::EventType::SELECTED:

		setScore(getScore() + 1);
		
		break;
	case cocos2d::ui::CheckBox::EventType::UNSELECTED:
		//log("checkbox deseleccionado");
		//i -=1;
		setScore(getScore() - 1);

		break;
	default:
		break;
	}



}
开发者ID:Johan08,项目名称:cocos2d-x-3.2-ui-,代码行数:25,代码来源:NewScene.cpp


示例2: SDL_GetTicks

void            SdlDisplay::sdlChangeEvent(bool multi)
{
    if (!gticks)
    {
        startticks = SDL_GetTicks();
        gticks = true;
    }
    if ((!p2score || p2score) && multi)
    {
        sdlDrawFont(114, 166, 65, 10, 570, fontscore, 30, setScore(score, "P1"));
        sdlDrawFont(114, 166, 65, 550, 570, fontscore, 30, setScore(p2score, "P2"));
    }
    if ((!score || score) && !multi)
    {
        sdlDrawFont(114, 166, 65, 10, 570, fontscore, 30, setScore(score, "P1"));
        sdlDrawFont(114, 166, 65, 650, 570, fontscore, 30, "Nibbler");
    }
    if (pause && !gameover)
    {
        sdlSetRect(&rtmp, 0, 0, 0, 0);
        SDL_BlitSurface(menu, NULL, screen, &rtmp);
    }
    if (gameover)
    {
        if (!pause)
        {
            son = Mix_LoadWAV("music/game-over.wav");
            Mix_PlayChannel(1, son, 0);
        }
        pause = true;
        sdlDrawFont(255, 255, 255, (WIDTH/2.5)-170, (HEIGHT/2.5)-100, FONT, 90, "GAMEOVER");
    }
}
开发者ID:bogardt,项目名称:mySnake,代码行数:33,代码来源:SdlDisplay.cpp


示例3: switch

void GameScene::onTouchEnded(Touch* touch, Event* event)
{
    Point pos = touch->getLocation();
    SimpleGestures rtn = recognizer->endPoint(pos);
    switch (rtn) {
        case SimpleGesturesLeft:
            doLeft();
            doCheck();
            setScore(score);
            break;
        case SimpleGesturesRight:
            doRight();
            doCheck();
            setScore(score);
            break;
        case SimpleGesturesUp:
            doUp();
            doCheck();
            setScore(score);
            break; 
        case SimpleGesturesDown:
            doDown();
            doCheck();
            setScore(score);
            break;
        case SimpleGesturesNotSupport:
        case SimpleGesturesError:
            log("not support or error touch,use geometricRecognizer!!");
            break;
        default:
            break; 
    } 
} 
开发者ID:hkb1990,项目名称:PracticeHand,代码行数:33,代码来源:GameScene.cpp


示例4: setScore

void EnemyLayer::blowupEnemy(EnemySprite* pEnemySprite) {
	Animation *pAnimation = NULL;
	Sprite *pmsprite = NULL;
	char *buff = NULL;
	if (Enemy1 == pEnemySprite->getTag()) {
		buff = "a_001.png";
		pAnimation = AnimationCache::getInstance()->getAnimation("Enemy1Blowup");
		setScore(ENEMY1_SCORE);
	} else if (Enemy2 == pEnemySprite->getTag()) {
		buff = "b_001.png";
		pAnimation = AnimationCache::getInstance()->getAnimation("Enemy2Blowup");
		setScore(ENEMY2_SCORE);
	} else if (Enemy3 == pEnemySprite->getTag()) {
		buff = "d_00001.png";
		pAnimation = AnimationCache::getInstance()->getAnimation("Enemy3Blowup");
		setScore(ENEMY3_SCORE);
	} else {
		return;
	}
	pmsprite = Sprite::createWithSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName(buff));

	Point newPos = pEnemySprite->getcurPoint();
	Animate *pAnimate = Animate::create(pAnimation);
	pmsprite->setPosition(newPos);
	this->addChild(pmsprite);

	CallFuncN* mactiondone = CallFuncN::create(CC_CALLBACK_0(EnemyLayer::f_removemyAnimation, this, pmsprite));
	auto seq = Sequence::create(pAnimate, mactiondone, NULL);
	pmsprite->runAction(seq);
	removeEnemy(pEnemySprite);
	updateScore(m_score);
}
开发者ID:ljdzxx,项目名称:hello-world,代码行数:32,代码来源:EnemyLayer.cpp


示例5: outfile

void		SdlDisplay::sdlSetHighscore(const char *file, bool multi)
{
    std::ofstream outfile(file, std::ios_base::out | std::ios_base::app);

    if (multi)
        if (!score && !p2score)
            return;
        else
            outfile << setScore(score, "P1") << setScore(p2score, "P2");
    else if (!score && !p2score)
        return;
    else
        outfile << setScore(score, "P1");
    outfile.close();
}
开发者ID:bogardt,项目名称:mySnake,代码行数:15,代码来源:SdlDisplay.cpp


示例6: getItemType

void GameNewLinker::getScoreByStar() {
    std::vector<int>animalUnLink;
    //未连接的图像数组
    for (int i = 0; i < AnimalList.size(); i++) {
        if (AnimalList[i] -> getLinkStatus()) {
            bool wellPush = true;
            for (int j = 0; j < animalUnLink.size(); j++) {
                if (animalUnLink[j] == AnimalList[i] -> getItemType()) {
                    wellPush = false;
                }
            }
            if (wellPush) {
                animalUnLink.push_back(AnimalList[i] -> getItemType());
            }
        }
    }
    for (int i = 0; i < animalUnLink.size(); i++) {
        batter++;
        if (batter > bigestBatter) {
            bigestBatter = batter;
        }
        allbatter ++;
        if (animalUnLink[i] == Box_5w) {
            score += 50000;
            setScore((long)score);
        }
        setScore_link();
    }
}
开发者ID:anzhongliu,项目名称:SmallGame_Cocos2dx,代码行数:29,代码来源:GameNewLinker.cpp


示例7: setScore

void GameNewLinker::setScore_link() {
    int link_score = 50 * batter;
    int points_score = pointsCount * 100 + 100;
    int allscore = (link_score + points_score) * gameBatterType;
    score += allscore;
    setScore((long)score);
}
开发者ID:anzhongliu,项目名称:SmallGame_Cocos2dx,代码行数:7,代码来源:GameNewLinker.cpp


示例8: QWidget

PlayPanel::PlayPanel(QWidget* parent)
   : QWidget(parent, Qt::Dialog)
      {
      cachedTickPosition = -1;
      cachedTimePosition = -1;
      cs                 = 0;
      setupUi(this);
      setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);

      QSettings settings;
      restoreGeometry(settings.value("playPanel/geometry").toByteArray());
      move(settings.value("playPanel/pos", QPoint(DEFAULT_POS_X, DEFAULT_POS_Y)).toPoint());

      setScore(0);
      playButton->setDefaultAction(getAction("play"));
      rewindButton->setDefaultAction(getAction("rewind"));
      metronomeButton->setDefaultAction(getAction("metronome"));
      loopButton->setDefaultAction(getAction("loop"));
      loopInButton->setDefaultAction(getAction("loop-in"));
      loopOutButton->setDefaultAction(getAction("loop-out"));

      connect(volumeSlider, SIGNAL(valueChanged(double,int)), SLOT(volumeChanged(double,int)));
      connect(posSlider,    SIGNAL(sliderMoved(int)),         SLOT(setPos(int)));
      connect(tempoSlider,  SIGNAL(valueChanged(double,int)), SLOT(relTempoChanged(double,int)));
      connect(seq,          SIGNAL(heartBeat(int,int,int)),   SLOT(heartBeat(int,int,int)));
      }
开发者ID:CFrei,项目名称:MuseScore,代码行数:26,代码来源:playpanel.cpp


示例9: addChild

void PlayLayer::explodeSushi(SushiSprite *sushi)
{
	//log("explodeSushi ture");
    float time = 0.3;
    
    // 1. action for sushi
    sushi->runAction(Sequence::create(
                                      ScaleTo::create(time, 0.0),
                                      CallFunc::create(CC_CALLBACK_0(Sprite::removeFromParent, sushi)),
                                      NULL));
	
    // 2. action for circle
    auto circleSprite = Sprite::create("circle.png");
	addChild(circleSprite, 10);
	circleSprite->setPosition(sushi->getPosition());
	circleSprite->setScale(0);// start size
    circleSprite->runAction(Sequence::create(ScaleTo::create(time, 1.0),
                                             CallFunc::create(CC_CALLBACK_0(Sprite::removeFromParent, circleSprite)),
                                             NULL));

    // 3. particle effect
	auto particleStars = ParticleSystemQuad::create("stars.plist");
    particleStars->setAutoRemoveOnFinish(true);
	particleStars->setBlendAdditive(false);
	particleStars->setPosition(sushi->getPosition());
	particleStars->setScale(0.3);
    addChild(particleStars, 20);

	//消除加分
	setScore();
}
开发者ID:chessgit,项目名称:SushiGame-Classes,代码行数:31,代码来源:PlayLayer.cpp


示例10: TextItem

Score::Score()
    : TextItem((BRICK_WIDTH * WIDTH)/6, qRound(BRICK_HEIGHT * 1.5))
{
    moveTo(0, - (height * 1.2));
    
    setScore(0);
}
开发者ID:jsj2008,项目名称:kdegames,代码行数:7,代码来源:textitems.cpp


示例11: update

void PlayScene::update(float delta)
{
    counter += 1;
    if (counter == 14) {
        counter = 0;
        jumped = false;
    }
    if (counter % 2 == 1) {
        characterLayer->enterFrame(counter / 2);
    }
    if ((!jumped && counter == 12 && postkun->isJump)
            || (!jumped && counter == 13 && postkun->isJump)) {
        jumped = true;
        score++;
        auto str = StringUtils::format("score:%d", score);
        scoreLabel->setString(str);
    }

    if (!jumped && counter == 13) {
        // over
        auto scene = GameOverScene::createScene();
        auto over = (GameOverScene*)scene->getChildByName("GameOverLayer");
        over->setScore(score);
        Director::getInstance()->replaceScene(scene);
    }
}
开发者ID:tamurashingo,项目名称:postkun_android,代码行数:26,代码来源:PlayScene.cpp


示例12: destory

void Enemy::destory( )
{

	if(hp <= 0){

		//explosion effect  flame
		auto effect = Effect::CreateEffect( );
		effect->explosion(gameStage, this->getPosition( ));

		//explosion effect of particle


		auto config = Config::getInstance( );
		if(config->geteffectState( ))
		{
			SimpleAudioEngine::getInstance( )->playEffect( ship_explode_effect0 );
		}
	
		config->setScore( config->getScore( ) + score );

		//log("current get score is :%d",config->getScore  () );
	
		this->unschedule(schedule_selector( Enemy::fire ) );
		this->removeFromParent( );
	}
}
开发者ID:chenleijava,项目名称:bonefly1.0,代码行数:26,代码来源:Enemy.cpp


示例13: init

void HumanConsole::restart() {
    timeCount = 0;
    lastMove = 0;
    lastSpeedup = -1000;
    running = false;

    keyUp = keyDown = keyLeft = keyRight = false;
    keyShift = keyZ = keyX = false;

    gameInfo.gameStatus = INIT;
    gameInfo.score = gameInfo.round = 0;
    gameInfo.planeX = PLANE_INIT_X;
    gameInfo.planeY = PLANE_INIT_Y;
    gameInfo.planeSkillsNum = 0;

    string bossName;
    init(bossName);
    emit setBossName(QString(bossName.c_str()));
    emit setPlayerName(QString("Human"));
    emit setTime(0);
    emit setScore(0);
    emit setValue1(0);
    emit setValue2(0);

    gameCenter->init(QPointF(gameInfo.planeX, gameInfo.planeY), QPointF(BULLET_X, BULLET_Y));
}
开发者ID:chnlkw,项目名称:16thAI9,代码行数:26,代码来源:humanconsole.cpp


示例14: setScore

void GameLayer::restart() {
    
    setScore(0);
    resetCollisions();
    resetRole();
    beginCountdown(3);
}
开发者ID:DoubleHH,项目名称:FlappyBird,代码行数:7,代码来源:GameLayer.cpp


示例15: QObject

Cursor::Cursor(Score* s)
   : QObject(0)
      {
      _track   = 0;
      _segment = 0;
      setScore(s);
      }
开发者ID:WeiChou,项目名称:MuseScore,代码行数:7,代码来源:cursor.cpp


示例16: newBlankNode

CDGNode *getTopPath(CDGNode * node, Stack * changedNodes, Stack * changedBranches) {
  CDGNode *pathNode = newBlankNode();
  CDGNode *temp = pathNode;
  int branch;
  while (node) {
    if (0 != getScore(node)) {
      stackPush(changedNodes, &node);
      branch = getOutcome(node);
      stackPush(changedBranches, &branch);
      if (isLeaf(node)) {
	setScore(node, 0);
      } else {
	setNextNode(temp, copyToPathNode(newBlankNode(), node));
	temp = getNextNode(temp);
	if (getOutcome(node)) {
	  setBranchInfo(getID(node), 1, getBranchInfo(getID(node), 0));
	  setTrueNodeSet(temp, getTopPath(getTrueNodeSet(node), changedNodes, changedBranches));
	} else {
	  setBranchInfo(getID(node), getBranchInfo(getID(node), 1), 1);
	  setFalseNodeSet(temp, getTopPath(getFalseNodeSet(node), changedNodes, changedBranches));
	}
      }
    }
    node = getNextNode(node);
  }
  if (temp == pathNode) {
    deleteNode(pathNode);
    pathNode = NULL;
  } else {
    temp = pathNode;
    pathNode = getNextNode(pathNode);
    deleteNode(temp);
  }
  return pathNode;
}
开发者ID:rajshukla,项目名称:Testgen_Release-_Feb-15,代码行数:35,代码来源:cdg.c


示例17: setLinesCompleted

void Game::updateGameInfos(int nbLinesDeleted)
{
	setLinesCompleted(getLinesCompleted() + nbLinesDeleted);
	setLevel(computeLevel());
	setFallIterationDelay(computeFallIterationDelay());
	setScore(computeScore(nbLinesDeleted) + getScore());
}
开发者ID:Shiryu,项目名称:Flocks,代码行数:7,代码来源:game.cpp


示例18: ateMouse

void Snake::detectCrash()
{
    QAnimatedPixmapItem* head = snakelist.first();
    QList<QGraphicsItem *> l = head->collidingItems();
    for (QList<QGraphicsItem *>::Iterator it=l.begin(); it!=l.end(); ++it) {
        QGraphicsItem* item = *it;
        // check if snake ate a mouse
        if ( item->type() == mouse_rtti && item->collidesWithItem(head) ) {
            delete item;
            emit ateMouse();
            grow++;   // make the snake grow the next time it moves
            setScore(5);
            return;
        }
        // check if snake hit a wall
        if ( item->type() == wall_rtti && item->collidesWithItem(head) ) {
            emit dead();
            autoMoveTimer->stop();
            return;
        }
    }
    // check if snake hit itself
    for (int i = 3; i < snakelist.count(); i++) {
        if (head->collidesWithItem(snakelist.at(i)) ) {
            emit dead();
            autoMoveTimer->stop();
            return;
        }
    }
}
开发者ID:Camelek,项目名称:qtmoko,代码行数:30,代码来源:snake.cpp


示例19: doLeft

void GameScene::onTouchEnded(Touch* touch, Event* event)
{
	//得到触摸结束时坐标
	Point endTouch = touch->getLocation();  //获取OpenGL坐标,以左下角为原点
	//计算手指在X,Y移动的距离
	endX = beginX - endTouch.x;
	endY = beginY - endTouch.y;
	if (abs(endX) > abs(endY))
	{
		//如果X轴移动的距离大于Y轴,则是左右移动
		if (endX + 5 > 0)
		{
			//向左移动
			doLeft();
			createCardNumber();
			doCheck();
			setScore(score);
		}
		else
		{
			//向右移动
			doRight();
			createCardNumber();
			doCheck();
			setScore(score);
		}
	}
	else //否则是上下移动
	{
		if (endY + 5 > 0)
		{
			//向下移动
			doDown();
			createCardNumber();
			doCheck();
			setScore(score);
		}
		else
		{
			//向上移动
			doUp();
			createCardNumber();
			doCheck();
			setScore(score);
		}
	}
}
开发者ID:BFOND,项目名称:cocos2dx-3.0-of-2048,代码行数:47,代码来源:GameScene.cpp


示例20:

void ib::Completer::completeCommand(std::vector<ib::CompletionValue*> &candidates, const std::string &value){ // {{{
  auto controller = ib::Singleton<ib::Controller>::getInstance();
  method_command_->beforeMatch(candidates, value);
  double score;

  if(candidates.size() == 0){
    for(auto &pair : controller->getCommands()) {
      pair.second->setScore(0.0);
      score = method_command_->match(pair.second->getName(), value);
      if(score > -1) {
        pair.second->setScore(score);
        candidates.push_back(pair.second);
      }
    }
  }else{
    for(auto it = candidates.begin(); it != candidates.end();){
      auto base_command = dynamic_cast<ib::BaseCommand*>(*it);
      if(base_command != nullptr){
        base_command->setScore(0.0);
        score = method_command_->match(base_command->getName(), value);
        if(score > -1){
          base_command->setScore(score);
          ++it;
          continue;
        }
      }
      it = candidates.erase(it);
    }
  }

  auto history = ib::Singleton<ib::History>::getInstance();
  const auto average = history->getAverageScore();
  const auto se      = history->calcScoreSe();
  const auto hfactor  = ib::Singleton<ib::Config>::getInstance()->getHistoryFactor();
  const auto rfactor  = 1 - hfactor;

  for(const auto &candidate : candidates) {
    auto *base_command = dynamic_cast<ib::BaseCommand*>(candidate);
    if(base_command != nullptr) {
      const auto hist_score = history->calcScore(base_command->getName(), average, se);
      base_command->setScore(base_command->getScore()*rfactor + hist_score * hfactor);
    }
  }

  method_command_->afterMatch(candidates, value);
} // }}}
开发者ID:yuin,项目名称:iceberg,代码行数:46,代码来源:ib_completer.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setScriptReturn函数代码示例发布时间:2022-05-30
下一篇:
C++ setSceneRect函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap