I think there's a simple solution I'm overlooking, but how can I do it so that the 3 rectangles are at different x positions from each other without getting moved out the screen.
//Game.cpp
void Game::draw_cars(sf::RenderWindow& window)
{
for (int i = 0; i < state.cars.size(); i++) {
state.cars[i].draw_vehicles(window);
}
}
void Car::draw_vehicles(sf::RenderWindow& window)
{
rectangle.setPosition(sf::Vector2f(CAR_POSITION_X + Offset, CAR_POSITION_Y));
window.draw(rectangle);
}
