Thanks, that worked.
The problem now is, that the compiler says:
ld: duplicate symbol cShot::imageShot in /Users/.../shot.o and /Users/.../main.o
The shot.h looks like:
#include <SFML/Graphics.hpp>
class cShot {
public:
void Draw();
void Update(sf::Event *Event);
int Initialize(sf::RenderWindow *apWindow);
int gWidth;
int gHeight;
int Speed;
cShot()
{
spriteShot.SetImage(imageShot); // every sprite uses the same unique image
}
static bool Init(const std::string& ImageFile)
{
return imageShot.LoadFromFile(ImageFile);
}
private:
sf::RenderWindow *pWindow;
sf::Sprite spriteShot;
static sf::Image imageShot;
};
sf::Image cShot::imageShot;
In shot.cpp 'imageShot' isn't used anytime. In main.cpp I'm just including the shot.h. I also didn't create an instance of cShot.
Uh, and I can't load an Image for 'imageShot' from a file (with the constructor), that's why the
static bool Init(const std::string& ImageFile)
{
return imageShot.LoadFromFile(ImageFile);
}
exists. Also shown in the tutorial.