Esempio n. 1
0
int main()
{
	sf::VideoMode videoMode(WINDOW_WIDTH, WINDOW_HEIGHT);
	sf::RenderWindow window(videoMode, "~~~Tower Defense!~~~");
	window.setFramerateLimit(FRAME_RATE);

	shared_ptr<AudioManager> audio = AudioManager::getAudioManager();
	audio->play();

	MenuManager* menuManager = MenuManager::getMenuManager();
	menuManager->addMenu(make_shared<StartMenu>(START_MENU_TEXTURE, sf::Vector2u(1100, 600), sf::Vector2i(0, 0)));

	while (window.isOpen())
	{
		window.clear();

		sf::Event event;
		while (window.pollEvent(event))
		{
			if ((event.type == sf::Event::Closed) ||
				(menuManager->getExitFlag() == true))
				window.close();
			
			menuManager->resolveEvent(event);
		}

		menuManager->display(window);
		window.display();
	
	}
	return EXIT_SUCCESS;
}
Esempio n. 2
0
void StartMenu::startGame()
{
	MenuManager* m = MenuManager::getMenuManager();

	m->popMenu();
	m->addMenu(make_shared<GameMenu>(GAME_MENU_DEFAULT_TEXTURE, sf::Vector2u(WINDOW_WIDTH, WINDOW_HEIGHT), sf::Vector2i(0, 0)));

	//this -> ~StartMenu();
}
Esempio n. 3
0
void StartMenu::openCredits()
{
	MenuManager* m = MenuManager::getMenuManager();
	openCreditsButton.setClickedState(false);
	m->addMenu(make_shared<CreditsMenu>(CREDITS_SPRITE_ADD, sf::Vector2u(WINDOW_WIDTH, WINDOW_HEIGHT), sf::Vector2i(0, 0)));
}