Hi,
So I've been trying to compile this code, but it always results in an error:
menuhandler.cpp|18|error: no match for call to '(std::vector<GuiElem>) (Button)'|
I was trying to create a simple menu system...
Here's the code:
menuhandler.hpp
#pragma once
class GuiElem
{
public:
static std::vector<GuiElem> guiElems;
float PosX;
float PosY;
float Width;
float Height;
float Rot;
bool SetPos(float newX, float newY);
bool SetWidth(float newWidth);
bool SetHeight(float newHeight);
bool SetRot(float newRot);
};
class Button : public GuiElem
{
public:
sf::String textDisplay;
Button(sf::String name, float x, float y, float width, float height);
bool newButton(sf::String name, float x, float y, float width, float height);
bool isClicked();
bool isMouseIn();
};
menuhandler.cpp
#include <SFML/Graphics.hpp>
#include <vector>
#include "menuhandler.hpp"
Button::Button(sf::String name, float x, float y, float width, float height)
{
textDisplay = name;
PosX = x;
PosY = y;
Width = width;
Height = height;
}
bool Button::newButton(sf::String name, float x, float y, float width, float height)
{
try
{
GuiElem::guiElems(Button(name, x, y, width, height));
return true;
}
catch(...)
{
return false;
}
}
Thanks in advance...