libs/GameSimulator.cpp
/**
	 * @brief Utility function fo drawing the map and sprites
	 *
	 * @param line Line contains the scale and X,Y of the grid of map.
	 */
@brief Utility function fo drawing the map and sprites
@param line Line contains the scale and X,Y of the grid of map.
@brief Utility function fo drawing the map and sprites @param line Line contains the scale and X Y of the grid of map .
void GameSimulator::drawSprite(Line &line) {
		sf::Sprite s = line.sprite;
		int w = s.getTextureRect().width;
		int h = s.getTextureRect().height;
		float destX = line.X + line.scale * line.spriteX * map.getScreenWidth() / 2;
		float destY = line.Y + 4;
		float destW = w * line.W / 266;
		float destH = h * line.W / 266;
		destX += destW * line.spriteX; 
		destY += destH * (-1);		   
		float clipH = destY + destH - line.clip;
		if (clipH < 0)
			clipH = 0;
		if (clipH >= destH)
			return;
		s.setTextureRect(sf::IntRect(0, 0, w, h - h * clipH / destH));
		s.setScale(destW / w, destH / h);
		s.setPosition(destX, destY);
		resource_store->window.draw(s);
	}
void GameSimulator :: drawSprite ( Line & line ) { sf :: Sprite s = line . sprite ; int w = s . getTextureRect ( ) . width ; int h = s . getTextureRect ( ) . height ; float destX = line . X + line . scale * line . spriteX * map . getScreenWidth ( ) / 2 ; float destY = line . Y + 4 ; float destW = w * line . W / 266 ; float destH = h * line . W / 266 ; destX += destW * line . spriteX ; destY += destH * ( -1 ) ; float clipH = destY + destH - line . clip ; if ( clipH < 0 ) clipH = 0 ; if ( clipH >= destH ) return ; s . setTextureRect ( sf :: IntRect ( 0 , 0 , w , h - h * clipH / destH ) ) ; s . setScale ( destW / w , destH / h ) ; s . setPosition ( destX , destY ) ; resource_store -> window . draw ( s ) ; }
@brief Utility function fo drawing the map and sprites
 @param line Line contains the scale and X,Y of the grid of map.
@brief Utility function fo drawing the map and sprites @param line Line contains the scale and X Y of the grid of map .
//offsetX //offsetY