Exemple #1
0
int main()
{
    sf::RenderWindow app(sf::VideoMode(768, 512), "Cheese Multiplayer - Alpha");

	GameState *gameState = new PlayState(&app);

	//app.SetFramerateLimit(6);

	while (app.IsOpened())
    {
        sf::Event event;
       if (app.GetEvent(event))
        {
            if (event.Type == sf::Event::Closed)
                app.Close();

            gameState->EventUpdate(event);
        }

        GameState *oldState = gameState;
        if((gameState=gameState->Update(app)) != oldState)
        {
            delete oldState;
        }

        app.Clear();

        gameState->Draw(app);

        app.Display();
    }

    return EXIT_SUCCESS;
}
int main() {
	feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
	GameState gamestate = GameState();
	ShibataBot bot = ShibataBot();

	bot.gamestate = &gamestate;
	bot.myShip = gamestate.myShip;

	while (bot.myShip != NULL) {
		gamestate.Update();
		bot.Update();
		gamestate.WriteData();
	}

	return 0;
}
Exemple #3
0
void Game::update()
{
		//updateTimer->tick();

//===========================================================================================
//								 UPDATE ITERATOR
//===========================================================================================

	std::vector<GameState*>::iterator it;
	for (it = states.begin(); it != states.end(); it++)
	{
		if (*it)
		{  
			  GameState* s = (*it);
			  if(s->active==true)
			  s->Update();
		}

	}
}