I've searched this forum for similar topics, but I haven't found any.
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const;
I'd like to know why? I'm asking because right now I have a problem, because of this little "const", here is a preview of this issue:
Wave.hclass Wave :
public sf::Drawable
{
private:
std::list<Enemy*> enemies;
[...]
public:
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const;
}
In
Wave.cpp I would like to draw every enemy in wave.
void Wave::draw(sf::RenderTarget& target, sf::RenderStates states) const
{
std::list<Enemy*>::iterator temp = enemies.begin();
for(temp; temp != currentEnemy; temp++)
{
target.draw(**temp);
}
}
But there is an error:
Error 1 error C2440: 'initializing' : cannot convert from 'std::_List_const_iterator<_Mylist>' to 'std::_List_iterator<_Mylist>'
Looks like one does not simply iterate the const list.
(there is a problem with initializing iterator "std::list<Enemy*>::iterator temp = enemies.begin();", without const it works, but it cannot initiate abstract class)
If you have any advices how to workaround this problem, please write them.
PS
Is the
AnimatedSprite included in standard version of SFML, or I have to copy it by myself?
PS2
Sorry for my lame English.
PS8
If the section on forum is wrong, please move this topic (I wasn't sure where to put it).