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

C++ GameOver函数代码示例

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

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



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

示例1: GetEndTime

void ThreadProc::StatusEndProc ()
{
    GetEndTime ();
    UIFreshFoo(theTaskList.length ()-1);
    GameOver ();
    return;
}
开发者ID:crazybun,项目名称:FreshTerminalOperatingTools,代码行数:7,代码来源:threadproc.cpp


示例2: GameOver

void LifeCounter::Die() {
	if (lives == 0) {
		GameOver();
	} else {
		lives--;
	}
}
开发者ID:shader,项目名称:asteroids,代码行数:7,代码来源:life_counter.cpp


示例3: GameOver

void Game::GameOver()
{
    sf::Texture BackgroundTexture;
    sf::Sprite BackgroundSprite;
    BackgroundTexture.loadFromFile("Graphics/MainMenu.jpg");
    BackgroundSprite.setTexture(BackgroundTexture);
    sf::Text GameOver("Game Over...", Font, 90U);
    GameOver.setStyle(sf::Text::Bold);
    GameOver.setPosition(300, 320);

    sf::Event Event;
    while(Window.isOpen()) 
    {
        while(Window.pollEvent(Event))
        {
            if(Event.type == sf::Event::KeyPressed)
            {
                exit(0);
            }
        }
        Window.clear();
        Window.draw(BackgroundSprite);
        Window.draw(GameOver);
        Window.display();
    }
}
开发者ID:ne555,项目名称:Dreaming-Warrior,代码行数:26,代码来源:game.cpp


示例4: RemoveLine

void CTetrisDlg::OnTimer(UINT_PTR nIDEvent)
{
    if(m_pBlock->canMoveDown())
    {
        m_pBlock->moveDown();
    }
    else
    {
        for(CHAR i = ROW - 1; i >= 0; --i)
        {
            if(CheckLine(i))
            {
                RemoveLine(i);
                ++i;
            }
        }
        MSG msg;
        while(::PeekMessage(&msg, m_hWnd, 0, 0, PM_REMOVE));
        if(IsGameOver(m_gameParam & 0xE0))
        {
            GameOver();
        }
        else
        {
            delete m_pBlock;
            m_pBlock = BlockFromIndex(m_gameParam & 0xE0);
            NextRandomBlock();
            m_nextColor = NextRandomColor();
        }
    }
    Invalidate(FALSE);
    CDialog::OnTimer(nIDEvent);
}
开发者ID:zhangsu,项目名称:tetris,代码行数:33,代码来源:TetrisDlg.cpp


示例5: pad_update

void MyPS2Application::Update()
{
	// Tell DMAC to send previous graphics data to Graphics Synthesiser (GS)
	VIFDynamicDMA.Fire();
	
	// Read the control pad into data buffer
	pad_update(PAD_0);
	
	// Check for exit condition
	if((pad[0].buttons & PAD_START)&&(pad[0].buttons & PAD_SELECT)) quitting_ = true;

	// State Handler
	switch (game_state)
	{
	case INTRO:
		Intro();
		break;
	
	case MENU:
		Menu();
		break;
		
	case GAME:
		Game();
		break;
		
	case GAME_OVER:
		GameOver();
		break;
	}
	
	DSP0.HandleAudio();
	DSP1.HandleAudio();
}
开发者ID:Gi133,项目名称:Playstation2Coursework2,代码行数:34,代码来源:MyPS2Application.cpp


示例6: InitGame

// Handle the gameflow, start, restartm die...etc.
void ShipRace::Update()
{
	// Get the button to start the game if the game is not already started...Meh !
	if (gDInput->keyPressed(DIK_SPACE) && !mGameStarted)
	{
		// Init the game
		InitGame();
	}
	
	// If gameOver...
	if (!mGameOver)
	{
		// and the game is started...
		if (mGameStarted)
		{
			// and the ship is dead
			if (ship->GetIsDead())
			{
				// Gameover !
				GameOver();
			}
		}
	}
	// Else if space is pressed and it is gameover
	else if (gDInput->keyPressed(DIK_SPACE) && mGameOver)
	{
		// Restart the game
		RestartGame();
	}
	
}
开发者ID:SharpNip,项目名称:3DShip,代码行数:32,代码来源:ShipRace.cpp


示例7: switch

bool GameClassic::doRun()
{
	SDL_Event event;
	if(SDL_PollEvent(&event))
	{
		switch(event.type)
		{
			case SDL_QUIT:
			{
				return false;
				break;
			}
			case SDL_KEYDOWN:
			{
				if ( event.key.keysym.sym == SDLK_ESCAPE ) 
				{
					m_mgr->SetActiveModule(MAINMENU);
					return true;
				} 
				if ( event.key.keysym.sym == SDLK_p || event.key.keysym.sym == SDLK_SPACE) 
				{
					doPause();
				} 
				if ( event.key.keysym.sym == SDLK_UP && snake->GetDirection()!=Down) 
				{
					snake->SetDirection(Up);
				} 
				if ( event.key.keysym.sym == SDLK_DOWN && snake->GetDirection()!=Up) 
				{
					snake->SetDirection(Down);
				} 
				if ( event.key.keysym.sym == SDLK_LEFT && snake->GetDirection()!=Right) 
				{
					snake->SetDirection(Left);
				} 
				if ( event.key.keysym.sym == SDLK_RIGHT && snake->GetDirection()!=Left) 
				{
					snake->SetDirection(Right);
				} 
				break;
			}
		}

	}
	if(snake->Move())
	{
		Converter.Convert();
		DrawField();
		DrawTop();
		SDL_Delay(50);
	}
	else
	{
		Converter.Convert();
		DrawField();
		DrawTop();
		GameOver();		
	}
	return true;
}
开发者ID:Jeky-v,项目名称:Snake,代码行数:60,代码来源:GameClassic.cpp


示例8: main

int main(void)
{
	int menu;
	FsOpenWindow(32, 32, winWidth, winHeight, 1); // 800x600 pixels, useDoubleBuffer=1

	int listBase;
	listBase=glGenLists(256);
	YsGlUseFontBitmap8x12(listBase);
	glListBase(listBase);

	glDisable(GL_DEPTH_TEST);
	glDisable(GL_LIGHTING);
	glDepthFunc(GL_ALWAYS);

	while(1)
	{
		menu=Menu();
		if(menu==1)
		{
			int score;
			score=Game();
			GameOver(score);
		}
		else if(menu==eStop)
		{
			break;
		}
	}

	return 0;
}
开发者ID:NGAEVA,项目名称:OpenGLFramework,代码行数:31,代码来源:simpleProjectile.cpp


示例9: GameOver

void Level::Update(float dt)
{
    world->Step((dt / 100), 5, 5);
    if (player->GetYPos() > lvlHeight)
    {

        GameOver();
    }
}
开发者ID:mjowned,项目名称:GameDev,代码行数:9,代码来源:Level.cpp


示例10: siguientePieza

void ControlTetris::siguientePieza(){
	posX = 3;
	posY = 1;
	if(p != NULL) delete p;
	p = pSig;
	if(!mt->pintaPiezaEn(*p,posY,posX))	throw(GameOver(*mt));
	pSig = piezaAleatoria();
	mt->pintaPiezaSig(*pSig);
}
开发者ID:eldruin,项目名称:blocksfall,代码行数:9,代码来源:controlTetris.cpp


示例11: switch

void StepManiaLanServer::ParseData(PacketFunctions& Packet, const unsigned int clientNum)
{
	int command = Packet.Read1();
	switch (command)
	{
	case NSCPing:
		// No Operation
		SendValue(NSServerOffset + NSCPingR, clientNum);
		break;
	case NSCPingR:
		// No Operation response
		break;
	case NSCHello:
		// Hello
		Hello(Packet, clientNum);
		break;
	case NSCGSR:
		// Start Request
		Client[clientNum]->StartRequest(Packet);
		CheckReady();  //This is what ACTUALLY starts the games
		break;
	case NSCGON:
		// GameOver 
		GameOver(Packet, clientNum);
		break;
	case NSCGSU:
		// StatsUpdate
		Client[clientNum]->UpdateStats(Packet);
		if (!Client[clientNum]->lowerJudge)
			CheckLowerJudge(clientNum);
		break;
	case NSCSU:
		// Style Update
		Client[clientNum]->StyleUpdate(Packet);
		SendUserList();
		break;
	case NSCCM:
		// Chat message
		AnalizeChat(Packet, clientNum);
		break;
	case NSCRSG:
		SelectSong(Packet, clientNum);
		break;
	case NSCSMS:
		ScreenNetMusicSelectStatus(Packet, clientNum);
		break;
	case NSCUPOpts:
		Client[clientNum]->Player[0].options = Packet.ReadNT();		
		Client[clientNum]->Player[1].options = Packet.ReadNT();		
		break;
	default:
		break;
	}
}	 
开发者ID:augustg,项目名称:stepmania-3.9,代码行数:54,代码来源:NetworkSyncServer.cpp


示例12: drop

void Grid::drop()
{
	if(GameOver())
	{
		return;
	}

	while(!collision())
	{
		current->nudge(0,-1);
	}
}
开发者ID:VileLasagna,项目名称:WarpDrive,代码行数:12,代码来源:Grid.cpp


示例13: KeyInput

// 블럭 상태 및 스테이지 업뎃
void Tetris::Update()
{
	int key = KeyInput();
	switch( stage )
	{
	case INIT :
		press_any_key( key );
		break;
	case READY :
		level_select( key );
		break;
	case RUNNING :
		m_block->Move( key );

		// 블럭이 바닥이나 다른 블럭에 닿았다면 합침
		if( m_block->GetBlockState() == 2 )
			merge_block( m_block->GetBlockX(), m_block->GetBlockY() );

		// 꽉 찬 라인이 있는지 확인
		m_full_line_num = check_full_line();
		if( m_full_line_num != 0 )
			full_line_Set();

		if( stage_data[m_level].clear_line == m_line )
		{
			++m_level;
			if( m_level >= MAX_STAGE )
			{
				stage = SUCCESS;
			}
			m_line = 0;
		}

		// 게임 오버~
		if( GameOver() )
			stage = FAILED;
		break;
	case SUCCESS:
	case FAILED:
		if( key == 'y' || key == 'Y' )
		{
			stage = READY;
			Init();
		}
		if( key == 'n' || key == 'N' )
			stage = RESULT;
		break;
	case RESULT:
			m_bIsGameOver = true;
		break;
	}
}
开发者ID:hoseogame,项目名称:20121705,代码行数:53,代码来源:tetris.cpp


示例14: spin

void Grid::spin()
{
	if(GameOver())
	{
		return;
	}

	if (current)
	{
		SoundManager::instance()->playSound(spinfx);
		current->spin();
	}
}
开发者ID:VileLasagna,项目名称:WarpDrive,代码行数:13,代码来源:Grid.cpp


示例15: MoveStep

void GameLayer::update(float dt){
    if (!HeadCollideBody(head->getDirec()) && !OutofRange()) {
         MoveStep();
        if(ifGetFood()){
            AddBody();
            SetFood();
        }
        lastbodyposi = body.at(body.size()-1)->getPosition();
    }
    else{
        GameOver();
    }
}
开发者ID:Ajunboys,项目名称:Snake-1,代码行数:13,代码来源:GameLayer.cpp


示例16: Refresh

void byoSnake::Died()
{
    if ( --m_Lives == 0 )
    {
        Refresh();
        GameOver();
        return;
    }

    InitializeSnake();
    RandomizeApple();
    StartSnake();
}
开发者ID:stahta01,项目名称:codeAdapt_IDE,代码行数:13,代码来源:byosnake.cpp


示例17: switch

void CGame::Play()
{
	CBoard *Board = new CBoard;
	Board->DrawBoard();
	delete Board;
	CSnake *Snake = new CSnake;
	//sets difficulty
	switch(dif_lvl)
	{
	case easy:
		CSnake::delay = 160;
		CSnake::multiplier = 1;
		break;
	case medium:
		CSnake::delay = 140;
		CSnake::multiplier = 1;
		break;
	case hard:
		CSnake::delay = 120;
		CSnake::multiplier = 0.9;
		break;
	case extreme:
		CSnake::delay = 100;
		CSnake::multiplier = 0.8;
		break;
	}
	while(Snake->Move() != 0)
	{
		if(GetAsyncKeyState(VK_UP) & 0x8000)
		{
			Snake->ChangeDirection(up);
		}
		else if(GetAsyncKeyState(VK_DOWN) & 0x8000)
		{
			Snake->ChangeDirection(down);
		}
		else if(GetAsyncKeyState(VK_LEFT) & 0x8000)
		{
			Snake->ChangeDirection(static_cast<Direction>(2));
		}
		else if(GetAsyncKeyState(VK_RIGHT) & 0x8000)
		{
			Snake->ChangeDirection(static_cast<Direction>(3));
		}
		else if(GetAsyncKeyState(VK_ESCAPE) & 0x8000)
			break; 
	}
	int score = Snake->GetScore();
	delete Snake;
	GameOver(score);
}
开发者ID:mchudy,项目名称:console-snake,代码行数:51,代码来源:Game.cpp


示例18: GameOver

void GameScene::Update( float elapsedTime )
{
	GameStateModel::Update(elapsedTime);
	if (GameStateModel::TimeRemaining() <= 0) {
		GameOver();
		return;
	}

	ScoreView::Update(elapsedTime);
	TimerController::Update(elapsedTime);
	BoardView::get()->Update(elapsedTime);
	SelectedTextLabel::get()->Update(elapsedTime);
	TimeTankView::Update(elapsedTime);
}
开发者ID:markromedia,项目名称:gameplay-words,代码行数:14,代码来源:game_scene.cpp


示例19: CheckKey

void GameManager::AI()
{
	CheckKey();
	if (GameStart() && !GamePause() && !GameOver())
	{
		Produce(_T("Enemy"));
		Produce(_T("Cloud"));
		Produce(_T("Angela"));
		CheckCollision();
		MoveIt();
		Fire();
		TrashRecycle();
	}
}
开发者ID:VivienCheng,项目名称:SkyPlane,代码行数:14,代码来源:GameManager.cpp


示例20: Megamaniac

// This is my primary Event Loop. This is where most of the fun stuff happens ;)
void Megamaniac() {
    // WTF does this do? Something to do with my Data Structure I assume...
    Game game;

	while (true) {
	    // Let's run our initial setup to get everything for the game ready.
	    SetupGame(&game);

	    // Do we need to change the level? Not really but we should probably start at Level 1.
	    ChangeLevel(&game);

		// This is where the Event Loop actually starts. This will run repeatedly until our game is over.
	    while (!game.game_over) {
		    clear_screen();
		    GameStats(&game);
			int userInput = UserInput(&game);
		    MovementPlayer(&game, userInput);
			MovementMissiles(&game, userInput);
		    MovementAliens(&game);
			MovementBombs(&game);
			MovementBonuses(&game);

			CollisionMissiles(&game);
			CollisionAliens(&game);
		    CollisionBombs(&game);
			CollisionBonuses(&game);

			UpdateScreen(&game);
		    show_screen();
		    timer_pause(25);
	    }

		GameOver(&game);

		int userInput = wait_char();
		while (userInput != 'r' && userInput >= 0) {
			if (userInput == 'q') {
				exit(0);
			}
			if (userInput == 'r') {
				Megamaniac();
			}
			userInput = wait_char();
		}
	}
}
开发者ID:trjstewart,项目名称:qut-cab202,代码行数:47,代码来源:megamaniac.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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