我一直收到此错误
C:\Users\Joshua\Desktop\Game Projects\SFML projects\Test\Render.cpp|21|error: 'class std::vector<Character>' has no member named 'getSprite'|
我试图接受包含vector
类pointers
的{{1}}。{包含正确的头文件,因此不是问题。在过去一小时左右的时间里,我一直试图解决这个问题,但我完全迷失了。我以为我做得对了。非常感谢!
Character
答案 0 :(得分:1)
怎么样:
void Render::draw(sf::RenderWindow* window, std::vector<Character>* foreground, std::vector<Character>* background, std::vector<Character>* scenery)
{
window->clear();
for(int a = 0; a<scenery->size(); a++ )
{
window->draw((*scenery)[a].getSprite());
}
for(int b = 0; b<background->size(); b++ )
{
window->draw((*background)[b].getSprite());
}
for(int c = 0; c<foreground->size(); c++ )
{
window->draw((*foreground)[c].getSprite());
}
window->display();
}