Hi everyone,
I made a kind of "Button" class that is composed of a sprite and a text on it.
One of the functions of the class is the setText function that just set a new text on the button:
void Button::setText(std::string newText){
textOnButton.setString(newText);
}
It actually works in the main():
fleetButton.setText("Heyy") for example works and the new text of the button fleetButton becomes "Heyy".
However, I would like to store all my future button in a vector.
std::vector<Button> listOfButtons;
listOfButtons.push_back(fleetButton);
However, the setText doesn't work anymore if I use it like this :
for(int i =0; i<listOfButtons.size();i++){
listOfButtons[i].setText("Hey");
}
In fact, the text doesn't change.
It's the same for the setTexture function that I have.
Thanks for the help ^^