I'm not really sure how to word the question, so I can't really get any answers from Google, but it goes like this.
For a screen-capture program I'm working on, I'm making a custom UI library for it written in C++/SFML. I want to have a function that creates a RectangleShape and Text entities for each button, but I'm not sure how to change the name so it comes from the function call, an example would be makeButton("buttonname", 25, 10);
I don't really have any code since I have no way to implement it, but here is kind of what I want.
int makeButton(string name, int x, int y) {
sf::RectangleShape button;
sf::Text buttonText;
button.setSize(sf::Vector2f(25.f, 5.f));
button.setFillColor(sf::Color::Blue);
// other code here
}
Thanks!