I'm attempting to inherit from Drawable in order to have multiple sprites behaving as if they were one (with a view to using it for a 2D skeletal animation system) - my overall code compiles fine if I do not declare any instances of the below class.
#include <vector>
#include <SFML/Graphics.hpp>
class MSprite : public sf::Drawable
{
public:
MSprite(sf::Image& Image, float Rotation = 0)
{
Sprite.SetImage(Image);
Sprite.SetRotation(Rotation);
DrawBehind = true;
}
bool DrawBehind;
sf::Sprite Sprite;
std::vector<MSprite> Children;
virtual void Render(sf::RenderTarget& target) const
{
if (DrawBehind) //draw below (before) child sprites
{
target.Draw(Sprite);
for (unsigned int i = 0; i < Children.size(); i++)
{
target.Draw(Children[i]);
}
}
else //draw above (after) child sprites
{
for (unsigned int i = 0; i < Children.size(); i++)
{
target.Draw(Children[i]);
}
target.Draw(Sprite);
}
}
};
I get the below error when trying to compile with a declaration, no errors if I don't.
c:\dev\000\main.cpp||In function `int main(int, char**)':|
c:\dev\000\main.cpp|17|error: no matching function for call to `CGameEngine::CGameEngine()'|
c:\dev\000\gameengine.h|15|note: candidates are: CGameEngine::CGameEngine(const CGameEngine&)|
||=== Build finished: 1 errors, 0 warnings ===|
I'm using a structure based mostly on this:
http://gamedevgeek.com/tutorials/managing-game-states-in-c/, but changed to use SFML instead of SDL.
Am I missing something ludicrously simple, like I think I am?