There is a button class that will be a button in the application. Used like this:
button playButton; playButton.create(20, 20, 120, 30, "123, 123, 123, "some", "value"); window->draw(playButton); The class itself is as follows:
class button { public: void create(int x, int y, int width, int height, char color, char name, char text) { sf::CircleShape name(50); name.setFillColor(sf::Color(color)); name.setOutlineThickness(10); name.setOutlineColor(sf::Color(250, 150, 100)); name.setPosition(x, y); } private: }; However, when trying to build a program, the compiler spits out, producing:
[Error] declaration of 'sf :: CircleShape name' shadows a parameter
I just can not understand what's the matter. If you use it like this, without trying to shove it into a class, but putting it into the main thread, everything works fine:
sf::CircleShape name(50); name.setFillColor(sf::Color(123,123,123)); name.setOutlineThickness(10); name.setOutlineColor(sf::Color(250, 150, 100)); name.setPosition(20, 20); window->draw(name);
nameand you declare a local variable namedname. - user194374