Hello,
So I picked up SFML a few days ago, and so far it's been going pretty well. However, while I was making an entity class and trying to override the draw() function from sf::Drawable, when I went to make an entity, it said that I couldn't instantiate an abstract class - that is, even though I had thought I overrode draw(), it told me I hadn't. I've been searching StackOverflow, these forums, and Google for awhile now and haven't found an answer, and was hoping that someone here could point out what I did wrong.
My code:
// Entity.h
#ifndef ENTITY_H_
#define ENTITY_H_
#include "SFML\Graphics.hpp"
class Entity : public sf::Drawable, public sf::Transformable {
private:
sf::VertexArray vertices;
sf::Texture texture;
sf::Sprite sprite;
public:
// Miscellaneous functions
virtual void draw(sf::RenderTarget &target, sf::RenderStates &states) const;
};
#endif
// Entity.cpp
#include "Entity.h"
// Miscellaneous functions
void Entity::draw(sf::RenderTarget &target, sf::RenderStates &states) const {
states.transform *= getTransform();
states.texture = &texture;
target.draw(vertices, states);
}