main.cpp:22:81: error: declaration of ‘button::button(int, int, int, int)’ outside of class is not definition [-fpermissive]
button::button (int xLowerLeft, int xLowerRight, int yParamTop, int yParamBottom);
Here is the "problem" code according to the compiler (g++):
(I know there are a lot of other errors, but I understood why they were happening. Why is this error popping up?)
//using sfml, thats why all the sf::'s are there. sfml provides most of the classes eg. sf::Vector2i. the s at the end of every private integer means store
class button {
public:
button();
button (int xLowerLeft, int xLowerRight, int yParamTop, int yParamBottom);
bool getClicked(sf::window * windowPoint);
private:
bool getIfHovering(sf:: window * windowPoint);
int xLowerLefts;
int xLowerRights;
int yParamTops;
int yParamBottoms;
};
button::button()
{
//do nothing
}
button::button (int xLowerLeft, int xLowerRight, int yParamTop, int yParamBottom);
{
int xLowerLefts = xLowerLeft;
int xLowerRights = xLowerRight;
int yParamTops = yParamTop;
int yParamBottoms = yParamBottom;
}
bool button::getClicked()
{
if (button::getIfHovering())
{
returntrue;
}
if (!button::getIfHovering())
{
returnfalse;
}
}
bool button::getIfHovering(sf::Window * windowPoint)
{
sf::Vector2i localPosition = sf::Mouse::getPosition(*windowPoint); // window is a sf::Window
int mousesXpos = 0;
int mousesYpos = 0;
mousesXpos = floor(localPosition.x);
mousesYpos = floor(localPosition.y);
if (mousesXpos > xLowerLefts && mousesXpos < xLowerRights && mousesYpos < yParamTops && mousesYpos > yParamBottoms)
{
returntrue;
}
else
{
returnfalse;
}
}
*Facepalm* i re-proofread code. I'm sorry i posted this. had a ; a the end of the line DERP.