text: #include "Pipe.hpp"
  #include "DEFINITIONS.hpp"
  
  namespace Sonar
  {
  	Pipe::Pipe(GameDataRef data) : _data(data)
  	{
  	}
  
  	void Pipe::SpawnBottomPipe()
  	{
  		sf::Sprite sprite(this->_data->assets.GetTexture("Pipe Up"));
  
  		sprite.setPosition(this->_data->window.getSize().x, this->_data->window.getSize().y - sprite.getLocalBounds().height);
  
  		pipeSprites.push_back(sprite);
  	}
  
  	void Pipe::SpawnTopPipe()
  	{
  		sf::Sprite sprite(this->_data->assets.GetTexture("Pipe Down"));
  
  		sprite.setPosition(this->_data->window.getSize().x, 0);
  
  		pipeSprites.push_back(sprite);
  	}
  
  	void Pipe::SpawnInvisiblePipe()
  	{
  		sf::Sprite sprite(this->_data->assets.GetTexture("Pipe Down"));
  
  		sprite.setPosition(this->_data->window.getSize().x, 0);
  		sprite.setColor(sf::Color(0, 0, 0, 0));
  
  		pipeSprites.push_back(sprite);
  	}
  
  	void Pipe::MovePipes(float dt)
  	{
  		for (unsigned short int i = 0; i < pipeSprites.size(); i++)
  		{
  			sf::Vector2f position = pipeSprites.at(i).getPosition();
  			float movement = PIPE_MOVEMENT_SPEED * dt;
  
  			pipeSprites.at(i).move(-movement, 0);
  		}
  	}
  
  	void Pipe::DrawPipes()
  	{
  		for (unsigned short int i = 0; i < pipeSprites.size(); i++)
  		{
  			this->_data->window.draw(pipeSprites.at(i));
  		}
  	}
  }