Now, I'm getting the following error after trying to write the shape as a class:
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h|6|error: `sf::Shape::Rectangle' cannot appear in a constant-expression|
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h|6|error: a call to a constructor cannot appear in a constant-expression|
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h|6|error: a function call cannot appear in a constant-expression|
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h|6|error: invalid in-class initialization of static data member of non-integral type `const sf::Shape'|
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h||In constructor `Paddle::Paddle(float, float)':|
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h|11|error: `self' was not declared in this scope|
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h|11|warning: unused variable 'self'|
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h||In member function `void Paddle::Move(float, float)':|
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h|15|error: `self' was not declared in this scope|
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h|15|warning: unused variable 'self'|
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h||In member function `void Paddle::SetX(float)':|
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h|19|error: `self' was not declared in this scope|
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h|19|warning: unused variable 'self'|
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h||In member function `void Paddle::SetY(float)':|
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h|23|error: `self' was not declared in this scope|
C:\Users\BarrogaTravels\Desktop\Pong\Engine.h|23|warning: unused variable 'self'|
C:\Users\BarrogaTravels\Desktop\Pong\main.cpp||In function `int main()':|
C:\Users\BarrogaTravels\Desktop\Pong\main.cpp|45|error: 'class Paddle' has no member named 'GetPosition'|
C:\Users\BarrogaTravels\Desktop\Pong\main.cpp|46|error: 'class Paddle' has no member named 'GetPosition'|
C:\Users\BarrogaTravels\Desktop\Pong\main.cpp|48|error: 'class Paddle' has no member named 'GetPosition'|
C:\Users\BarrogaTravels\Desktop\Pong\main.cpp|49|error: 'class Paddle' has no member named 'GetPosition'|
C:\Users\BarrogaTravels\Desktop\Pong\main.cpp|66|error: expected `)' before "App"|
C:\Users\BarrogaTravels\Desktop\Pong\main.cpp|67|error: no matching function for call to `sf::RenderWindow::Draw(Paddle&)'|
C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\SFML\Graphics\RenderTarget.hpp|67|note: candidates are: virtual void sf::RenderTarget::Draw(const sf::Drawable&)|
C:\Users\BarrogaTravels\Desktop\Pong\main.cpp|68|error: no matching function for call to `sf::RenderWindow::Draw(Paddle&)'|
C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\SFML\Graphics\RenderTarget.hpp|67|note: candidates are: virtual void sf::RenderTarget::Draw(const sf::Drawable&)|
C:\Users\BarrogaTravels\Desktop\Pong\main.cpp|52|warning: unused variable 'Factor'|
||=== Build finished: 15 errors, 5 warnings ===|
Disregard the "GetPosition" error.
class Paddle {
private:
sf::Shape self = sf::Shape::Rectangle( 0, 10, 100, sf::Color( 255, 255, 255 ) );
public:
Paddle();
Paddle( float X, float Y ) {
self.Move( X, Y );
}
void Move( float X, float Y ) {
self.Move( X, Y );
}
void SetX( float X ) {
self.SetX( X );
}
void SetY( float Y ) {
self.SetY( Y );
}
};