libs/MainMenuState.cpp
/**
	 * @brief This function initializes all the components of MainMenu state.
	 *
	 */
@brief This function initializes all the components of MainMenu state.
@brief This function initializes all the components of MainMenu state .
void MainMenuState::init() {
		data->assets.load_texture("MainMenuStateBackground",MAIN_MENU_BACKGROUND_FILEPATH);
		data->assets.load_texture("PlayButton3", RESUME_BUTTON_FILEPATH);
		data->assets.load_texture("PlayButton2_host", HOST_PLAY_BUTTON_FILEPATH);
		data->assets.load_texture("PlayButton2_join", JOIN_PLAY_BUTTON_FILEPATH);
		data->assets.load_texture("PlayButton1", SINGLE_PLAY_BUTTON_FILEPATH);
		background_sprite.setTexture(data->assets.get_texture("MainMenuStateBackground"));
		background_sprite.scale(1, 600.0f / 512.0f);
		background_sprite.setPosition(SCREEN_WIDTH / 2 - background_sprite.getGlobalBounds().width / 2, SCREEN_HEIGHT / 2.1f - background_sprite.getGlobalBounds().height / 2);
		single_play_button_sprite.setTexture(data->assets.get_texture("PlayButton1"));
		single_play_button_sprite.scale(Scaling_factor/2.5f);
		single_play_button_sprite.setPosition(SCREEN_WIDTH / 2 - single_play_button_sprite.getGlobalBounds().width / 2, SCREEN_HEIGHT / 2 - single_play_button_sprite.getGlobalBounds().height / 2);
		single_play_button_sprite.setColor(sf::Color(255,255,255,220));
		host_play_button_sprite.setTexture(data->assets.get_texture("PlayButton2_host"));
		host_play_button_sprite.scale(Scaling_factor/2.5f);
		host_play_button_sprite.setPosition(SCREEN_WIDTH / 2 - host_play_button_sprite.getGlobalBounds().width / 2, SCREEN_HEIGHT / 2 + host_play_button_sprite.getGlobalBounds().height/1.2);
		host_play_button_sprite.setColor(sf::Color(255,255,255,220));
		join_play_button_sprite.setTexture(data->assets.get_texture("PlayButton2_join"));
		join_play_button_sprite.scale(Scaling_factor/2.5f);
		join_play_button_sprite.setPosition(SCREEN_WIDTH / 2 - join_play_button_sprite.getGlobalBounds().width / 2, SCREEN_HEIGHT / 2 + 2*join_play_button_sprite.getGlobalBounds().height);
		join_play_button_sprite.setColor(sf::Color(255,255,255,220));
	}
void MainMenuState :: init ( ) { data -> assets . load_texture ( " " , MAIN_MENU_BACKGROUND_FILEPATH ) ; data -> assets . load_texture ( " " , RESUME_BUTTON_FILEPATH ) ; data -> assets . load_texture ( " " , HOST_PLAY_BUTTON_FILEPATH ) ; data -> assets . load_texture ( " " , JOIN_PLAY_BUTTON_FILEPATH ) ; data -> assets . load_texture ( " " , SINGLE_PLAY_BUTTON_FILEPATH ) ; background_sprite . setTexture ( data -> assets . get_texture ( " " ) ) ; background_sprite . scale ( 1 , 600.0f / 512.0f ) ; background_sprite . setPosition ( SCREEN_WIDTH / 2 - background_sprite . getGlobalBounds ( ) . width / 2 , SCREEN_HEIGHT / 2.1f - background_sprite . getGlobalBounds ( ) . height / 2 ) ; single_play_button_sprite . setTexture ( data -> assets . get_texture ( " " ) ) ; single_play_button_sprite . scale ( Scaling_factor / 2.5f ) ; single_play_button_sprite . setPosition ( SCREEN_WIDTH / 2 - single_play_button_sprite . getGlobalBounds ( ) . width / 2 , SCREEN_HEIGHT / 2 - single_play_button_sprite . getGlobalBounds ( ) . height / 2 ) ; single_play_button_sprite . setColor ( sf :: Color ( 255 , 255 , 255 , 220 ) ) ; host_play_button_sprite . setTexture ( data -> assets . get_texture ( " " ) ) ; host_play_button_sprite . scale ( Scaling_factor / 2.5f ) ; host_play_button_sprite . setPosition ( SCREEN_WIDTH / 2 - host_play_button_sprite . getGlobalBounds ( ) . width / 2 , SCREEN_HEIGHT / 2 + host_play_button_sprite . getGlobalBounds ( ) . height / 1.2 ) ; host_play_button_sprite . setColor ( sf :: Color ( 255 , 255 , 255 , 220 ) ) ; join_play_button_sprite . setTexture ( data -> assets . get_texture ( " " ) ) ; join_play_button_sprite . scale ( Scaling_factor / 2.5f ) ; join_play_button_sprite . setPosition ( SCREEN_WIDTH / 2 - join_play_button_sprite . getGlobalBounds ( ) . width / 2 , SCREEN_HEIGHT / 2 + 2 * join_play_button_sprite . getGlobalBounds ( ) . height ) ; join_play_button_sprite . setColor ( sf :: Color ( 255 , 255 , 255 , 220 ) ) ; }
@brief This function initializes all the components of MainMenu state.
@brief This function initializes all the components of MainMenu state .