Hi, I'm attempting to create an animation system which is essentially just a dumbed down version of what is in the Thor library.
I have not coded much yet at all but have run into an error that I cannot resolve.
First, I have a header of a class I am calling "Animator". It looks like this:
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
class Animator
{
private:
// The following is a structure containing information about a frame. Right now it is just an arbitrary float
// which will be the frame duration and a subrectangle which will be the frame on the sprite sheet.
struct Frame
{
Frame(float duration, const sf::IntRect& subrect);
mutable float duration;
sf::IntRect subrect;
};
// Here is a vector of frames which will compose an animation.
std::vector<Frame> mFrames;
public:
Animator();
~Animator();
// And a function prototype to add a frame to the vector.
void addFrame(float duration, const sf::IntRect& subrect);
};
Here is the implementation:
#include "animate.h"
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
Animator::Animator()
{
}
Animator::~Animator()
{
}
// addFrame function. All I'm doing here is pushing back the information gained through the parameters
// in the vector
void Animator::addFrame(float duration, const sf::IntRect& subrect)
{
mFrames.push_back(Frame(duration, subrect));
}
Obviously there isn't much here. I've just ripped off Bromeon's AddFrame stuff. Even so, when I try to compile this Code::Blocks gives me an error:
obj\Debug\animate.o:C:\Users\user\Documents\CodeBlocks\Projects\SFML1\animate.cpp|17|undefined reference to `Animator::Frame::Frame(float, sf::Rect<int> const&)'|
I've never really used containers before, so it's probably some dumb syntax mistake I've made. I can't figure it out though; it looks exactly like what is in the Thor library as far as I can tell.