libs/PlayerCar.cpp
/**
	 * @brief Utility function to draw sprites of the car.
	 *
	 * @param line Provides info regarding map scale at the current grid the car is positioned at
	 */
@brief Utility function to draw sprites of the car.
@param line Provides info regarding map scale at the current grid the car is positioned at
@brief Utility function to draw sprites of the car . @param line Provides info regarding map scale at the current grid the car is positioned at
void PlayerCar::drawSprite(const Line &line) {
		sf::Sprite &s = sprite;
		int w = s.getTextureRect().width;
		int h = s.getTextureRect().height;
		float destX = line.X + line.scale * e_position.x * SCREEN_WIDTH / 2;
		float destY = line.Y + 4;
		float destW = w * line.W / 266;
		float destH = h * line.W / 266;
		destX += destW * e_position.x; 
		destY -= destH;				   
		float clipH = destY + destH - line.clip;
		if (clipH < 0)
			clipH = 0;
		if (clipH >= destH)
			return;
		s.setScale(destW / w, destH / h);
		s.setPosition(destX, destY);
		data->window.draw(s);
	}
void PlayerCar :: drawSprite ( const Line & line ) { sf :: Sprite & s = sprite ; int w = s . getTextureRect ( ) . width ; int h = s . getTextureRect ( ) . height ; float destX = line . X + line . scale * e_position . x * SCREEN_WIDTH / 2 ; float destY = line . Y + 4 ; float destW = w * line . W / 266 ; float destH = h * line . W / 266 ; destX += destW * e_position . x ; destY -= destH ; float clipH = destY + destH - line . clip ; if ( clipH < 0 ) clipH = 0 ; if ( clipH >= destH ) return ; s . setScale ( destW / w , destH / h ) ; s . setPosition ( destX , destY ) ; data -> window . draw ( s ) ; }
@brief Utility function to draw sprites of the car.
@brief Utility function to draw sprites of the car .
//offsetX //offsetY