libs/MainMenuState.cpp
/**
	 * @brief Provide interface to handle inputs in the MainMenu State
	 *
	 * @param delta Time difference between two handle_input call
	 */
@brief Provide interface to handle inputs in the MainMenu State
@param delta Time difference between two handle_input call
@brief Provide interface to handle inputs in the MainMenu State @param delta Time difference between two handle_input call
void MainMenuState::handle_input(float delta) {
		sf::Event event;
		while(data->window.pollEvent(event)) {
			if (sf::Event::Closed == event.type) {
				data->machine.add_state(StateRef(new GameOverState(data)), true);
			}
			else if(data->input.is_sprite_clicked(host_play_button_sprite,sf::Mouse::Left,data->window)) {
				std::cout << "Adding ServerRoom" << std::endl;
				data->machine.add_state(StateRef(new ServerRoom(data)), false);
			}
			else if(data->input.is_sprite_clicked(single_play_button_sprite,sf::Mouse::Left,data->window)){
				std::cout << "Button is pressed" << std::endl;
				data->machine.add_state(StateRef(new ServerState((data), std::set<std::shared_ptr<Client>>())), false);
			}
			else if(data->input.is_sprite_clicked(join_play_button_sprite,sf::Mouse::Left,data->window)) {
				std::cout<<"Entering ClientRoom"<<std::endl;
				data->machine.add_state(StateRef(new ClientRoom(data)), false);
			}
			if (sf::Keyboard::isKeyPressed(sf::Keyboard::S)) {
				data->machine.add_state(StateRef(new ServerState(data, std::set<std::shared_ptr<Client>>())), false);
			}
		}
	}
void MainMenuState :: handle_input ( float delta ) { sf :: Event event ; while ( data -> window . pollEvent ( event ) ) { if ( sf :: Event :: Closed == event . type ) { data -> machine . add_state ( StateRef ( new GameOverState ( data ) ) , true ) ; } else if ( data -> input . is_sprite_clicked ( host_play_button_sprite , sf :: Mouse :: Left , data -> window ) ) { std :: cout << " " << std :: endl ; data -> machine . add_state ( StateRef ( new ServerRoom ( data ) ) , false ) ; } else if ( data -> input . is_sprite_clicked ( single_play_button_sprite , sf :: Mouse :: Left , data -> window ) ) { std :: cout << " " << std :: endl ; data -> machine . add_state ( StateRef ( new ServerState ( ( data ) , std :: set < std :: shared_ptr < Client > > ( ) ) ) , false ) ; } else if ( data -> input . is_sprite_clicked ( join_play_button_sprite , sf :: Mouse :: Left , data -> window ) ) { std :: cout << " " << std :: endl ; data -> machine . add_state ( StateRef ( new ClientRoom ( data ) ) , false ) ; } if ( sf :: Keyboard :: isKeyPressed ( sf :: Keyboard :: S ) ) { data -> machine . add_state ( StateRef ( new ServerState ( data , std :: set < std :: shared_ptr < Client > > ( ) ) ) , false ) ; } } }
@brief Provide interface to handle inputs in the MainMenu State
 @param delta Time difference between two handle_input call
@brief Provide interface to handle inputs in the MainMenu State @param delta Time difference between two handle_input call