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


C++ GameOver函数代码示例

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


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


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