Whenever I try to compile this files then it results in this error:
||=== Build: Debug in Game(compiler: GNU GCC Compiler) ===|
menuhandler.cpp||In member function 'void Gui::GuiHandler<C>::addGuiElem(...)':|menuhandler.cpp|42|error: expected primary-expression before '...' token|||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
#pragma once
namespace Gui
{
class GuiBase
{
public:
float PosX;
float PosY;
float Width;
float Height;
void SetPos(float newX, float newY);
void Move(float newX, float newY, float rate);
sf::Text textDisplay;
sf::Image imgDisplay;
};
class Button : public GuiBase
{
public:
Button(float x, float y, float width, float height, sf::String text, sf::Font& font, unsigned int textSize);
bool isClicked();
bool isMouseIn();
void SetText(sf::String newText);
};
template <class C>
class GuiHandler
{
public:
std::vector<std::shared_ptr<C>> GuiElements;
GuiHandler();
void addGuiElem(...);
void DrawElements(sf::RenderWindow& window);
};
}
menuhandler.cpp
#include <SFML/Graphics.hpp>
#include <vector>
#include <memory>
#include "menuhandler.hpp"
void Gui::GuiBase::SetPos(float newX, float newY)
{
PosX = newX;
PosY = newY;
}
void Gui::GuiBase::Move(float newX, float newY, float rate)
{
}
Gui::Button::Button(float x, float y, float width, float height, sf::String text, sf::Font& font, unsigned int textSize)
{
PosX = x;
PosY = y;
Width = width;
Height = height;
textDisplay.setFont(font);
textDisplay.setString(text);
textDisplay.setCharacterSize(textSize);
textDisplay.setPosition(x, y);
}
void Gui::Button::SetText(sf::String newText)
{
textDisplay.setString(newText);
}
template <class C>
Gui::GuiHandler<C>::GuiHandler()
{
}
template <class C>
void Gui::GuiHandler<C>::addGuiElem(...)
{
GuiElements.emplace_back(new C(...));
}
template <class C>
void Gui::GuiHandler<C>::DrawElements(sf::RenderWindow& window)
{
for (auto i: GuiElements)
{
window.draw(i->textDisplay);
//window.draw(i->imgDisplay);
}
}
What am I doing wrong here? help please...