For some reason this code won't render the rectangleshape correctly. It takes control away from the player correctly and waits the right amount before giving it back, but the rectangle doesn't render on the window. If you need more of my code, please let me know.
int screenHeight = 500;
int screenWidth = 500;
if (Keyboard::isKeyPressed(Keyboard::Escape)){
playerControl = false;
RectangleShape menuBackground;
menuBackground.setFillColor(sf::Color::Red);
menuBackground.setSize(Vector2f(0, 0));
menuBackground.setPosition(sf::Vector2f(screenWidth / 2, screenHeight / 2));
window.draw(menuBackground);
for (int c = 1; c < 51; c++){
menuBackground.setSize(sf::Vector2f(round(screenWidth / 50) * c, round(screenHeight / 50) * c));
menuBackground.move(sf::Vector2f((round(screenWidth / 50) * c / 2) * -1, round((screenHeight / 50) * c / 2) * -1));
window.draw(menuBackground);
sleep(Time(milliseconds(10)));
}
menuBackground.setSize(Vector2f(screenWidth, screenHeight));
window.draw(menuBackground);
sleep(Time(seconds(3)));
for (int a = 0; a < 50; a++){
menuBackground.setSize(sf::Vector2f(screenWidth - (round(screenWidth / 50) * a), screenHeight - (round(screenHeight / 50) * a)));
menuBackground.move(sf::Vector2f(round(screenWidth / 50) * a / 2, round(screenHeight / 50) * a / 2));
window.draw(menuBackground);
sleep(Time(milliseconds(10)));
}
menuBackground.setSize(Vector2f(0, 0));
window.draw(menuBackground);
playerControl = true;
}