我正在尝试在SDL中实现Gui。将以下函数添加到我的gameWindow对象会给我一个错误。
class gameWindow {
private:
...
std::vector<guiObject> guiObjects;
...
public:
...
void deleteGuiObjectbyIndex(unsigned int index)
{
guiObjects.erase(guiObjects.begin()+index);
};
...
};
函数中的guiObject如下:
class guiObject {
private:
SDL_Rect position;
SDL_Texture* texture;
gameWindow &gWindow;
gameState &gState;
eventHandler &eHandler;
bool deleteOnClick;
int id;
public:
guiObject(int id,bool deleteOnClick, SDL_Rect _position, SDL_Texture* _texture, gameWindow & _gWindow, gameState & _gState, eventHandler & _eHandler) :
id(id),deleteOnClick(deleteOnClick),gWindow(_gWindow), gState(_gState), position(_position), texture(_texture),eHandler(_eHandler)
{};
SDL_Texture* getTexture();
SDL_Rect* getPosition();
void (guiObject::*onClick)();
void startPlay();
bool delOnClick(){return deleteOnClick;};
int getID(){return id;};
};
我得到的错误是:
Error C2280 'guiObject &guiObject::operator =(const guiObject &)': attempting to reference a deleted function