Thanks for your help to this point, but im still stuck with using the sf::Shape class in a selfmade class. I think i understood the fundemantals of using classes and inheritance but somehow im trying for two days now and still cant solve my problem. So help would be very much appreciated
Here is the code:
Asteroid.hpp
// Creation of an Asteroid
#ifndef _ASTEROID_HPP
#define _ASTEROID_HPP
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
class Asteroid : public sf::Shape {
private:
float X;
float Y;
float Radius;
const sf::Color& Col;
float Outline;
const sf::Color& OutlineCol;
public:
Asteroid(float X, float Y, float Radius, const Color& Col, float Outline = 0.f, const Color& OutlineCol = sf::Color(0, 0, 0)) <---- LINE 22
: sf::Shape::Circle(X, Y, Radius, Col, Outline, OutlineCol) {} <---- LINE 23
Asteroid(const Asteroid& orig);
virtual ~Asteroid();
};
#endif // _ASTEROID_HPP
Asteroid.cpp
#include "Asteroid.hpp"
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics/Drawable.hpp>
Asteroid::Asteroid(float X, float Y, float Radius, const sf::Color& Col, float Outline, const sf::Color& OutlineCol)
{
sf::Shape::Circle(X, Y, Radius, Col, Outline, OutlineCol);
}
Asteroid::Asteroid(const Asteroid& orig) {
}
Asteroid::~Asteroid() {
}
Here is what the compiler has to say:
In file included from main.cpp:9:
Asteroid.hpp:22: error: expected `,' or `...' before '&' token
Asteroid.hpp:23: error: ISO C++ forbids declaration of `Color' with no type
Asteroid.hpp: In constructor `Asteroid::Asteroid(float, float, float, int)':
Asteroid.hpp:23: error: expected class-name before '(' token
Asteroid.hpp:23: error: uninitialized reference member `Asteroid::Col'
Asteroid.hpp:23: error: uninitialized reference member `Asteroid::OutlineCol'
main.cpp: In function `int main(int, char**)':
main.cpp:131: error: no matching function for call to `Asteroid::Asteroid(float, float, float, sf::Color, float, sf::Color)'
Asteroid.hpp:25: note: candidates are: Asteroid::Asteroid(const Asteroid&)
Asteroid.hpp:23: note: Asteroid::Asteroid(float, float, float, int)
[/code]