I'm making a bubble sorter visualizer. After making random squares and displaying them. Then it goes into my bubble sorter and I rerun my draw and display functions but the new updated array is not displaying. It stays the same
I tried changing different spots of where it clears the screen and also where it displays.
//Bubble Sorter
if (part == 2) {
for (int j = 0; j < arraySize; j++) {
if (squareArray[itera].getSize().y > squareArray[itera + 1].getSize().y) {
sf::RectangleShape temp = squareArray[itera];
squareArray[itera] = squareArray[itera + 1];
squareArray[itera + 1] = temp;
}
}
}
//Draws squares
for (int i = 0; i < arraySize; i++) {
window.draw(squareArray[i]); //Draws the square
std::string counter = std::to_string(i);
text.setString("Squares:" + counter); //Sets counter to string
}
window.draw(text); // Draws the text
window.display(); // Displays Everything