libs/GameSimulator.cpp
/**
	 * @brief This method provide the room for drawing all the elements on the window
	 *
	 * @param delta Time difference between two accumulator
	 */
@brief This method provide the room for drawing all the elements on the window
@param delta Time difference between two accumulator
@brief This method provide the room for drawing all the elements on the window @param delta Time difference between two accumulator
void GameSimulator::draw(float delta) {
		resource_store->window.clear(sf::Color(105, 205, 4));
		if(!is_main_player_available())return;
		map.draw(500, main_camera);
		draw_all_players();
		int startPos = map.get_grid_index(main_camera.getPosition().z);
		for (int n = startPos + 500; n > startPos; n--) {
			drawSprite(map.lines[n % map.getGridCount()]);
			for(auto &player_i:players_map) {
				int index = map.get_grid_index(player_i.second.getPosition().z) ;
				if (index >= n - 1 and index <= n + 1)
					draw_player(player_i.second);
			}
		}
		for (auto itr : bullet_set[current])
		{
			int index = (itr->e_position.z) / map.getSegL();
			itr->drawSprite(map.lines[index]);
		}
		bar.draw();
		for (int i = 0; i < 3; i++)
		{
			resource_store->window.draw(text[i]);
		}
		resource_store->window.display();
	}
void GameSimulator :: draw ( float delta ) { resource_store -> window . clear ( sf :: Color ( 105 , 205 , 4 ) ) ; if ( ! is_main_player_available ( ) ) return ; map . draw ( 500 , main_camera ) ; draw_all_players ( ) ; int startPos = map . get_grid_index ( main_camera . getPosition ( ) . z ) ; for ( int n = startPos + 500 ; n > startPos ; n -- ) { drawSprite ( map . lines [ n % map . getGridCount ( ) ] ) ; for ( auto & player_i : players_map ) { int index = map . get_grid_index ( player_i . second . getPosition ( ) . z ) ; if ( index >= n - 1 and index <= n + 1 ) draw_player ( player_i . second ) ; } } for ( auto itr : bullet_set [ current ] ) { int index = ( itr -> e_position . z ) / map . getSegL ( ) ; itr -> drawSprite ( map . lines [ index ] ) ; } bar . draw ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { resource_store -> window . draw ( text [ i ] ) ; } resource_store -> window . display ( ) ; }
@brief This method provide the room for drawing all the elements on the window
 @param delta Time difference between two accumulator
@brief This method provide the room for drawing all the elements on the window @param delta Time difference between two accumulator
////// Finding camera position and camera height /// ///////////////////////////////////////////////////