この奇妙なエラーが発生します:
エラーC2663:'sf :: Drawable :: SetPosition':2つのオーバーロードには'this'ポインタの正当な変換がありません
constの不一致と関係があると思いますが、どこで、なぜかわかりません。次のコードでは、図形とスプライトのベクトルがあり、ベクトルの図形の1つにアクセスしてその関数のいずれかを呼び出そうとすると、エラーが発生します。
std::vector<sf::Shape> Shapes;
std::vector<sf::Sprite> Sprites;
bool AddShape(sf::Shape& S){
Shapes.push_back(S); return true;
};
bool AddSprite(sf::Sprite& S){
Sprites.push_back(S); return true;
};
private:
virtual void Render(sf::RenderTarget& target) const {
for(unsigned short I; I<Shapes.size(); I++){
Shapes[I].SetPosition(
Shapes[I].GetPosition().x + GetPosition().x,
Shapes[I].GetPosition().y + GetPosition().y);
target.Draw(Shapes[I]);
}
for(unsigned short I; I<Sprites.size(); I++){
target.Draw(Sprites[I]);
}
}
どうすればこれを修正できますか?