i tried wiht a vector but it doesn't work, one light is nice. but with a RenderTexture there is no way to add lights if the "Game" is running.
CLights::CLights(int SizeX, int SizeY)
{
m_SizeX = SizeX;
m_SizeY = SizeY;
m_RTex.create(m_SizeX, m_SizeY);
}
void CLights::AddLigth(int PosX, int PosY, int Radius, sf::Color TempColor, sf::RenderWindow &window)
{
m_SpriteBackground.setTexture(m_RTex.getTexture(), true);
m_SpriteBackground.setPosition(0, 0);
m_SpriteBackground.setColor(sf::Color(0,0,0,255));
m_CircleLight.setPosition(sf::Vector2f(Mouse.getPosition(window).x, Mouse.getPosition(window).y));
m_CircleLight.setRadius(Radius);
m_CircleLight.setFillColor(sf::Color(255,255,255,1));
m_VectorShape.push_back(m_CircleLight);
}
void CLights::Draw(sf::RenderWindow &window)
{
for(int i = 0; i < m_VectorShape.size(); i++)
{
m_SpriteBackground.setColor(sf::Color(0,0,0,240));
m_RTex.clear();
m_RTex.draw(m_VectorShape[i], sf::BlendNone);
m_RTex.display();
m_SpriteBackground.setTexture(m_RTex.getTexture(), true);
window.draw(m_SpriteBackground);
}
}