Ok so I'll try to keep this simple. I think the problem is with how I'm using sf::RectangleShape, because they're not drawing to the screen. Here is where they make an appearence in my gamepiece constructor:
pieceShape.setTexture(imgr.GetImage("line.png"));
for(int i = 0; i < 4; i++){
sf::RectangleShape rect;
rect.setPosition(pieceShape.getPosition().x + (i * 10), pieceShape.getPosition().y);
rect.setFillColor(sf::Color::Blue);
pieceRectangles_.push_back(rect);
}
I'm setting their color to blue to see if they're even on the screen where I intend for them to be, but they're simply not appearing.
//for(int i = 0; i < level.GetGamePieces().size(); i++){
//window.draw(level.GetGamePieces()[i].GetPieceSprite());
//}
for(int i = 0; i < level.GetGamePieces().size(); i++){
window.draw(level.GetGamePieces()[i].GetPieceRectangles()[i]);
}
The commented section is where I draw the sprite, that works fine. The bottom for loop does nothing visible, as if the sf::RectangleShapes I created weren't even there...
Related functions:
std::vector<sf::RectangleShape> pieceRectangles_;
std::vector<sf::RectangleShape> &GamePiece::GetPieceRectangles(){
return pieceRectangles_;
}
std::vector<GamePiece> gamePieces_;
std::vector<GamePiece> &Level::GetGamePieces(){
return gamePieces_;
}