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

C++ endGame函数代码示例

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

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



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

示例1: endGame

void PlayState::update(const double dt) {

	for (LevelItem::ObjListConstIter obj = objectList.begin(); obj < objectList.end(); obj++)
		(*obj)->update(dt);

	player->collectActions(playerActions);
	player->update(dt);
	playerActions.clear();

	//iterating through objectList, removing items maraked for removal, whilst not invalidating iterator
	for (LevelItem::ObjListConstIter obj = objectList.begin(); obj != objectList.end(); /*empty*/) {
		if ((*obj)->markedForRemoval)
			obj = objectList.erase(obj);
		else 
			++obj;
	}

	if (player->markedForRemoval)
		endGame(PLAYER_DIED);

	for (LevelItem::ObjListConstIter obj = objectList.begin(); obj < objectList.end(); obj++) {
		Checkpoint* cp = dynamic_cast<Checkpoint*>(*obj);
		if (cp && cp->cptype == Checkpoint::LEVEL_END && cp->activated)
			endGame(END_REACHED);
	}
}
开发者ID:Kwapi,项目名称:Colour-Up---2D-Platformer,代码行数:26,代码来源:PlayState.cpp


示例2: g_msg

void GameSession::black_offersDraw()
{
   if(whiteDrawOfferActive_)
   {
      whiteDrawOfferActive_ = false;
      whitePlayer_->opponentAcceptsDraw();
      //
      g_localChessGui.showSessionMessage(
            g_msg("PlayerAcceptsDraw").arg(blackPlayer_->name()));
      //
      endGame(reasonGameFinished, resultDrawnByAgreement);
   }
   else if(canDrawByRepetition_)
   {
      endGame(reasonGameFinished, resultDrawnByRepetition);
   }
   else
   {
      blackDrawOfferActive_ = true;
      whitePlayer_->opponentOffersDraw();
      //
      g_localChessGui.showSessionMessage(
            g_msg("PlayerOffersDraw").arg(blackPlayer_->name()));
   }
}
开发者ID:joaoamaral,项目名称:k3chess,代码行数:25,代码来源:GameSession.cpp


示例3: main

int			main(int UNUSED(argc), char ** argv, char **envp)
{
	Game *			game = init_game();
	int				i = -1;
	std::string		visual[] = {
		" ",
		"*",
		" ",
		"~"
	};

	while (++i < WIN_WIDTH )
	{
		game->getBg()[i].setY(0);
		game->getBg()[i].setPatern(Patern(visual[rand() % 4]));
		game->getBg2()[i].setY(WIN_HEIGHT - 1);
	}
	while ( 42 )
	{
		usleep( 1000000 / NB_FRAME );
		if ( doKeyAction(game->getPlayer()) )
			break ;
		game->popRandomEnemy();
		game->move_all();
		if (checkCollisions(game, game->getEnemies(), game->getPlayer()->getBullets()))
			endGame(game->getPlayer()->getScore(), argv[0], envp, "You Win !");
		if (game->getPlayer()->getHp() <= 0)
			break ;
		clear();
		game->display_all();
	}
	endGame(game->getPlayer()->getScore(), argv[0], envp, "You loose !");

	COUT << ENDL;
}
开发者ID:DrenBx,项目名称:ft_retro,代码行数:35,代码来源:main.cpp


示例4: nextTurn

void nextTurn(int field[n][n],int crossFlag)
{
    if (crossFlag%2==0)
        printf("\nX turn\nEnter X Y (sample '1 2' or '3 1'):\n");
    else
        printf("\nO turn\nEnter X Y (sample '1 2' or '3 1'):\n");
    int x,y;
    do
    {
        scanf("%d%d",&x,&y);
        if (field[x-1][y-1]!=0)
            printf("\nIncorrect move. Please repeat again.\nEnter X Y (sample '1 2' or '3 1'):\n");
    }
    while (field[x-1][y-1]!=0);
    system("cls");
    if (crossFlag%2==0)
        field[x-1][y-1]=1;
    else
        field[x-1][y-1]=2;
    drawField(field);
    if (endGame(field)==1 && crossFlag%2==0)
        printf("\nX Win!\n");
    if (endGame(field)==1 && crossFlag%2!=0)
        printf("\nO Win!\n");
    if (endGame(field)==2)
        printf("\nDraw!\n");
}
开发者ID:itstep2014springEvening,项目名称:Klindziuk_DZ,代码行数:27,代码来源:main.c


示例5: gameEngine

UserControlsEngine::UserControlsEngine(GameEngine *ge): gameEngine(ge), hasEnd(false), hasBegin(true),pauseTime(NOVATIMER)
{
    myKey = Settings::getGlobalSettings().playersControls();

    display = gameEngine->displayEngine();

    actions.insert(myKey[aTop1],aTop1);
    actions.insert(myKey[aBottom1],aBottom1);
    actions.insert(myKey[aShoot1],aShoot1);

    actions.insert(myKey[aTop2],aTop2);
    actions.insert(myKey[aBottom2],aBottom2);
    actions.insert(myKey[aShoot2],aShoot2);

    novaeCall = new QTimer(this);
    novaeCall->setSingleShot(true);
    novaeCall->start(NOVATIMER);
    countTimer.start();
    idTimer = startTimer(REFRESH);

    connect(novaeCall,SIGNAL(timeout()),this,SLOT(callSupernovae()));
    connect(gameEngine,SIGNAL(signalPause(bool)),this,SLOT(pauseGame(bool)));
    connect(gameEngine,SIGNAL(endGame()),this,SLOT(endGame()));

}
开发者ID:Diego999,项目名称:Starfighter,代码行数:25,代码来源:UserControlsEngine.cpp


示例6: computeAvailableMovements

void Game::changeTurn() {
    /* Change le joueur en cours */
    turn = (turn == 1)?2:1;
    
    //player1.computeAvailableMovements(player1.getPieces(), player2.getPieces());
    //player2.computeAvailableMovements(player2.getPieces(), player1.getPieces());

    computeAvailableMovements();

    scene->unselect();


    if(turn == 1){

        std::vector<Piece *> checkState = check(player1, player2, player1.getKing()->getPosition());
        if (checkState.size()>0){
            std::cout << "\nJoueur 1, vous êtes en échec !" << std::endl;
            scene->setSelectTex(1);
            if(checkMate(player1, player2,checkState)) endGame(2);
        } else {
            scene->setSelectTex(0);
        }
    } else if (turn == 2){
        std::vector<Piece *> checkState = check(player2, player1, player2.getKing()->getPosition());
        if (checkState.size()){
            std::cout << "\nJoueur 2, vous êtes en échec !" << std::endl;
            scene->setSelectTex(1);
            if(checkMate(player2, player1, checkState)) endGame(1);
        } else {
            scene->setSelectTex(0);
        }
    }
}
开发者ID:vince91,项目名称:Chess3D,代码行数:33,代码来源:game.cpp


示例7: QString

void GameManager::initCards()
{
	QStringList cardsNames, c1, c2;
	int i = 0, j = 0, k = 0;
	
	c1 << "king" << "queen" << "jack";
	c2 << "club" << "diamond" << "heart" << "spade"; 
	
	for(i = 0; i < c2.count(); i++)
	{
		for(j = 0; j < c1.count(); j++)
			cardsNames << c1.at(j) + "_" + c2.at(i);
		for(k = 1; k <= 10; k++)
			cardsNames << QString().setNum(k) + "_" + c2.at(i);
	}
	cardsNames += cardsNames;
	
	shuflleCards(cardsNames);
	setCards(cardsNames);
	
	connect(&(basePiles.at(0)) , SIGNAL(fullPileBase()), SLOT(endGame()));
	connect(&(basePiles.at(1)) , SIGNAL(fullPileBase()), SLOT(endGame()));
	connect(&(basePiles.at(2)) , SIGNAL(fullPileBase()), SLOT(endGame()));
	connect(&(basePiles.at(3)) , SIGNAL(fullPileBase()), SLOT(endGame()));
	connect(&(basePiles.at(4)) , SIGNAL(fullPileBase()), SLOT(endGame()));
	connect(&(basePiles.at(5)) , SIGNAL(fullPileBase()), SLOT(endGame()));
	connect(&(basePiles.at(6)) , SIGNAL(fullPileBase()), SLOT(endGame()));
	connect(&(basePiles.at(7)) , SIGNAL(fullPileBase()), SLOT(endGame()));
}
开发者ID:Horsmir,项目名称:frog,代码行数:29,代码来源:gamemanager.cpp


示例8: Figure

void MainWindow::onTimerTick()
{
    Figure newFig = *cur_figure;
    newFig.setPosition(newFig.getPosition().x(), cur_figure->getPosition().y() + 1);
    if (m_cup.hasPlace(newFig)) {
        delete cur_figure;
        cur_figure = new Figure(newFig);
    } else {
        m_cup.putFigure(*cur_figure);
        m_score += m_cup.clearedLines() * 100 + (m_cup.clearedLines() > 0 ? 100 : 0);
        if (m_score >= NEXTLEVELSCORE) {
            m_score = 0;
            if (m_level < MAX_LEVEL)
                m_level++;
            else
                endGame();
            init();
        }
        delete cur_figure;
        cur_figure = new Figure(m_cup);
        if (m_cup.filled())
            gameOver();
    }
    draw();
}
开发者ID:Arjunarus,项目名称:tetris,代码行数:25,代码来源:mainwindow.cpp


示例9: GetWorldTimerManager

void ACSUEGameMode::endRound(FString winningTeam){
    if(winningTeam == FString(TEXT("t")))
        tWins+=1;
    else
        ctWins+=1;
	//reset round time
	GetWorldTimerManager().ClearTimer(roundTimer);
	time = 180;
	//start new round if game is not over
	if (tWins == 5 || ctWins == 5)
		endGame(winningTeam);
	else {

		startRound();
		auto myChar = (ACSUECharacter*)UGameplayStatics::GetPlayerCharacter(GetWorld(), 0);
		if (myChar->myTeam == FString(TEXT("CT"))) {
			FVector spawn = FVector(-3163.f, 1183.f, -227.f);
			myChar->SetActorRotation(FRotator::ZeroRotator);
			myChar->SetActorLocation(spawn, false);

		}
		else {
			FVector spawn = FVector(-6305.f, 9740.f, 584.f);
			myChar->SetActorRotation(FRotator::ZeroRotator);
			myChar->SetActorLocation(spawn, false);
		}
	}

}
开发者ID:narmour,项目名称:goodCSUE,代码行数:29,代码来源:CSUEGameMode.cpp


示例10: switch

void MainMenu::touchEvent(Ref *pSender, TouchEventType type)
{
    switch (type)
    {
        case TOUCH_EVENT_ENDED:

			if (pSender)
			{
				Node *node = static_cast<Node*>(pSender);
				if (node)
				{
					switch (node->getTag())
					{
					case 1:
						gotoBattleScene();
						break;
					case 2:
						endGame();
						break;
					default:
						break;
					}
				}
			}

            break;
            
        default:
            break;
    }
}
开发者ID:qing7ling0,项目名称:LQProjects,代码行数:31,代码来源:MainMenu.cpp


示例11: SLOT

  void MainWindow::initMenu()
  {
    KStandardAction::preferences(this, SLOT(onPreferences()), actionCollection());
    
    m_menu.m_newAction = new QAction(QIcon::fromTheme("file_new"), i18n("&New game"), this);
    actionCollection()->setDefaultShortcut(m_menu.m_newAction, Qt::CTRL + Qt::Key_N);
    
    connect(m_menu.m_newAction, SIGNAL(triggered(bool)), this, SLOT(onNewGame())); 

    actionCollection()->addAction("NewGame", m_menu.m_newAction);
    
    m_menu.m_endAction = actionCollection()->addAction("EndGame", this, SLOT(endGame()));
    m_menu.m_endAction->setIcon(QIcon::fromTheme("window-close"));
    m_menu.m_endAction->setText(i18n("&End game"));
    actionCollection()->setDefaultShortcut(m_menu.m_endAction, Qt::CTRL + Qt::Key_E);
    m_menu.m_endAction->setEnabled(false);
    
    m_menu.m_quitAction = actionCollection()->addAction("Quit", this, SLOT(close()));
    m_menu.m_quitAction->setIcon(QIcon::fromTheme("exit"));
    m_menu.m_quitAction->setText(i18n("&Quit"));
    actionCollection()->setDefaultShortcut(m_menu.m_quitAction, Qt::CTRL + Qt::Key_Q);
    
    m_menu.m_undoAction = actionCollection()->addAction("UndoGame", this);
    m_menu.m_undoAction->setIcon(QIcon::fromTheme("undo"));
    m_menu.m_undoAction->setText(i18n("&Undo"));
    m_menu.m_undoAction->setEnabled(false);
    actionCollection()->setDefaultShortcut(m_menu.m_undoAction, Qt::CTRL + Qt::Key_Z);
  }
开发者ID:Ignotus,项目名称:kdots,代码行数:28,代码来源:mainwindow.cpp


示例12: endGame

void deleteGame::delPts()
{
    if( pts!= 0)
        pts--;
    else
        emit endGame(0);
}
开发者ID:LukasBitter,项目名称:P2,代码行数:7,代码来源:deletegame.cpp


示例13: switch

void GameMenuUserInterface::processSelection(U32 index)
{
   switch(index)
   {
      case 1:
         gOptionsMenuUserInterface.activate();
         break;
      case 2:
         gInstructionsUserInterface.activate();
         break;
      case 3:
         endGame();
         if(EditorUserInterface::editorEnabled)
            gEditorUserInterface.activate();
         else
            gMainMenuUserInterface.activate();
         break;
      case 4:
         gAdminMenuUserInterface.activate();
         break;
      case 5:
         gAdminPasswordEntryUserInterface.activate();
         break;
      default:
         gGameUserInterface.activate();
         if(mGameType.isValid())
            mGameType->processClientGameMenuOption(index);
         break;
   }
}
开发者ID:HwakyoungLee,项目名称:opentnl,代码行数:30,代码来源:UIMenus.cpp


示例14: handle

void handle(uint8_t t) {
	if(t < 11 && t > 0) { //wcisniety ktorys z pierwszych dziesieciu klawiszy
		if(position < 4){ //jezeli jest miejsce
			sendData(t+47); //wypisujemy cyfre
			result[position] = t+47; //ustawiamy cyfre na danej pozycji
			position++; //zwiekszamy pozycje na ktorej wpisujemy nastepna cyfre
			LCDposition++;
		}
	} else if(t == 11) { //klawisz cofania
		if(position > 0) { //jezeli juz cos wpisalismy
			clearOneCharacter(); //usuwamy z wyswietlacza ostatni znak
			position--; //zmniejszamy pozycje do wpisywania
			LCDposition--;
			result[position] = 0; //ucinamy stringa na ostatnim miejscu
		}
	} else if(t == 12) { //klawisz zatwierdzania
		checkResult(); //sprawdz czy wynik jest ok
		if(tries < TRIES_COUNT) { //jezeli nie odpowiedzielismy na zadana liczbe pytan dobrze
			playOneTry(); //gramy nastepna runde
		} else {
			if(player == 1) { //jezeli gracz pierwszy skonczyl
				playerOneTime = time; //zapisujemy jego czas
				player = 2; //zmieniamy gracza
				isStarted = 0; //stopujemy gre
				initGame(); //inicjalizujemy gre
                
			} else {
				playerTwoTime = time; //zapisujemy czas drugiego gracz
				endGame(); //konczymy gre
			}
		}
	}
}
开发者ID:piotrplaneta,项目名称:RTS,代码行数:33,代码来源:project.c


示例15: addScoreArea

  void GameState::handleTick() {
    if (SDL_GetTicks() > nextRound_) {
      roundNumber_++;
      nextRound_ += constants::ROUND_LENGTH;
      lives_ = 4;
    }
    if (SDL_GetTicks() > nextCircle_) {
      addScoreArea();
      calcNextCircle();
    }
    if (SDL_GetTicks() > nextCircleDeath_) {
      size_t pos = -1;
      for (size_t i = 0; i < scoreAreas_.size(); i++) {
        ScoreArea* sa = scoreAreas_.at(i);
        Uint32 age = SDL_GetTicks() - sa->getCreationTime();
        if (age < constants::SCOREAREA_MAX_AGE) {
          pos = i;
          break;
        }
      }
      if (pos != -1) {
	      for (size_t i = 0; i < pos; i++) {
          ScoreArea* sa = scoreAreas_.at(0);
		      scoreAreas_.erase(scoreAreas_.begin());
          lives_--;
          delete sa;
        } 
      }
    }
    if (lives_ == 0) {
      endGame();
    }
  }
开发者ID:ethr,项目名称:reflex,代码行数:33,代码来源:GameState.cpp


示例16: update

void update(int *bx, int *by, bool *running)
{
	int keyIn = getKeyboardInput();
	if(keyIn != 0)
	{
		switch(keyIn)
		{
		case 27: // [ESC]
			endGame(running);
			break;
		case 224: // Special key
			int keyIn2= getKeyboardInput();
			switch(keyIn2)
			{
			case 75: // [<-]
				*bx = *bx-1;
				break;
			case 77: // [->]
				*bx = *bx+1;
				break;
			case 80: // [ v ]
				*by = *by+1;
				break;
			}
			break;
		}
	}
	else
		*by = *by+1;
}
开发者ID:ASPePeX,项目名称:MedienProg,代码行数:30,代码来源:Aufgabe3.cpp


示例17: action

char* action(player* pl, player* w, int in){
    char* msg = "";
    switch(in){
        case KEY_UP:
            msg = playerMove(pl, UP, w);
            break;
        case KEY_DOWN:
            msg = playerMove(pl, DOWN, w);
            break;
        case KEY_LEFT:
            msg = playerMove(pl, LEFT, w);
            break;
        case KEY_RIGHT:
            msg = playerMove(pl, RIGHT, w);
            break;
        case KEY_SHOOT:
            switch(in = input()){
                case KEY_DOWN: msg = playerShoot(pl, DOWN, w); break;
                case KEY_LEFT: msg = playerShoot(pl, LEFT, w); break;
                case KEY_RIGHT: msg = playerShoot(pl, RIGHT, w); break;
                case KEY_UP: msg = playerShoot(pl, UP, w); break;
                default: break;
            }
            break;
        case KEY_QUIT:
            endGame(pl, w);
            break;
        default: break;
    }
    return msg;
}
开发者ID:EricWpG,项目名称:100-Problems,代码行数:31,代码来源:035-matt-wumpus.c


示例18: endGame

void OgreApp::setPause(bool value)
{
    if (value)
    {
        pause = value;
        player->pause();
        OgreFramework::getSingletonPtr()->m_pSoundMgr->pauseAllSounds();
        if (predictSessionOver())
        {
            if (player->getName() == "subject999")
                globals.setMessage("Training is complete!\nPlease check in.\n\nDouble tap to exit.", MESSAGE_FINAL);
            else
                globals.setMessage("That's it for Today!\nPlease check in before you leave.\n\nYou completed: " + Util::toStringInt(player->getNumStagesWon()) + " stages!\n\nDouble tap to exit.", MESSAGE_FINAL);
            endGame();
        }
        else
        {
            globals.appendMessage("\n\nSwipe to Continue", MESSAGE_NORMAL);
#ifdef DEBUG_MODE
            globals.appendMessage("\n\n" + player->getSkillLevel().getCurrentStats(), MESSAGE_NORMAL);
            globals.appendMessage("\n\n" + Util::toStringInt(globals.sessionTime - getTotalElapsed()), MESSAGE_NORMAL);
#endif
        }
        Ogre::ControllerManager::getSingleton().setTimeFactor(0);
    }
    else if (!sessionOver)
    {
        pause = value;
        player->unpause();
        OgreFramework::getSingletonPtr()->m_pSoundMgr->resumeAllPausedSounds();
        
        globals.clearMessage();
        Ogre::ControllerManager::getSingleton().setTimeFactor(1);
    }
}
开发者ID:animekraxe,项目名称:brain-game,代码行数:35,代码来源:OgreApp.cpp


示例19: endGame

//侦听子元素链接开始
void HelloWorld::BeginContact(b2Contact* contact) {
	if(contact->GetFixtureA()->GetBody()->GetUserData()==bird||
	   contact->GetFixtureB()->GetBody()->GetUserData()==bird){
			  CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("mp3/dead.wav");
			  endGame();
		  // CCMessageBox("游戏失败","游戏失败");
	}
}
开发者ID:verylove,项目名称:YtTouchBird,代码行数:9,代码来源:HelloWorldScene.cpp


示例20: endGame

void GameController::restartGame()
{
	if (isGameStarted_)
	{
		endGame();
		startGame();
	}
}
开发者ID:haksist,项目名称:Chmo-engine,代码行数:8,代码来源:GameController.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ endInsertRows函数代码示例发布时间:2022-05-30
下一篇:
C++ endEditCP函数代码示例发布时间: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